Skip to content

Commit

Permalink
CI: Add self-compile step to GHA main jobs (#16586)
Browse files Browse the repository at this point in the history
This test making sure that DMD can successfully build itself got lost
when disabling/commenting-out the coverage jobs.
  • Loading branch information
kinke authored Jun 16, 2024
1 parent 515f395 commit 86b71a2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ jobs:
- name: Test phobos
if: '!matrix.coverage'
run: ci/run.sh test_phobos
- name: Test self-compile
if: '!matrix.coverage' # already re-built with enabled coverage
run: ENABLE_RELEASE=0 ci/run.sh rebuild
- name: Upload coverage report
if: matrix.coverage
run: ci/run.sh codecov
Expand Down Expand Up @@ -252,3 +255,7 @@ jobs:
echo '::group::Test phobos'
ci/run.sh test_phobos
echo '::endgroup::'
echo '::group::Test self-compile'
ENABLE_RELEASE=0 ci/run.sh rebuild
echo '::endgroup::'
14 changes: 11 additions & 3 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,22 @@ build() {
# self-compile dmd
rebuild() {
local compare=${1:-0}

local dotexe=""
local conf="dmd.conf"
if [ "$OS_NAME" == "windows" ]; then
dotexe=".exe"
conf="sc.ini"
fi

# `generated` gets cleaned in the next step, so we create another _generated
# The nested folder hierarchy is needed to conform to those specified in
# the generated dmd.conf
mkdir -p _${build_path}
cp $build_path/dmd _${build_path}/host_dmd
cp $build_path/dmd.conf _${build_path}
cp $build_path/dmd$dotexe _${build_path}/host_dmd$dotexe
cp $build_path/$conf _${build_path}/
rm -rf $build_path
generated/build -j$N MODEL=$MODEL HOST_DMD=_${build_path}/host_dmd DFLAGS="$CI_DFLAGS" ENABLE_RELEASE=${ENABLE_RELEASE:-1} dmd
generated/build -j$N MODEL=$MODEL HOST_DMD=_${build_path}/host_dmd$dotexe DFLAGS="$CI_DFLAGS" ENABLE_RELEASE=${ENABLE_RELEASE:-1} dmd

# compare binaries to test reproducible build
if [ $compare -eq 1 ]; then
Expand Down

0 comments on commit 86b71a2

Please sign in to comment.