From defece26e42dfa83cabd235eae4eeccdd189a9e6 Mon Sep 17 00:00:00 2001 From: Mathias Lang Date: Tue, 23 Jan 2024 13:43:24 +0100 Subject: [PATCH] CI: Move single checks to Github, remove dead code Remove support for very old frontend - we were not testing it anyways. Move the useful checks to another job so they run once. --- .github/workflows/main.yml | 22 +++++++++++++++ scripts/ci/ci.sh | 27 ------------------- scripts/man/gen_man.d | 6 ++--- source/dub/internal/tinyendian.d | 2 +- test/environment-variables.script.d | 16 +++++------ test/issue1504-envvar-in-path/source/app.d | 4 +-- ...ests_from_dub_single_file_packages_fails.d | 6 ++--- 7 files changed, 39 insertions(+), 44 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b011d9b54..919b1b5d1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,6 +23,28 @@ on: - github-actions jobs: + single_checks: + name: "Single sanity check" + runs-on: ubuntu-latest + steps: + - name: Install latest DMD + uses: dlang-community/setup-dlang@v1 + - name: Checkout + uses: actions/checkout@v3 + - name: Run tests + run: | + # check for trailing whitespace + TRAILING_WS_COUNT=$(find . -type f -name '*.d' -exec grep -Hn "[[:blank:]]$" {} \; | wc -l) + if [ $TRAILING_WS_COUNT -ne 0 ]; then + echo "========================================" + find . -type f -name '*.d' -exec grep -Hn "[[:blank:]]$" {} \; + echo "========================================" + echo "The files above have trailing whitespace" + exit 1 + fi + # check that the man page generation still works + dub --single -v scripts/man/gen_man.d + main: name: Run strategy: diff --git a/scripts/ci/ci.sh b/scripts/ci/ci.sh index a811e7570..ab8490bf1 100755 --- a/scripts/ci/ci.sh +++ b/scripts/ci/ci.sh @@ -31,30 +31,3 @@ else 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/man/gen_man.d b/scripts/man/gen_man.d index 3d4a12734..eb95930f3 100755 --- a/scripts/man/gen_man.d +++ b/scripts/man/gen_man.d @@ -404,9 +404,9 @@ dependencies \- both downloading them and linking them into the application.`); manFile.mode == ManWriter.Mode.markdown ? "\n\n" : "\n" )); } - } - - + } + + writeln(manFile.header("COMMON OPTIONS")); manFile.writeArgs("-", args); diff --git a/source/dub/internal/tinyendian.d b/source/dub/internal/tinyendian.d index d9b227a12..a6e9681f2 100644 --- a/source/dub/internal/tinyendian.d +++ b/source/dub/internal/tinyendian.d @@ -122,7 +122,7 @@ auto fixUTFByteOrder(ubyte[] array) @safe @nogc pure nothrow static immutable Endian[5] bomEndian = [ endian, Endian.littleEndian, Endian.bigEndian, - Endian.littleEndian, + Endian.littleEndian, Endian.bigEndian ]; // Documented in function ddoc. diff --git a/test/environment-variables.script.d b/test/environment-variables.script.d index c96c2c4bb..347f69682 100644 --- a/test/environment-variables.script.d +++ b/test/environment-variables.script.d @@ -15,7 +15,7 @@ void main() // preRunCommands uses system.environments < settings.environments < deppkg.environments < root.environments < deppkg.runEnvironments < root.runEnvironments < deppkg.preRunEnvironments < root.preRunEnvironments // User application uses system.environments < settings.environments < deppkg.environments < root.environments < deppkg.runEnvironments < root.runEnvironments // postRunCommands uses system.environments < settings.environments < deppkg.environments < root.environments < deppkg.runEnvironments < root.runEnvironments < deppkg.postRunEnvironments < root.postRunEnvironments - + // Test cases covers: // preGenerateCommands [in root] // priority check: system.environments < settings.environments @@ -50,30 +50,30 @@ void main() ], Config.none, size_t.max, currDir.buildPath("environment-variables")); scope (failure) writeln("environment-variables test failed... Testing stdout is:\n-----\n", res.output); - + // preGenerateCommands [in root] assert(res.output.canFind("root.preGenerate: setting.PRIORITYCHECK_SYS_SET"), "preGenerate environment variables priority check is failed."); assert(res.output.canFind("root.preGenerate: deppkg.PRIORITYCHECK_SET_DEP"), "preGenerate environment variables priority check is failed."); assert(res.output.canFind("root.preGenerate: deppkg.PRIORITYCHECK_DEP_ROOT"), "preGenerate environment variables priority check is failed."); assert(res.output.canFind("root.preGenerate: deppkg.PRIORITYCHECK_ROOT_DEPSPEC"), "preGenerate environment variables priority check is failed."); assert(res.output.canFind("root.preGenerate: root.PRIORITYCHECK_DEPSPEC_ROOTSPEC"), "preGenerate environment variables priority check is failed."); - + // postGenerateCommands [in root] assert(res.output.canFind("root.postGenerate: deppkg.VAR4", "postGenerate environment variables expantion check is failed.")); - + // preBuildCommands [in deppkg] assert(res.output.canFind("deppkg.preBuild: deppkg.PRIORITYCHECK_ROOT_DEPBLDSPEC"), "preBuild environment variables priority check is failed."); assert(res.output.canFind("deppkg.preBuild: root.PRIORITYCHECK_DEPBLDSPEC_ROOTBLDSPEC"), "preBuild environment variables priority check is failed."); assert(res.output.canFind("deppkg.preBuild: deppkg.PRIORITYCHECK_ROOTBLDSPEC_DEPSPEC"), "preBuild environment variables priority check is failed."); assert(res.output.canFind("deppkg.preBuild: root.PRIORITYCHECK_DEPSPEC_ROOTSPEC"), "preBuild environment variables priority check is failed."); - + // postBuildCommands [in deppkg] assert(res.output.canFind("deppkg.postBuild: deppkg.VAR4"), "postBuild environment variables expantion check is failed."); - + // preRunCommands [in deppkg][in root] assert(!res.output.canFind("deppkg.preRun: deppkg.VAR4"), "preRun that is defined dependent library does not call."); assert(res.output.canFind("root.preRun: deppkg.VAR4"), "preRun environment variables expantion check is failed."); - + // Application run assert(res.output.canFind("app.run: root.VAR1"), "run environment variables expantion check is failed."); assert(res.output.canFind("app.run: settings.VAR2"), "run environment variables expantion check is failed."); @@ -81,7 +81,7 @@ void main() assert(res.output.canFind("app.run: deppkg.VAR4"), "run environment variables expantion check is failed."); assert(res.output.canFind("app.run: system.VAR5"), "run environment variables expantion check is failed."); assert(res.output.canFind("app.run: system.SYSENVVAREXPCHECK"), "run environment variables expantion check is failed."); - + // postRunCommands [in deppkg][in root] assert(!res.output.canFind("deppkg.postRun: deppkg.VAR4"), "postRunCommands that is defined dependent library does not call."); assert(res.output.canFind("root.postRun: deppkg.VAR4"), "postRun environment variables expantion check is failed."); diff --git a/test/issue1504-envvar-in-path/source/app.d b/test/issue1504-envvar-in-path/source/app.d index 131d98400..2b03f41af 100644 --- a/test/issue1504-envvar-in-path/source/app.d +++ b/test/issue1504-envvar-in-path/source/app.d @@ -1,5 +1,5 @@ pragma(msg, import("message.txt")); void main() -{ -} \ No newline at end of file +{ +} diff --git a/test/issue2051_running_unittests_from_dub_single_file_packages_fails.d b/test/issue2051_running_unittests_from_dub_single_file_packages_fails.d index a3caf1dac..daa6ae870 100644 --- a/test/issue2051_running_unittests_from_dub_single_file_packages_fails.d +++ b/test/issue2051_running_unittests_from_dub_single_file_packages_fails.d @@ -28,11 +28,11 @@ int main() auto dub = environment.get("DUB"); if (!dub.length) dub = buildPath(".", "bin", "dub"); - + string destinationDirectory = tempDir; // remove any ending slahes (which can for some reason be added at the end by tempDir, which fails on OSX) https://issues.dlang.org/show_bug.cgi?id=22738 destinationDirectory = buildNormalizedPath(destinationDirectory); - + string filename; // check if the single file package with dependency compiles and runs { @@ -100,4 +100,4 @@ unittest writeln("\nError. Unittest passed."); return rc1 | !rc2; -} \ No newline at end of file +}