update nimble build script (#155)

This commit is contained in:
Jacek Sieka 2022-11-19 07:50:31 +01:00 committed by GitHub
parent d087c039c2
commit 66c16920a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 47 deletions

View File

@ -156,24 +156,5 @@ jobs:
nim --version
nimble --version
nimble install -y --depsOnly
env TEST_LANG=c nimble test
env TEST_LANG=cpp nimble test
# - name: Setup VCC (Windows-i386)
# if: runner.os == 'Windows' && matrix.target.cpu == 'i386'
# uses: ilammy/msvc-dev-cmd@v1.5.0
# with:
# arch: amd64_x86
# - name: Setup VCC (Windows-amd64)
# if: runner.os == 'Windows' && matrix.target.cpu == 'amd64'
# uses: ilammy/msvc-dev-cmd@v1.5.0
# with:
# arch: x64
# - name: Test using VCC
# if: runner.os == 'Windows'
# run: |
# nimble install -y --depsOnly
# env TEST_LANG=c nimble testvcc
# env TEST_LANG=cpp nimble testvcc
env NIMLANG=c nimble test
env NIMLANG=cpp nimble test

View File

@ -10,32 +10,26 @@ skipDirs = @["tests"]
requires "nim >= 1.2.0",
"unittest2"
### Helper functions
proc test(args, path: string) =
# Compilation language is controlled by TEST_LANG
exec "nim " & getEnv("TEST_LANG", "c") & " " & getEnv("NIMFLAGS") &
" " & args &
" -r --hints:off --skipParentCfg --styleCheck:usages --styleCheck:error" &
" " & path
let nimc = getEnv("NIMC", "nim") # Which nim compiler to use
let lang = getEnv("NIMLANG", "c") # Which backend (c/cpp/js)
let flags = getEnv("NIMFLAGS", "") # Extra flags for the compiler
let verbose = getEnv("V", "") notin ["", "0"]
proc buildHelper(args, path: string) =
exec "nim " & getEnv("TEST_LANG", "c") & " " & getEnv("NIMFLAGS") &
" " & args &
" --hints:off --skipParentCfg --styleCheck:usages --styleCheck:error" &
" " & path
let styleCheckStyle = if (NimMajor, NimMinor) < (1, 6): "hint" else: "error"
let cfg =
" --styleCheck:usages --styleCheck:" & styleCheckStyle &
(if verbose: "" else: " --verbosity:0 --hints:off") &
" --skipParentCfg --skipUserCfg"
proc build(args, path: string) =
exec nimc & " " & lang & " " & cfg & " " & flags & " " & args & " " & path
proc run(args, path: string) =
build args & " -r", path
task test, "Run all tests":
# Building `test_helper.nim`.
buildHelper("", "tests/test_helper")
test "--threads:off", "tests/all_tests"
test "--threads:on -d:nimTypeNames", "tests/all_tests"
test "--threads:on -d:noIntrinsicsBitOpts -d:noIntrinsicsEndians",
"tests/all_tests"
task testvcc, "Run all tests with vcc compiler":
# Building `test_helper.nim`.
buildHelper("--cc:vcc", "tests/test_helper")
test "--cc:vcc --threads:off", "tests/all_tests"
test "--cc:vcc --threads:on -d:nimTypeNames", "tests/all_tests"
test "--cc:vcc --threads:on -d:noIntrinsicsBitOpts -d:noIntrinsicsEndians",
"tests/all_tests"
build "", "tests/test_helper"
run "--threads:off", "tests/all_tests"
run "--threads:on -d:nimTypeNames", "tests/all_tests"
run "--threads:on -d:noIntrinsicsBitOpts -d:noIntrinsicsEndians",
"tests/all_tests"