diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1e8e3a9..b011d9b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -85,7 +85,7 @@ dub build --compiler=${{ env.DC }} if [[ ${{ matrix.do_test }} == 'true' ]]; then dub run --compiler=${{ env.DC }} --single test/issue2051_running_unittests_from_dub_single_file_packages_fails.d - ./scripts/ci/travis.sh + ./scripts/ci/ci.sh fi - name: '[Windows] Test' diff --git a/scripts/ci/ci.sh b/scripts/ci/ci.sh new file mode 100755 index 0000000..a811e75 --- /dev/null +++ b/scripts/ci/ci.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +set -v -e -o pipefail + +vibe_ver=$(jq -r '.versions | .["vibe-d"]' < dub.selections.json) +dub fetch vibe-d@$vibe_ver # get optional dependency +dub test --compiler=${DC} -c library-nonet + +export DMD="$(command -v $DMD)" + +if [ "$FRONTEND" \> 2.087.z ]; then + ./build.d -preview=dip1000 -preview=in -w -g -debug +fi + +function clean() { + # Hard reset of the DUB local folder is necessary as some tests + # currently don't properly clean themselves + rm -rf ~/.dub + git clean -dxf -- test +} + +if [ "$COVERAGE" = true ]; then + # library-nonet fails to build with coverage (Issue 13742) + dub test --compiler=${DC} -b unittest-cov + ./build.d -cov + + wget https://codecov.io/bash -O codecov.sh + bash codecov.sh +else + ./build.d + DUB=`pwd`/bin/dub DC=${DC} dub --single ./test/run-unittest.d + DUB=`pwd`/bin/dub DC=${DC} test/run-unittest.sh +fi + +## Checks that only need to be done once per CI run +## Here the `COVERAGE` variable is abused for this purpose, +## as it's only defined once in the whole Travis matrix +if [ "$COVERAGE" = true ]; then + # run tests with different compilers + DUB=`pwd`/bin/dub DC=${DC} test/run-unittest.sh + clean + + export FRONTEND=2.077 + source $(~/dlang/install.sh ldc-1.7.0 --activate) + DUB=`pwd`/bin/dub DC=${DC} test/run-unittest.sh + deactivate + clean + + export FRONTEND=2.068 + source $(~/dlang/install.sh gdc-4.8.5 --activate) + DUB=`pwd`/bin/dub DC=${DC} test/run-unittest.sh + deactivate + + # check for trailing whitespace + find . -type f -name '*.d' -exec grep -Hn "[[:blank:]]$" {} \; + # check that the man page generation still works + source $(~/dlang/install.sh dmd --activate) + source $(~/dlang/install.sh dub --activate) + dub --single -v scripts/man/gen_man.d +fi diff --git a/scripts/ci/setup-ldc-windows.sh b/scripts/ci/setup-ldc-windows.sh index e95881e..ec70e9c 100644 --- a/scripts/ci/setup-ldc-windows.sh +++ b/scripts/ci/setup-ldc-windows.sh @@ -2,7 +2,7 @@ # sets up LDC for cross-compilation. Source this script, s.t. the new LDC is in PATH -# Make sure this version matches the version of LDC2 used in .travis.yml, +# Make sure this version matches the version of LDC2 used in the CI configuration # otherwise the compiler and the lib used might mismatch. LDC_VERSION="1.22.0" ARCH=${ARCH:-32} diff --git a/scripts/ci/travis.sh b/scripts/ci/travis.sh deleted file mode 100755 index a811e75..0000000 --- a/scripts/ci/travis.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -set -v -e -o pipefail - -vibe_ver=$(jq -r '.versions | .["vibe-d"]' < dub.selections.json) -dub fetch vibe-d@$vibe_ver # get optional dependency -dub test --compiler=${DC} -c library-nonet - -export DMD="$(command -v $DMD)" - -if [ "$FRONTEND" \> 2.087.z ]; then - ./build.d -preview=dip1000 -preview=in -w -g -debug -fi - -function clean() { - # Hard reset of the DUB local folder is necessary as some tests - # currently don't properly clean themselves - rm -rf ~/.dub - git clean -dxf -- test -} - -if [ "$COVERAGE" = true ]; then - # library-nonet fails to build with coverage (Issue 13742) - dub test --compiler=${DC} -b unittest-cov - ./build.d -cov - - wget https://codecov.io/bash -O codecov.sh - bash codecov.sh -else - ./build.d - DUB=`pwd`/bin/dub DC=${DC} dub --single ./test/run-unittest.d - DUB=`pwd`/bin/dub DC=${DC} test/run-unittest.sh -fi - -## Checks that only need to be done once per CI run -## Here the `COVERAGE` variable is abused for this purpose, -## as it's only defined once in the whole Travis matrix -if [ "$COVERAGE" = true ]; then - # run tests with different compilers - DUB=`pwd`/bin/dub DC=${DC} test/run-unittest.sh - clean - - export FRONTEND=2.077 - source $(~/dlang/install.sh ldc-1.7.0 --activate) - DUB=`pwd`/bin/dub DC=${DC} test/run-unittest.sh - deactivate - clean - - export FRONTEND=2.068 - source $(~/dlang/install.sh gdc-4.8.5 --activate) - DUB=`pwd`/bin/dub DC=${DC} test/run-unittest.sh - deactivate - - # check for trailing whitespace - find . -type f -name '*.d' -exec grep -Hn "[[:blank:]]$" {} \; - # check that the man page generation still works - source $(~/dlang/install.sh dmd --activate) - source $(~/dlang/install.sh dub --activate) - dub --single -v scripts/man/gen_man.d -fi