Normalise nimble (#36)
* normalise nimble file, ci / deprecation fixes * other deprecations
This commit is contained in:
parent
6112432b3a
commit
5ec974ed1a
8 changed files with 42 additions and 48 deletions
24
.github/workflows/ci.yml
vendored
24
.github/workflows/ci.yml
vendored
|
|
@ -6,6 +6,10 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
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:
|
jobs:
|
||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
|
|
@ -43,10 +47,10 @@ jobs:
|
||||||
|
|
||||||
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch }})'
|
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch }})'
|
||||||
runs-on: ${{ matrix.builder }}
|
runs-on: ${{ matrix.builder }}
|
||||||
continue-on-error: ${{ matrix.branch == 'version-1-6' || matrix.branch == 'devel' }}
|
continue-on-error: ${{ matrix.branch == 'devel' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install build dependencies (Linux i386)
|
- name: Install build dependencies (Linux i386)
|
||||||
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
|
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
|
||||||
|
|
@ -94,23 +98,23 @@ jobs:
|
||||||
id: windows-dlls-cache
|
id: windows-dlls-cache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: external/dlls
|
path: external/dlls-${{ matrix.target.cpu }}
|
||||||
key: 'dlls'
|
key: 'dlls-${{ matrix.target.cpu }}'
|
||||||
|
|
||||||
- name: Install DLL dependencies (Windows)
|
- name: Install DLLs dependencies (Windows)
|
||||||
if: >
|
if: >
|
||||||
steps.windows-dlls-cache.outputs.cache-hit != 'true' &&
|
steps.windows-dlls-cache.outputs.cache-hit != 'true' &&
|
||||||
runner.os == 'Windows'
|
runner.os == 'Windows'
|
||||||
run: |
|
run: |
|
||||||
mkdir external
|
mkdir -p external
|
||||||
curl -L "https://nim-lang.org/download/windeps.zip" -o external/windeps.zip
|
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)
|
- name: Path to cached dependencies (Windows)
|
||||||
if: >
|
if: >
|
||||||
runner.os == 'Windows'
|
runner.os == 'Windows'
|
||||||
run: |
|
run: |
|
||||||
echo '${{ github.workspace }}'"/external/dlls" >> $GITHUB_PATH
|
echo "${{ github.workspace }}/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Derive environment variables
|
- name: Derive environment variables
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -152,5 +156,5 @@ jobs:
|
||||||
nim --version
|
nim --version
|
||||||
nimble --version
|
nimble --version
|
||||||
nimble install -y --depsOnly
|
nimble install -y --depsOnly
|
||||||
env TEST_LANG="c" nimble test
|
env NIMLANG=c nimble test
|
||||||
env TEST_LANG="cpp" nimble test
|
env NIMLANG=cpp nimble test
|
||||||
|
|
|
||||||
|
|
@ -12,37 +12,27 @@ requires "nim >= 1.2.0",
|
||||||
"chronos",
|
"chronos",
|
||||||
"unittest2"
|
"unittest2"
|
||||||
|
|
||||||
### Helper functions
|
let nimc = getEnv("NIMC", "nim") # Which nim compiler to use
|
||||||
proc test(args, path: string) =
|
let lang = getEnv("NIMLANG", "c") # Which backend (c/cpp/js)
|
||||||
# Compilation language is controlled by TEST_LANG
|
let flags = getEnv("NIMFLAGS", "") # Extra flags for the compiler
|
||||||
let lang = getEnv("TEST_LANG", "c")
|
let verbose = getEnv("V", "") notin ["", "0"]
|
||||||
|
|
||||||
# nnkArglist was changed to nnkArgList, so can't always use --styleCheck:error
|
let styleCheckStyle = if (NimMajor, NimMinor) < (1, 6): "hint" else: "error"
|
||||||
# https://github.com/nim-lang/Nim/pull/17529
|
let cfg =
|
||||||
# https://github.com/nim-lang/Nim/pull/19822
|
" --styleCheck:usages --styleCheck:" & styleCheckStyle &
|
||||||
let styleCheckStyle =
|
(if verbose: "" else: " --verbosity:0 --hints:off") &
|
||||||
if (NimMajor, NimMinor) < (1, 6):
|
" --skipParentCfg --skipUserCfg --outdir:build --nimcache:build/nimcache -f"
|
||||||
"hint"
|
|
||||||
else:
|
|
||||||
"error"
|
|
||||||
|
|
||||||
var common_args = "-r -f " & getEnv("NIMFLAGS") & " --hints:off --styleCheck:usages --styleCheck:" & styleCheckStyle
|
proc build(args, path: string) =
|
||||||
|
exec nimc & " " & lang & " " & cfg & " " & flags & " " & args & " " & path
|
||||||
|
|
||||||
if getEnv("NIMBUS_ENV_DIR") != "":
|
proc run(args, path: string) =
|
||||||
common_args &= " --skipParentCfg"
|
build args & " -r", path
|
||||||
|
|
||||||
exec "nim " & lang & " " & args &
|
|
||||||
" -d:asyncBackend=none " & common_args & " " & path
|
|
||||||
exec "nim " & lang & " " & args &
|
|
||||||
" -d:asyncBackend=chronos " & common_args & " " & path
|
|
||||||
# TODO std backend is broken / untested
|
|
||||||
# exec "nim " & lang & " " & args &
|
|
||||||
# " -d:asyncBackend=asyncdispatch " & common_args & " " & path
|
|
||||||
|
|
||||||
task test, "Run all tests":
|
task test, "Run all tests":
|
||||||
test "-d:debug --threads:off", "tests/all_tests"
|
# TODO asyncdispatch backend is broken / untested
|
||||||
test "-d:release --threads:off", "tests/all_tests"
|
for backend in ["-d:asyncBackend=none", "-d:asyncBackend=chronos"]:
|
||||||
test "-d:danger --threads:off", "tests/all_tests"
|
for threads in ["--threads:off", "--threads:on"]:
|
||||||
test "-d:debug --threads:on", "tests/all_tests"
|
for mode in ["-d:debug", "-d:release", "-d:danger"]:
|
||||||
test "-d:release --threads:on", "tests/all_tests"
|
run backend & " " & threads & " " & mode, "tests/all_tests"
|
||||||
test "-d:danger --threads:on", "tests/all_tests"
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import
|
import
|
||||||
deques,
|
deques,
|
||||||
stew/[ptrops, ranges/ptr_arith],
|
stew/ptrops,
|
||||||
async_backend
|
async_backend
|
||||||
|
|
||||||
export
|
export
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import
|
import
|
||||||
os, memfiles, options,
|
os, memfiles, options,
|
||||||
stew/[ptrops, ranges/ptr_arith],
|
stew/[ptrops],
|
||||||
async_backend, buffers
|
async_backend, buffers
|
||||||
|
|
||||||
export
|
export
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import
|
import
|
||||||
deques, typetraits,
|
deques, typetraits,
|
||||||
stew/[ptrops, strings, ranges/ptr_arith],
|
stew/[ptrops, strings],
|
||||||
buffers, async_backend
|
buffers, async_backend
|
||||||
|
|
||||||
export
|
export
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ const
|
||||||
NewLines* = {'\r', '\n'}
|
NewLines* = {'\r', '\n'}
|
||||||
Digits* = {'0'..'9'}
|
Digits* = {'0'..'9'}
|
||||||
|
|
||||||
proc readLine*(s: InputStream, keepEol = false): TaintedString {.fsMultiSync.} =
|
proc readLine*(s: InputStream, keepEol = false): string {.fsMultiSync.} =
|
||||||
fsAssert readableNow(s)
|
fsAssert readableNow(s)
|
||||||
|
|
||||||
while s.readable:
|
while s.readable:
|
||||||
|
|
@ -145,7 +145,7 @@ proc readLine*(s: InputStream, keepEol = false): TaintedString {.fsMultiSync.} =
|
||||||
result.add s.read.char
|
result.add s.read.char
|
||||||
|
|
||||||
proc readUntil*(s: InputStream,
|
proc readUntil*(s: InputStream,
|
||||||
sep: openArray[char]): Option[TaintedString] =
|
sep: openArray[char]): Option[string] =
|
||||||
fsAssert readableNow(s)
|
fsAssert readableNow(s)
|
||||||
var res = ""
|
var res = ""
|
||||||
while s.readable(sep.len):
|
while s.readable(sep.len):
|
||||||
|
|
@ -153,14 +153,14 @@ proc readUntil*(s: InputStream,
|
||||||
return some(res)
|
return some(res)
|
||||||
res.add s.read.char
|
res.add s.read.char
|
||||||
|
|
||||||
template nextLine*(sp: InputStream, keepEol = false): Option[TaintedString] =
|
template nextLine*(sp: InputStream, keepEol = false): Option[string] =
|
||||||
let s = sp
|
let s = sp
|
||||||
if s.readable:
|
if s.readable:
|
||||||
some readLine(s, keepEol)
|
some readLine(s, keepEol)
|
||||||
else:
|
else:
|
||||||
none string
|
none string
|
||||||
|
|
||||||
iterator lines*(s: InputStream, keepEol = false): TaintedString =
|
iterator lines*(s: InputStream, keepEol = false): string =
|
||||||
while s.readable:
|
while s.readable:
|
||||||
yield readLine(s, keepEol)
|
yield readLine(s, keepEol)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import
|
||||||
os, unittest2, strutils, random,
|
os, unittest2, strutils, random,
|
||||||
../faststreams, ../faststreams/textio
|
../faststreams, ../faststreams/textio
|
||||||
|
|
||||||
setCurrentDir getAppDir()
|
setCurrentDir currentSourcePath.parentDir
|
||||||
|
|
||||||
proc str(bytes: openArray[byte]): string =
|
proc str(bytes: openArray[byte]): string =
|
||||||
result = newStringOfCap(bytes.len)
|
result = newStringOfCap(bytes.len)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import
|
import
|
||||||
os, unittest2, random, strformat,
|
os, unittest2, random, strformat,
|
||||||
stew/ranges/ptr_arith,
|
stew/ptrops,
|
||||||
../faststreams, ../faststreams/textio
|
../faststreams, ../faststreams/textio
|
||||||
|
|
||||||
proc bytes(s: string): seq[byte] =
|
proc bytes(s: string): seq[byte] =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue