diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cde3a21..019f995 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: @@ -46,7 +50,7 @@ jobs: 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' @@ -68,13 +72,6 @@ jobs: chmod 755 external/bin/gcc external/bin/g++ echo '${{ github.workspace }}/external/bin' >> $GITHUB_PATH - - name: 'Install dependencies (macOS)' - if: runner.os == 'macOS' && matrix.branch == 'devel' - run: | - brew install openssl@1.1 - ln -s $(brew --prefix)/opt/openssl/lib/libcrypto.1.1.dylib /usr/local/lib - ln -s $(brew --prefix)/opt/openssl/lib/libssl.1.1.dylib /usr/local/lib/ - - name: MSYS2 (Windows i386) if: runner.os == 'Windows' && matrix.target.cpu == 'i386' uses: msys2/setup-msys2@v2 @@ -117,7 +114,7 @@ jobs: if: > runner.os == 'Windows' run: | - echo '${{ github.workspace }}'"/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH + echo "${{ github.workspace }}/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH - name: Derive environment variables run: | diff --git a/.gitignore b/.gitignore index f2e7e9b..db41c85 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -nimcache +nimcache/ *.exe nimble.develop nimble.paths +/build/ diff --git a/chronos.nimble b/chronos.nimble index 7362438..639d1d3 100644 --- a/chronos.nimble +++ b/chronos.nimble @@ -1,45 +1,47 @@ +mode = ScriptMode.Verbose + packageName = "chronos" version = "3.0.11" author = "Status Research & Development GmbH" -description = "Chronos" -license = "Apache License 2.0 or MIT" +description = "Networking framework with async/await support" +license = "MIT or Apache License 2.0" skipDirs = @["tests"] -### Dependencies - -requires "nim > 1.2.0", +requires "nim >= 1.2.0", "stew", "bearssl", "httputils", "unittest2" -var commandStart = "nim c -r --hints:off --verbosity:0 --skipParentCfg:on --warning[ObservableStores]:off --styleCheck:usages --styleCheck:error" +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": - var commands = @[ - commandStart & " -d:useSysAssert -d:useGcAssert tests/", - commandStart & " -d:chronosStackTrace -d:chronosStrictException tests/", - commandStart & " -d:release tests/", - commandStart & " -d:release -d:chronosFutureTracking tests/", - ] - when (NimMajor, NimMinor) >= (1, 5): - commands.add commandStart & " --gc:orc -d:chronosFutureTracking -d:release -d:chronosStackTrace tests/" - - for testname in ["testall"]: - for cmd in commands: - let curcmd = cmd & testname - echo "\n" & curcmd - exec curcmd - rmFile "tests/" & testname + for args in [ + "-d:useSysAssert -d:useGcAssert", + "-d:chronosStackTrace -d:chronosStrictException", + "-d:release", + "-d:release -d:chronosFutureTracking", + ]: run args, "tests/testall" task test_libbacktrace, "test with libbacktrace": - var commands = @[ - commandStart & " -d:release --debugger:native -d:chronosStackTrace -d:nimStackTraceOverride --import:libbacktrace tests/", + var allArgs = @[ + "-d:release --debugger:native -d:chronosStackTrace -d:nimStackTraceOverride --import:libbacktrace", ] - for testname in ["testall"]: - for cmd in commands: - let curcmd = cmd & testname - echo "\n" & curcmd - exec curcmd - rmFile "tests/" & testname + for args in allArgs: + run args, "tests/testall"