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
@ -110,7 +111,7 @@ proc testOptionalFields() =
var x = Envvar.loadFile(commonPrefix, TestObject) var x = Envvar.loadFile(commonPrefix, TestObject)
check x.address.isSome check x.address.isSome
check x.address.get().value == "1.2.3.4" check x.address.get().value == "1.2.3.4"
testUtils() testUtils()
testEncoder() testEncoder()
testOptionalFields() testOptionalFields()

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,81 +20,22 @@ 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]) readWrite("some int list", @[4,5,6])
readWrite("some int list", @[4,5,6]) readWrite("some array", [1.byte, 2.byte, 4.byte])
readWrite("some array", [1.byte, 2.byte, 4.byte]) readWrite("some string", "hello world")
readWrite("some string", "hello world") readWrite("some enum", Apple)
readWrite("some enum", Apple) readWrite("some boolean", true)
readWrite("some boolean", true) readWrite("some float32", 1.234'f32)
readWrite("some float32", 1.234'f32) readWrite("some float64", 1.234'f64)
readWrite("some float64", 1.234'f64)
test "parse winregpath": test "parse winregpath":
let (hKey, path) = parseWinregPath("HKEY_CLASSES_ROOT\\" & commonPath) let (hKey, path) = parseWinregPath("HKEY_CLASSES_ROOT\\" & commonPath)
check hKey == HKCR check hKey == HKCR
check path == commonPath check path == commonPath
proc testEncoder() =
type
Class = enum
Truck
MPV
SUV
Fuel = enum
Gasoline
Diesel
Engine = object
cylinder: int
valve: int16
fuel: Fuel
Suspension = object
dist: int
length: int
Vehicle = object
name: string
color: int
class: Class
engine: Engine
wheel: int
suspension: array[3, Suspension]
door: array[4, int]
antennae: Option[int]
bumper: Option[string]
suite "winreg encoder test suite":
test "basic encoder and decoder":
let v = Vehicle(
name: "buggy",
color: 213,
class: MPV,
engine: Engine(
cylinder: 3,
valve: 2,
fuel: Diesel
),
wheel: 6,
door: [1,2,3,4],
suspension: [
Suspension(dist: 1, length: 5),
Suspension(dist: 2, length: 6),
Suspension(dist: 3, length: 7)
],
bumper: some("Chromium")
)
Winreg.encode(HKCU, commonPath, v)
let x = Winreg.decode(HKCU, commonPath, Vehicle)
check x == v
check x.antennae.isNone
check x.bumper.get() == "Chromium"
type type
ValidIpAddress {.requiresInit.} = object ValidIpAddress {.requiresInit.} = object
@ -108,16 +50,68 @@ proc readValue(r: var WinregReader, value: var ValidIpAddress) =
proc writeValue(w: var WinregWriter, value: ValidIpAddress) = proc writeValue(w: var WinregWriter, value: ValidIpAddress) =
w.writeValue(value.value) w.writeValue(value.value)
proc testOptionalFields() = suite "optional fields test suite":
suite "optional fields test suite": test "optional field with requiresInit pragma":
test "optional field with requiresInit pragma":
var z = TestObject(address: some(ValidIpAddress(value: "1.2.3.4"))) var z = TestObject(address: some(ValidIpAddress(value: "1.2.3.4")))
Winreg.saveFile("HKCU" / commonPath, z) Winreg.saveFile("HKCU" / commonPath, z)
var x = Winreg.loadFile("HKCU" / commonPath, TestObject) var x = Winreg.loadFile("HKCU" / commonPath, TestObject)
check x.address.isSome check x.address.isSome
check x.address.get().value == "1.2.3.4" check x.address.get().value == "1.2.3.4"
testUtils() type
testEncoder() Class = enum
testOptionalFields() Truck
MPV
SUV
Fuel = enum
Gasoline
Diesel
Engine = object
cylinder: int
valve: int16
fuel: Fuel
Suspension = object
dist: int
length: int
Vehicle = object
name: string
color: int
class: Class
engine: Engine
wheel: int
suspension: array[3, Suspension]
door: array[4, int]
antennae: Option[int]
bumper: Option[string]
suite "winreg encoder test suite":
test "basic encoder and decoder":
let v = Vehicle(
name: "buggy",
color: 213,
class: MPV,
engine: Engine(
cylinder: 3,
valve: 2,
fuel: Diesel
),
wheel: 6,
door: [1,2,3,4],
suspension: [
Suspension(dist: 1, length: 5),
Suspension(dist: 2, length: 6),
Suspension(dist: 3, length: 7)
],
bumper: some("Chromium")
)
Winreg.encode(HKCU, commonPath, v)
let x = Winreg.decode(HKCU, commonPath, Vehicle)
check x == v
check x.antennae.isNone
check x.bumper.get() == "Chromium"