update ci/nimble (#40)

* update flag parsing
* fix mac CI
This commit is contained in:
Jacek Sieka 2022-11-19 16:50:01 +01:00 committed by GitHub
parent c7f1a37d9b
commit 8e1d11c799
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 18 deletions

View File

@ -30,7 +30,7 @@ jobs:
shell: bash
- target:
os: macos
builder: macos-10.15
builder: macos-12
shell: bash
- target:
os: windows
@ -43,6 +43,7 @@ jobs:
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch }})'
runs-on: ${{ matrix.builder }}
continue-on-error: ${{ matrix.branch == 'devel' }}
steps:
- name: Checkout
uses: actions/checkout@v2
@ -95,23 +96,23 @@ jobs:
id: windows-dlls-cache
uses: actions/cache@v2
with:
path: external/dlls
key: 'dlls'
path: external/dlls-${{ matrix.target.cpu }}
key: 'dlls-${{ matrix.target.cpu }}'
- name: Install DLL dependencies (Windows)
- name: Install DLLs dependencies (Windows)
if: >
steps.windows-dlls-cache.outputs.cache-hit != 'true' &&
runner.os == 'Windows'
run: |
mkdir external
mkdir -p external
curl -L "https://nim-lang.org/download/windeps.zip" -o external/windeps.zip
7z x external/windeps.zip -oexternal/dlls
7z x -y external/windeps.zip -oexternal/dlls-${{ matrix.target.cpu }}
- name: Path to cached dependencies (Windows)
if: >
runner.os == 'Windows'
run: |
echo '${{ github.workspace }}'"/external/dlls" >> $GITHUB_PATH
echo "${{ github.workspace }}/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH
- name: Derive environment variables
run: |
@ -153,5 +154,5 @@ jobs:
nim --version
nimble --version
nimble install -y --depsOnly
env TEST_LANG="c" nimble test
env TEST_LANG="cpp" nimble test
env NIMLANG=c nimble test
env NIMLANG=cpp nimble test

View File

@ -8,16 +8,28 @@ license = "Apache License 2.0"
skipDirs = @["tests"]
installDirs = @["secp256k1_wrapper"]
requires "nim >= 1.2.0"
requires "stew"
requires "nimcrypto"
requires "nim >= 1.2.0",
"stew",
"nimcrypto"
proc test(args, path: string) =
# style checking can't generate errors, because nimcrypto mixes styles
exec "nim " & getEnv("TEST_LANG", "c") & " " & getEnv("NIMFLAGS") & " " & args &
" -r -f --hints:off --styleCheck:usages --styleCheck:hint --skipParentCfg " & 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"]
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, "Tests":
test "--threads:on", "tests/all_tests"
test "--threads:off", "tests/all_tests"
run "--threads:on", "tests/all_tests"
run "--threads:off", "tests/all_tests"