Skip to content

Commit

Permalink
CI: Move single checks to Github, remove dead code
Browse files Browse the repository at this point in the history
Remove support for very old frontend - we were not testing it anyways.
Move the useful checks to another job so they run once.
  • Loading branch information
Geod24 committed Jan 23, 2024
1 parent 9df5f71 commit defece2
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 44 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
27 changes: 0 additions & 27 deletions scripts/ci/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions scripts/man/gen_man.d
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion source/dub/internal/tinyendian.d
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 8 additions & 8 deletions test/environment-variables.script.d
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -50,38 +50,38 @@ 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.");
assert(res.output.canFind("app.run: root.VAR3"), "run environment variables expantion check is failed.");
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.");
Expand Down
4 changes: 2 additions & 2 deletions test/issue1504-envvar-in-path/source/app.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pragma(msg, import("message.txt"));

void main()
{
}
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -100,4 +100,4 @@ unittest
writeln("\nError. Unittest passed.");

return rc1 | !rc2;
}
}

0 comments on commit defece2

Please sign in to comment.