diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2020-06-30 05:21:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-30 14:21:30 +0200 |
commit | 89a15e417df52454aa5c40ba058c9b19425dd184 (patch) | |
tree | 2aba5f3c5cfd8061286f1d30c9714cb0201f13d5 | |
parent | 04deb6c9421d0a11cedfc7e8c52ae3b30e7bf1db (diff) | |
download | Nim-89a15e417df52454aa5c40ba058c9b19425dd184.tar.gz |
CI openbsd: 3x batching via NIM_TESTAMENT_BATCH ; overall CI finishes in 21m instead of 34m (#14851)
* CI openbsd: 2x batching via NIM_TESTAMENT_BATCH * auto-generate .builds/openbsd_x.yml to avoid code duplication * 3x batching
-rw-r--r-- | .builds/openbsd_0.yml (renamed from .builds/openbsd.yml) | 3 | ||||
-rw-r--r-- | .builds/openbsd_1.yml | 34 | ||||
-rw-r--r-- | .builds/openbsd_2.yml | 34 | ||||
-rw-r--r-- | testament/specs.nim | 3 | ||||
-rw-r--r-- | tests/dll/server.nim | 1 | ||||
-rw-r--r-- | tools/ci_generate.nim | 63 |
6 files changed, 138 insertions, 0 deletions
diff --git a/.builds/openbsd.yml b/.builds/openbsd_0.yml index c4db2f621..278cb3de9 100644 --- a/.builds/openbsd.yml +++ b/.builds/openbsd_0.yml @@ -1,3 +1,5 @@ +## do not edit directly; auto-generated by `nim r tools/ci_generate.nim` + image: openbsd/latest packages: - gmake @@ -11,6 +13,7 @@ packages: sources: - https://github.com/nim-lang/Nim environment: + NIM_TESTAMENT_BATCH: "0_3" CC: /usr/bin/clang tasks: - setup: | diff --git a/.builds/openbsd_1.yml b/.builds/openbsd_1.yml new file mode 100644 index 000000000..d3f0c8795 --- /dev/null +++ b/.builds/openbsd_1.yml @@ -0,0 +1,34 @@ +## do not edit directly; auto-generated by `nim r tools/ci_generate.nim` + +image: openbsd/latest +packages: +- gmake +- sqlite3 +- node +- boehm-gc +- pcre +- sfml +- sdl2 +- libffi +sources: +- https://github.com/nim-lang/Nim +environment: + NIM_TESTAMENT_BATCH: "1_3" + CC: /usr/bin/clang +tasks: +- setup: | + cd Nim + git clone --depth 1 -q https://github.com/nim-lang/csources.git + gmake -C csources -j $(sysctl -n hw.ncpuonline) + bin/nim c koch + echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv +- test: | + cd Nim + if ! ./koch runCI; then + nim c -r tools/ci_testresults.nim + exit 1 + fi +triggers: +- action: email + condition: failure + to: Andreas Rumpf <rumpf_a@web.de> diff --git a/.builds/openbsd_2.yml b/.builds/openbsd_2.yml new file mode 100644 index 000000000..4b63e914d --- /dev/null +++ b/.builds/openbsd_2.yml @@ -0,0 +1,34 @@ +## do not edit directly; auto-generated by `nim r tools/ci_generate.nim` + +image: openbsd/latest +packages: +- gmake +- sqlite3 +- node +- boehm-gc +- pcre +- sfml +- sdl2 +- libffi +sources: +- https://github.com/nim-lang/Nim +environment: + NIM_TESTAMENT_BATCH: "2_3" + CC: /usr/bin/clang +tasks: +- setup: | + cd Nim + git clone --depth 1 -q https://github.com/nim-lang/csources.git + gmake -C csources -j $(sysctl -n hw.ncpuonline) + bin/nim c koch + echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv +- test: | + cd Nim + if ! ./koch runCI; then + nim c -r tools/ci_testresults.nim + exit 1 + fi +triggers: +- action: email + condition: failure + to: Andreas Rumpf <rumpf_a@web.de> diff --git a/testament/specs.nim b/testament/specs.nim index 2f2c006d8..acffbf8be 100644 --- a/testament/specs.nim +++ b/testament/specs.nim @@ -84,6 +84,9 @@ type parseErrors*: string # when the spec definition is invalid, this is not empty. unjoinable*: bool unbatchable*: bool + # whether this test can be batchable via `NIM_TESTAMENT_BATCH`; only very + # few tests are not batchable; the ones that are not could be turned batchable + # by making the dependencies explicit useValgrind*: bool timeout*: float # in seconds, fractions possible, # but don't rely on much precision diff --git a/tests/dll/server.nim b/tests/dll/server.nim index 2b7791d4b..dd4606298 100644 --- a/tests/dll/server.nim +++ b/tests/dll/server.nim @@ -1,6 +1,7 @@ discard """ action: compile cmd: "nim $target --debuginfo --hints:on --define:useNimRtl --app:lib $options $file" +batchable: false """ type diff --git a/tools/ci_generate.nim b/tools/ci_generate.nim new file mode 100644 index 000000000..bfed8d88f --- /dev/null +++ b/tools/ci_generate.nim @@ -0,0 +1,63 @@ +##[ +avoid code duplication in CI pipelines. +For now, this is only used for openbsd, but there is a lot of other code +duplication that could be removed. + +## usage +edit this file as needed and then re-generate via: +``` +nim r tools/ci_generate.nim +``` +]## + +import std/strformat + +proc genCIopenbsd(batch: int, num: int): string = + result = fmt""" +## do not edit directly; auto-generated by `nim r tools/ci_generate.nim` + +image: openbsd/latest +packages: +- gmake +- sqlite3 +- node +- boehm-gc +- pcre +- sfml +- sdl2 +- libffi +sources: +- https://github.com/nim-lang/Nim +environment: + NIM_TESTAMENT_BATCH: "{batch}_{num}" + CC: /usr/bin/clang +tasks: +- setup: | + cd Nim + git clone --depth 1 -q https://github.com/nim-lang/csources.git + gmake -C csources -j $(sysctl -n hw.ncpuonline) + bin/nim c koch + echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv +- test: | + cd Nim + if ! ./koch runCI; then + nim c -r tools/ci_testresults.nim + exit 1 + fi +triggers: +- action: email + condition: failure + to: Andreas Rumpf <rumpf_a@web.de> +""" + +proc main()= + let num = 3 + # if you reduce this, make sure to remove files that shouldn't be generated, + # or better, do the cleanup logic here eg: `rm .builds/openbsd_*` + for i in 0..<num: + let file = fmt".builds/openbsd_{i}.yml" + let code = genCIopenbsd(i, num) + writeFile(file, code) + +when isMainModule: + main() |