mirror of
https://github.com/status-im/nim-taskpools.git
synced 2025-02-27 13:10:33 +00:00
normalise nimble (#25)
* normalise nimble * bump version too * better ci cancell
This commit is contained in:
parent
74ae5a71fa
commit
b3673c7a7a
34
.github/workflows/ci.yml
vendored
34
.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,17 +47,12 @@ 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: Cancel Previous Runs
|
||||
uses: styfle/cancel-workflow-action@0.5.0
|
||||
with:
|
||||
access_token: ${{ github.token }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies (Linux i386)
|
||||
- name: Install build dependencies (Linux i386)
|
||||
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
|
||||
run: |
|
||||
sudo dpkg --add-architecture i386
|
||||
@ -99,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: |
|
||||
@ -154,5 +153,8 @@ jobs:
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
env TEST_LANG=c nimble test
|
||||
env TEST_LANG=cpp nimble test
|
||||
nim --version
|
||||
nimble --version
|
||||
nimble install -y --depsOnly
|
||||
env NIMLANG=c nimble test
|
||||
env NIMLANG=cpp nimble test
|
||||
|
@ -1,49 +1,50 @@
|
||||
mode = ScriptMode.Verbose
|
||||
|
||||
packageName = "taskpools"
|
||||
version = "0.0.3"
|
||||
version = "0.0.4"
|
||||
author = "Status Research & Development GmbH"
|
||||
description = "lightweight, energy-efficient, easily auditable threadpool"
|
||||
license = "MIT"
|
||||
skipDirs = @["tests"]
|
||||
|
||||
### Dependencies
|
||||
requires "nim >= 1.2.12"
|
||||
|
||||
proc test(flags, path: string) =
|
||||
if not dirExists "build":
|
||||
mkDir "build"
|
||||
# Note: we compile in release mode. This still have stacktraces
|
||||
# but is much faster than -d:debug
|
||||
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"]
|
||||
|
||||
# Compilation language is controlled by TEST_LANG
|
||||
let lang = getEnv("TEST_LANG", "c")
|
||||
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" &
|
||||
" --stacktrace:on --linetrace:on" &
|
||||
" --threads:on"
|
||||
|
||||
echo "\n========================================================================================"
|
||||
echo "Running [ ", lang, " ", flags, " ] ", path
|
||||
echo "========================================================================================"
|
||||
exec "nim " & lang & " -d:TP_Asserts " & getEnv("NIMFLAGS") & " " & flags &
|
||||
" --verbosity:0 --warnings:off --threads:on -d:release" &
|
||||
" --stacktrace:on --linetrace:on --outdir:build -r --skipParentCfg --skipUserCfg" &
|
||||
" --styleCheck:usages --styleCheck:hint" &
|
||||
" --hint[XDeclaredButNotUsed]:off --hint[Processing]:off " & path
|
||||
proc build(args, path: string) =
|
||||
exec nimc & " " & lang & " " & cfg & " " & flags & " " & args & " " & path
|
||||
|
||||
proc run(args, path: string) =
|
||||
build args & " -r", path
|
||||
|
||||
task test, "Run Taskpools tests":
|
||||
# Internal data structures
|
||||
test "", "taskpools/channels_spsc_single.nim"
|
||||
test "", "taskpools/sparsesets.nim"
|
||||
run "", "taskpools/channels_spsc_single.nim"
|
||||
run "", "taskpools/sparsesets.nim"
|
||||
|
||||
# Examples
|
||||
test "", "examples/e01_simple_tasks.nim"
|
||||
test "", "examples/e02_parallel_pi.nim"
|
||||
run "", "examples/e01_simple_tasks.nim"
|
||||
run "", "examples/e02_parallel_pi.nim"
|
||||
|
||||
# Benchmarks
|
||||
test "", "benchmarks/dfs/taskpool_dfs.nim"
|
||||
test "", "benchmarks/heat/taskpool_heat.nim"
|
||||
test "", "benchmarks/nqueens/taskpool_nqueens.nim"
|
||||
run "", "benchmarks/dfs/taskpool_dfs.nim"
|
||||
run "", "benchmarks/heat/taskpool_heat.nim"
|
||||
run "", "benchmarks/nqueens/taskpool_nqueens.nim"
|
||||
|
||||
when not defined(windows):
|
||||
test "", "benchmarks/single_task_producer/taskpool_spc.nim"
|
||||
test "", "benchmarks/bouncing_producer_consumer/taskpool_bpc.nim"
|
||||
run "", "benchmarks/single_task_producer/taskpool_spc.nim"
|
||||
run "", "benchmarks/bouncing_producer_consumer/taskpool_bpc.nim"
|
||||
|
||||
# TODO - generics in macro issue
|
||||
# test "", "benchmarks/matmul_cache_oblivious/taskpool_matmul_co.nim"
|
||||
# run "", "benchmarks/matmul_cache_oblivious/taskpool_matmul_co.nim"
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
import
|
||||
system/ansi_c,
|
||||
std/[locks, typetraits, atomics],
|
||||
std/atomics,
|
||||
./instrumentation/[contracts, loggers],
|
||||
./primitives/allocs
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
import
|
||||
system/ansi_c,
|
||||
std/os,
|
||||
./instrumentation/contracts,
|
||||
./channels_spsc_single,
|
||||
|
Loading…
x
Reference in New Issue
Block a user