From 508c777332d9ba0633a21c60e032b543def9a44a Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Wed, 23 Nov 2022 16:23:20 +0100 Subject: [PATCH 1/2] normalise nimble --- .github/workflows/ci.yml | 22 +++++++++++++--------- serialization.nimble | 22 +++++++++++++++++++--- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04f05ed..2bf2025 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: | diff --git a/serialization.nimble b/serialization.nimble index 69f91bf..3924c64 100644 --- a/serialization.nimble +++ b/serialization.nimble @@ -12,7 +12,23 @@ requires "nim >= 1.2.0", "unittest2", "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) = + build args & " -r", path + task test, "Run all tests": - let common_args = "c -r -f --hints:off --skipParentCfg --styleCheck:usages --styleCheck:error " & getEnv("NIMFLAGS") - exec "nim " & common_args & " --threads:off tests/test_all" - exec "nim " & common_args & " --threads:on tests/test_all" + for threads in ["--threads:off", "--threads:on"]: + run threads, "tests/test_all" From b5e3f8251913a5928ed96e59b4e399f73bfbad96 Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Wed, 23 Nov 2022 16:30:49 +0100 Subject: [PATCH 2/2] ignore build --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 35e10c2..1e2eebd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ nimcache/ tests/test_all nimble.develop nimble.paths +build/