fix ci for nim 1.6 and devel

- rm -f nimble.lock to allow nim 1.2,1.4,1.6, and devel run test with nimble
- upgrade ubuntu runner to 20.04
- upgrade github actions to v3
This commit is contained in:
jangko 2023-02-08 08:19:55 +07:00
parent f6acc5e3da
commit a1f3b22bbe
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
10 changed files with 186 additions and 101 deletions

View File

@ -30,7 +30,7 @@ jobs:
include: include:
- target: - target:
os: linux os: linux
builder: ubuntu-18.04 builder: ubuntu-20.04
shell: bash shell: bash
- target: - target:
os: macos os: macos
@ -96,7 +96,7 @@ jobs:
- name: Restore Nim DLLs dependencies (Windows) from cache - name: Restore Nim DLLs dependencies (Windows) from cache
if: runner.os == 'Windows' if: runner.os == 'Windows'
id: windows-dlls-cache id: windows-dlls-cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: external/dlls-${{ matrix.target.cpu }} path: external/dlls-${{ matrix.target.cpu }}
key: 'dlls-${{ matrix.target.cpu }}' key: 'dlls-${{ matrix.target.cpu }}'
@ -156,6 +156,14 @@ jobs:
nim --version nim --version
nimble --version nimble --version
nimble install -y --depsOnly nimble install -y --depsOnly
nimble install -y toml_serialization json_serialization nimble install -y toml_serialization json_serialization unittest2
nimble test rm -f nimble.lock
env NIMFLAGS="${NIMFLAGS} --gc:refc" nimble test
let "linux32= "${{ matrix.target.os }}" == "linux" && "${{ matrix.target.cpu }}" == "i386""
if [[ "${{ matrix.branch }}" == "devel" && "$linux32" == 0 ]]; then
echo -e "\nTesting with '--gc:orc':\n"
if env NIMFLAGS="${NIMFLAGS} --gc:orc" nimble test; then
echo "Nim devel with --gc:orc works again! Please remove this check in ci.yml"
false
fi
fi

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ nimcache
nimble.develop nimble.develop
nimble.paths nimble.paths
build/ build/
vendor/

View File

@ -3,12 +3,90 @@
"packages": { "packages": {
"stew": { "stew": {
"version": "0.1.0", "version": "0.1.0",
"vcsRevision": "6ad35b876fb6ebe0dfee0f697af173acc47906ee", "vcsRevision": "cdb1f213d073fd2ecbdaf35a866417657da9294c",
"url": "https://github.com/status-im/nim-stew.git", "url": "https://github.com/status-im/nim-stew",
"downloadMethod": "git", "downloadMethod": "git",
"dependencies": [], "dependencies": [],
"checksums": { "checksums": {
"sha1": "46d58c4feb457f3241e3347778334e325dce5268" "sha1": "3dd9e4ec78d906b59b6f9bcf74f5f8fa6b5c24fe"
}
},
"unittest2": {
"version": "0.0.5",
"vcsRevision": "da8398c45cafd5bd7772da1fc96e3924a18d3823",
"url": "https://github.com/status-im/nim-unittest2",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "b3f8493a4948989ef3e645a38b23aad77e851e26"
}
},
"httputils": {
"version": "0.3.0",
"vcsRevision": "a85bd52ae0a956983ca6b3267c72961d2ec0245f",
"url": "https://github.com/status-im/nim-http-utils",
"downloadMethod": "git",
"dependencies": [
"stew",
"unittest2"
],
"checksums": {
"sha1": "92933b21bcd29335f68e377e2b2193fa331e28b3"
}
},
"bearssl": {
"version": "0.2.0",
"vcsRevision": "acf9645e328bdcab481cfda1c158e07ecd46bd7b",
"url": "https://github.com/status-im/nim-bearssl",
"downloadMethod": "git",
"dependencies": [
"unittest2"
],
"checksums": {
"sha1": "c939aef6a1c17c95131242a6292ade1c92380792"
}
},
"chronos": {
"version": "3.0.11",
"vcsRevision": "8fcbe716b2f069480277aa6781782d3e311ee2c0",
"url": "https://github.com/status-im/nim-chronos",
"downloadMethod": "git",
"dependencies": [
"stew",
"bearssl",
"httputils",
"unittest2"
],
"checksums": {
"sha1": "a9f6c91ea5b2f48dddd8500c9556562185102808"
}
},
"faststreams": {
"version": "0.3.0",
"vcsRevision": "814f8927e1f356f39219f37f069b83066bcc893a",
"url": "https://github.com/status-im/nim-faststreams",
"downloadMethod": "git",
"dependencies": [
"stew",
"chronos",
"unittest2"
],
"checksums": {
"sha1": "16c69a7b454d803dcf28f6115f42bb47421d9376"
}
},
"serialization": {
"version": "0.1.0",
"vcsRevision": "5b7cea55efeb074daa8abd8146a03a34adb4521a",
"url": "https://github.com/status-im/nim-serialization",
"downloadMethod": "git",
"dependencies": [
"faststreams",
"unittest2",
"stew"
],
"checksums": {
"sha1": "433ee95c167fa9f8a4d6691d5e0e8d6b5d8516a6"
} }
} }
} }

View File

@ -6,7 +6,8 @@
# at your option. This file may not be copied, modified, or distributed except according to those terms. # at your option. This file may not be copied, modified, or distributed except according to those terms.
import import
options, unittest, os, std/[options, os],
unittest2,
stew/byteutils, ../confutils, stew/byteutils, ../confutils,
../confutils/[std/net] ../confutils/[std/net]

View File

@ -1,5 +1,6 @@
import import
unittest, options, std/options,
unittest2,
../confutils/envvar/envvar_serialization, ../confutils/envvar/envvar_serialization,
../confutils/envvar/utils ../confutils/envvar/utils

View File

@ -1,5 +1,5 @@
import import
std/unittest, unittest2,
../confutils, ../confutils,
../confutils/defs ../confutils/defs

View File

@ -6,7 +6,8 @@
# at your option. This file may not be copied, modified, or distributed except according to those terms. # at your option. This file may not be copied, modified, or distributed except according to those terms.
import import
std/[sequtils, unittest], std/[sequtils],
unittest2,
../confutils ../confutils
func testValidValues[T](lo: T = low(T), hi: T = high(T)): bool = func testValidValues[T](lo: T = low(T), hi: T = high(T)): bool =

View File

@ -1,5 +1,5 @@
import import
std/unittest, unittest2,
../confutils, ../confutils,
../confutils/defs ../confutils/defs

View File

@ -1,5 +1,6 @@
import import
std/[strutils, unittest], std/[strutils],
unittest2,
../confutils, ../confutils,
./specialint ./specialint

View File

@ -1,5 +1,6 @@
import import
unittest, options, os, std/[options, os],
unittest2,
../confutils/winreg/winreg_serialization, ../confutils/winreg/winreg_serialization,
../confutils/winreg/utils ../confutils/winreg/utils
@ -19,8 +20,7 @@ template readWrite(key: string, val: typed) =
check ok == true check ok == true
check outVal == val check outVal == val
proc testUtils() = suite "winreg utils test suite":
suite "winreg utils test suite":
readWrite("some number", 123'u32) readWrite("some number", 123'u32)
readWrite("some number 64", 123'u64) readWrite("some number 64", 123'u64)
readWrite("some bytes", @[1.byte, 2.byte]) readWrite("some bytes", @[1.byte, 2.byte])
@ -37,8 +37,29 @@ proc testUtils() =
check hKey == HKCR check hKey == HKCR
check path == commonPath check path == commonPath
proc testEncoder() = type
type ValidIpAddress {.requiresInit.} = object
value: string
TestObject = object
address: Option[ValidIpAddress]
proc readValue(r: var WinregReader, value: var ValidIpAddress) =
r.readValue(value.value)
proc writeValue(w: var WinregWriter, value: ValidIpAddress) =
w.writeValue(value.value)
suite "optional fields test suite":
test "optional field with requiresInit pragma":
var z = TestObject(address: some(ValidIpAddress(value: "1.2.3.4")))
Winreg.saveFile("HKCU" / commonPath, z)
var x = Winreg.loadFile("HKCU" / commonPath, TestObject)
check x.address.isSome
check x.address.get().value == "1.2.3.4"
type
Class = enum Class = enum
Truck Truck
MPV MPV
@ -68,7 +89,7 @@ proc testEncoder() =
antennae: Option[int] antennae: Option[int]
bumper: Option[string] bumper: Option[string]
suite "winreg encoder test suite": suite "winreg encoder test suite":
test "basic encoder and decoder": test "basic encoder and decoder":
let v = Vehicle( let v = Vehicle(
name: "buggy", name: "buggy",
@ -94,30 +115,3 @@ proc testEncoder() =
check x == v check x == v
check x.antennae.isNone check x.antennae.isNone
check x.bumper.get() == "Chromium" check x.bumper.get() == "Chromium"
type
ValidIpAddress {.requiresInit.} = object
value: string
TestObject = object
address: Option[ValidIpAddress]
proc readValue(r: var WinregReader, value: var ValidIpAddress) =
r.readValue(value.value)
proc writeValue(w: var WinregWriter, value: ValidIpAddress) =
w.writeValue(value.value)
proc testOptionalFields() =
suite "optional fields test suite":
test "optional field with requiresInit pragma":
var z = TestObject(address: some(ValidIpAddress(value: "1.2.3.4")))
Winreg.saveFile("HKCU" / commonPath, z)
var x = Winreg.loadFile("HKCU" / commonPath, TestObject)
check x.address.isSome
check x.address.get().value == "1.2.3.4"
testUtils()
testEncoder()
testOptionalFields()