Files
Nim/tools/ci_generate.nim
Timothee Cour dce0b3b002 refactor all code that builds csources (#17815)
* refactor all code that builds csources
* fixup
* nim_csourcesDir_v0 + nim_csourcesDir
* remove deprecated, unused scripts from ci/
* reuse nimCsourcesHash in ci
* simplify CI pipelines by reusing nimBuildCsourcesIfNeeded
* simplify ci_docs.yml by reusing nimBuildCsourcesIfNeeded
* cleanup
* use csources_v1 as destination dir
* fixup
* remove pushCsources
* address comment: remove build.sh support for now
* fixup
2021-04-23 11:28:42 +02:00

65 lines
1.4 KiB
Nim

##[
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: |
set -e
cd Nim
. ci/funs.sh && nimBuildCsourcesIfNeeded
$nim_csources c koch
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
- test: |
cd Nim
if ! ./koch runCI; then
nim r tools/ci_testresults.nim
exit 1
fi
triggers:
- action: email
condition: failure
to: Andreas Rumpf <rumpf_a@web.de>
"""
proc main()=
# not too large to be resource friendly, refs bug #17107
let num = 2
# if you reduce this, make sure to remove files that shouldn't be generated,
# or better, do the cleanup logic here e.g.: `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()