mirror of
https://github.com/status-im/nim-confutils.git
synced 2025-03-02 12:50:31 +00:00
update CI, normalise nimble (#61)
This commit is contained in:
parent
a26bfab7e5
commit
269c17401d
22
.github/workflows/ci.yml
vendored
22
.github/workflows/ci.yml
vendored
@ -6,6 +6,10 @@ on:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency: # Cancel stale PR builds (but not push builds)
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
@ -30,7 +34,7 @@ jobs:
|
||||
shell: bash
|
||||
- target:
|
||||
os: macos
|
||||
builder: macos-10.15
|
||||
builder: macos-12
|
||||
shell: bash
|
||||
- target:
|
||||
os: windows
|
||||
@ -43,10 +47,10 @@ jobs:
|
||||
|
||||
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch }})'
|
||||
runs-on: ${{ matrix.builder }}
|
||||
continue-on-error: ${{ matrix.branch == 'version-1-6' || matrix.branch == 'devel' }}
|
||||
continue-on-error: ${{ matrix.branch == 'devel' }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install build dependencies (Linux i386)
|
||||
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
|
||||
@ -94,23 +98,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: |
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@ nimcache
|
||||
*.exe
|
||||
nimble.develop
|
||||
nimble.paths
|
||||
build/
|
||||
|
@ -8,20 +8,30 @@ description = "Simplified handling of command line options and config files"
|
||||
license = "Apache License 2.0"
|
||||
skipDirs = @["tests"]
|
||||
|
||||
requires "nim >= 1.0.0",
|
||||
requires "nim >= 1.2.0",
|
||||
"stew"
|
||||
|
||||
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 --outdir:build --nimcache:build/nimcache -f"
|
||||
|
||||
proc build(args, path: string) =
|
||||
exec nimc & " " & lang & " " & cfg & " " & flags & " " & args & " " & path
|
||||
|
||||
proc run(args, path: string) =
|
||||
exec "nim " & getEnv("TEST_LANG", "c") & " " & getEnv("NIMFLAGS") & " " & args &
|
||||
" --hints:off --warnings:on --skipParentCfg --skipUserCfg" &
|
||||
" --styleCheck:usages --styleCheck:error " & path
|
||||
build args & " -r", path
|
||||
|
||||
task test, "Run all tests":
|
||||
run("--threads:off -d:release -r", "tests/test_all")
|
||||
run("--threads:on -d:release -r", "tests/test_all")
|
||||
|
||||
run("--threads:off -d:release", "tests/test_duplicates")
|
||||
run("--threads:on -d:release", "tests/test_duplicates")
|
||||
for threads in ["--threads:off", "--threads:on"]:
|
||||
run threads, "tests/test_all"
|
||||
build threads, "tests/test_duplicates"
|
||||
|
||||
#Also iterate over every test in tests/fail, and verify they fail to compile.
|
||||
echo "\r\nTest Fail to Compile:"
|
||||
@ -29,7 +39,7 @@ task test, "Run all tests":
|
||||
if path.split(".")[^1] != "nim":
|
||||
continue
|
||||
|
||||
if gorgeEx("nim c " & path).exitCode != 0:
|
||||
if gorgeEx(nimc & " " & lang & " " & flags & " " & path).exitCode != 0:
|
||||
echo " [OK] ", path.split(DirSep)[^1]
|
||||
else:
|
||||
echo " [FAILED] ", path.split(DirSep)[^1]
|
||||
|
@ -1,12 +1,12 @@
|
||||
import
|
||||
os,
|
||||
stew/byteutils, stew/ranges/ptr_arith
|
||||
stew/byteutils, stew/ptrops
|
||||
|
||||
type
|
||||
SomePrimitives* = SomeInteger | enum | bool | SomeFloat | char
|
||||
|
||||
proc setValue*[T: SomePrimitives](key: string, val: openArray[T]) =
|
||||
os.putEnv(key, byteutils.toHex(makeOpenArray(val[0].unsafeAddr, byte, val.len*sizeof(T))))
|
||||
os.putEnv(key, byteutils.toHex(makeOpenArray(baseAddr val, byte, val.len*sizeof(T))))
|
||||
|
||||
proc setValue*(key: string, val: SomePrimitives) =
|
||||
os.putEnv(key, byteutils.toHex(makeOpenArray(val.unsafeAddr, byte, sizeof(val))))
|
||||
|
Loading…
x
Reference in New Issue
Block a user