using multiple nim version in CI
This commit is contained in:
parent
d2635d0c61
commit
4ef25a2d03
|
@ -8,6 +8,7 @@ jobs:
|
|||
max-parallel: 20
|
||||
matrix:
|
||||
test_lang: [c]
|
||||
branch: [version-1-2, version-1-4, version-1-6, devel]
|
||||
target:
|
||||
- os: linux
|
||||
cpu: amd64
|
||||
|
@ -30,7 +31,7 @@ jobs:
|
|||
os: windows
|
||||
builder: windows-2019
|
||||
|
||||
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ matrix.test_lang }}'
|
||||
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ matrix.test_lang }}-(Nim ${{ matrix.branch }})'
|
||||
runs-on: ${{ matrix.builder }}
|
||||
steps:
|
||||
- name: Checkout nim-graphql
|
||||
|
@ -143,7 +144,9 @@ jobs:
|
|||
else
|
||||
MAKE_CMD="make"
|
||||
fi
|
||||
env MAKE="$MAKE_CMD -j2" ARCH_OVERRIDE=$PLATFORM CC=gcc bash build_nim.sh nim csources dist/nimble NimBinaries
|
||||
env MAKE="$MAKE_CMD -j2" ARCH_OVERRIDE=$PLATFORM NIM_COMMIT=${{ matrix.branch }} \
|
||||
QUICK_AND_DIRTY_COMPILER=1 QUICK_AND_DIRTY_NIMBLE=1 CC=gcc \
|
||||
bash build_nim.sh nim csources dist/nimble NimBinaries
|
||||
echo '${{ github.workspace }}/nim/bin' >> $GITHUB_PATH
|
||||
|
||||
- name: Run nim-graphql tests
|
||||
|
|
|
@ -25,6 +25,15 @@ requires "nim >= 1.2.0",
|
|||
"https://github.com/status-im/nim-unittest2"
|
||||
|
||||
proc test(env, path: string, shouldRun = true) =
|
||||
# nnkArglist was changed to nnkArgList, so can't always use --styleCheck:error
|
||||
# https://github.com/nim-lang/Nim/pull/17529
|
||||
# https://github.com/nim-lang/Nim/pull/19822
|
||||
let styleCheckStyle =
|
||||
if (NimMajor, NimMinor) < (1, 6):
|
||||
"hint"
|
||||
else:
|
||||
"error"
|
||||
|
||||
# Compilation language is controlled by TEST_LANG
|
||||
var lang = "c"
|
||||
if existsEnv"TEST_LANG":
|
||||
|
@ -33,7 +42,8 @@ proc test(env, path: string, shouldRun = true) =
|
|||
let run = if shouldRun: " -r" else: ""
|
||||
|
||||
exec "nim " & lang & " " & env & run &
|
||||
" --styleCheck:usages --styleCheck:error --hints:off --warnings:off " & path
|
||||
" --styleCheck:usages --styleCheck:" & styleCheckStyle &
|
||||
" --hints:off --warnings:off " & path
|
||||
|
||||
task test, "Run all tests":
|
||||
test "--threads:off", "tests/test_all"
|
||||
|
|
|
@ -31,7 +31,7 @@ const
|
|||
Utf16Shift = 10
|
||||
Utf16Base = 0x0010000
|
||||
Utf16Mask = 0x3FF
|
||||
Utf16Maxbmp= 0xFFFF
|
||||
Utf16MaxBmp= 0xFFFF
|
||||
MaxUtf = 0x10FFFF
|
||||
|
||||
DefaultReplacement* = 0xFFFD
|
||||
|
@ -93,7 +93,7 @@ proc utf*(_: type Utf16, c1, c2: int): int =
|
|||
((c1 - highBegin) shl Utf16Shift) + (c2 - lowBegin) + Utf16Base
|
||||
|
||||
proc inc*(_: type Utf16, cp: int, res: var int): bool =
|
||||
if cp <= Utf16Maxbmp:
|
||||
if cp <= Utf16MaxBmp:
|
||||
if cp >= highBegin and cp <= lowBegin:
|
||||
return false
|
||||
else:
|
||||
|
@ -164,19 +164,19 @@ proc utf8Len*(_: type Utf16, text: openArray[uint16]): Result[int, string] =
|
|||
if c1 >= highBegin and c1 <= highEnd:
|
||||
inc i
|
||||
if i >= text.len:
|
||||
return err(InvalidUtf16)
|
||||
return err(InvalidUTF16)
|
||||
# surrogate pairs
|
||||
let c2 = text[i]
|
||||
if c2 < lowBegin or c2 > lowEnd:
|
||||
return err(InvalidUtf16)
|
||||
return err(InvalidUTF16)
|
||||
let cp = Utf16.utf(c1, c2)
|
||||
if not Utf8.inc(cp, res):
|
||||
return err(InvalidUtf16)
|
||||
return err(InvalidUTF16)
|
||||
elif c1 >= lowBegin and c1 <= lowEnd:
|
||||
return err(InvalidUtf16)
|
||||
return err(InvalidUTF16)
|
||||
inc i
|
||||
if not Utf8.inc(c1, res):
|
||||
return err(InvalidUtf16)
|
||||
return err(InvalidUTF16)
|
||||
|
||||
ok(res)
|
||||
|
||||
|
@ -237,7 +237,7 @@ proc append*(_: type Utf8, text: var (string | seq[byte]), c1, c2: int): bool =
|
|||
Utf8.append(text, Utf16.utf(c1, c2))
|
||||
|
||||
proc append*(_: type Utf16, text: var seq[uint16], cp: int): bool =
|
||||
if cp <= Utf16Maxbmp:
|
||||
if cp <= Utf16MaxBmp:
|
||||
if cp >= highBegin and cp <= lowBegin:
|
||||
return false
|
||||
else:
|
||||
|
@ -318,7 +318,7 @@ type
|
|||
lo*: uint16
|
||||
|
||||
proc toPair*(_: type Utf16, cp: int): Utf16Pair =
|
||||
if cp <= Utf16Maxbmp:
|
||||
if cp <= Utf16MaxBmp:
|
||||
if cp >= highBegin and cp <= lowBegin:
|
||||
Utf16Pair(state: Utf16Error)
|
||||
else:
|
||||
|
|
|
@ -114,7 +114,8 @@ proc runSuite(ctx: GraphqlRef, savePoint: NameCounter, fileName: string, counter
|
|||
let parts = splitFile(fileName)
|
||||
let cases = Toml.loadFile(fileName, TestCase)
|
||||
suite parts.name:
|
||||
for unit in cases.units:
|
||||
for x in cases.units:
|
||||
let unit = x # prevent nim >= 1.6 cannot capture lent
|
||||
test unit.name:
|
||||
if unit.skip:
|
||||
ctx.purgeQueries(true)
|
||||
|
|
|
@ -116,7 +116,8 @@ proc runSuite(client: GraphqlHttpClientRef, fileName: string, counter: Counter)
|
|||
let parts = splitFile(fileName)
|
||||
let cases = Toml.loadFile(fileName, TestCase)
|
||||
suite parts.name:
|
||||
for unit in cases.units:
|
||||
for x in cases.units:
|
||||
let unit = x # prevent nim >= 1.6 cannot capture lent
|
||||
test unit.name:
|
||||
if unit.skip:
|
||||
skip()
|
||||
|
@ -211,7 +212,8 @@ when isMainModule:
|
|||
let cases = Toml.loadFile(fileName, TestCase)
|
||||
let server = createServer(serverAddress)
|
||||
server.start()
|
||||
for unit in cases.units:
|
||||
for x in cases.units:
|
||||
let unit = x # prevent nim >= 1.6 cannot capture lent
|
||||
if unit.name != conf.unit:
|
||||
continue
|
||||
test unit.name:
|
||||
|
|
|
@ -85,7 +85,8 @@ proc suite3() =
|
|||
for fileName in walkDirRec("tests" / "schemas"):
|
||||
fileNames.add fileName
|
||||
|
||||
for fileName in fileNames:
|
||||
for x in fileNames:
|
||||
let fileName = x # prevent nim >= 1.6 cannot capture lent
|
||||
test fileName:
|
||||
check runGoodDoc(fileName) == true
|
||||
|
||||
|
|
|
@ -57,7 +57,8 @@ proc main() =
|
|||
continue
|
||||
fileNames.add fileName
|
||||
|
||||
for fileName in fileNames:
|
||||
for x in fileNames:
|
||||
let fileName = x # prevent nim >= 1.6 cannot capture lent
|
||||
let parts = splitFile(fileName)
|
||||
test parts.name:
|
||||
ctx.runValidator(fileName, testStatusIMPL)
|
||||
|
|
|
@ -144,7 +144,8 @@ proc runSuite(ctx: GraphqlRef, savePoint: NameCounter, fileName: string, counter
|
|||
let parts = splitFile(fileName)
|
||||
let cases = Toml.loadFile(fileName, TestCase)
|
||||
suite parts.name:
|
||||
for unit in cases.units:
|
||||
for x in cases.units:
|
||||
let unit = x # prevent nim >= 1.6 cannot capture lent
|
||||
test unit.name:
|
||||
if unit.skip:
|
||||
skip()
|
||||
|
|
Loading…
Reference in New Issue