Migrate to nimble lock files

- changed the CI to use prebuild nimble binary and to use lock file.
- the nim version is determined by the lock file
- there were some packages that have version range but at the same time
corresponding versions were not tagged at the repo. I have hardcoded the version
of the package commit. Later when the version is tagged in the source repo the
version range can be returned.
This commit is contained in:
Ivan Yonchovski 2023-07-09 14:27:41 +03:00
parent 751e93587a
commit 877b8d8b45
6 changed files with 226 additions and 182 deletions

View File

@ -0,0 +1,42 @@
name: Install Nimble
description: install nimble
inputs:
nimble_version:
description: "install nimble"
# TODO: make sure to change to tagged release when available
default: "latest"
os:
description: "operating system"
default: "linux"
cpu:
description: "cpu architecture"
default: "amd64"
runs:
using: "composite"
steps:
- uses: actions/checkout@v3
- name: Build Nimble
shell: bash
run: |
set -x
mkdir -p .nimble
cd .nimble
if [[ '${{ inputs.cpu }}' == 'amd64' ]]; then
CPU=x64
elif [[ '${{ inputs.cpu }}' == 'i386' ]]; then
CPU=x32
else
CPU=${{ inputs.cpu }}
fi
if [[ '${{ inputs.os }}' == 'macos' ]]; then
OS=apple
else
OS='${{ inputs.os }}'
fi
URL=https://github.com/nim-lang/nimble/releases/download/${{ inputs.nimble_version }}/nimble-"$OS"_"$CPU".tar.gz
curl -o nimble.tar.gz -L -s -S "$URL"
tar -xvf nimble.tar.gz
- name: Derive environment variables
shell: bash
run: echo '${{ github.workspace }}/.nimble/' >> $GITHUB_PATH

View File

@ -23,7 +23,7 @@ jobs:
cpu: amd64
#- os: windows
#cpu: i386
branch: [version-1-2, version-1-6]
branch: [version-1-6]
include:
- target:
os: linux
@ -142,13 +142,20 @@ jobs:
echo "ncpu=$ncpu" >> $GITHUB_ENV
echo "MAKE_CMD=${MAKE_CMD}" >> $GITHUB_ENV
- name: Build Nim and Nimble
run: |
curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh
env MAKE="${MAKE_CMD} -j${ncpu}" 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: Restore nimble dependencies from cache
id: nimble_deps
uses: actions/cache@v3
with:
path: |
~/.nimble/pkgs2
~/.nimble/packages_official.json
key: ${{ inputs.os }}-${{ inputs.cpu }}-${{ env.cache_nonce }}
- name: Setup Nimble
uses: "./.github/actions/install_nimble"
with:
os: ${{ matrix.target.os }}
cpu: ${{ matrix.target.cpu }}
- name: Run tests
run: |
@ -156,12 +163,9 @@ jobs:
# https://github.com/status-im/nimbus-eth2/issues/3121
export NIMFLAGS="-d:nimRawSetjmp"
fi
nim --version
nimble --version
nimble install -y --depsOnly
nimble test
nimble test -y
if [[ "${{ matrix.branch }}" == "version-1-6" || "${{ matrix.branch }}" == "devel" ]]; then
echo -e "\nTesting with '--gc:orc':\n"
export NIMFLAGS="${NIMFLAGS} --gc:orc"
nimble test
nimble test -y
fi;

View File

@ -1,66 +0,0 @@
name: Generate and upload code coverage
on:
#On push to common branches, this computes the "bases stats" for PRs
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
All_Tests:
name: All tests
runs-on: ubuntu-20.04
strategy:
matrix:
nim-options: [
""
]
test-program: [
"test"
]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Environment setup
run: |
sudo apt-get update
sudo apt-get install -y lcov build-essential git curl
mkdir coverage
- name: Install Nim (stable)
run: |
mkdir downloads
cd downloads
curl https://nim-lang.org/choosenim/init.sh -sSf -O
chmod +x init.sh
./init.sh -y
echo 'export NIMBLE_DIR="${HOME}/.nimble"' >> "${HOME}/.bash_env"
echo 'export PATH="${NIMBLE_DIR}/bin:${PATH}"' >> "${HOME}/.bash_env"
cd ..
- name: Run tests
run: |
source "${HOME}/.bash_env"
nimble -y --verbose ${{ matrix.test-program }} --opt:speed -d:debug --verbosity:0 --hints:off --lineDir:on -d:chronicles_log_level=INFO --nimcache:nimcache --passC:-fprofile-arcs --passC:-ftest-coverage --passL:-fprofile-arcs --passL:-ftest-coverage ${{ matrix.nim-options }}
cd nimcache; rm *.c; cd ..
- name: Generate coverage data
run: |
lcov --capture --directory nimcache --output-file coverage/coverage.info
shopt -s globstar
ls $(pwd)/libp2pdht/{*,**/*}.nim
lcov --extract coverage/coverage.info $(pwd)/libp2pdht/{*,**/*}.nim --output-file coverage/coverage.f.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
directory: ./coverage/
fail_ci_if_error: true
files: ./coverage/coverage.f.info
flags: unittests
name: codecov-umbrella
verbose: true

View File

@ -1,5 +1,7 @@
switch("define", "libp2p_pki_schemes=secp256k1")
# begin Nimble config (version 1)
when fileExists("nimble.paths"):
# begin Nimble config (version 2)
--noNimblePath
when withDir(thisDir(), system.fileExists("nimble.paths")):
include "nimble.paths"
# end Nimble config

View File

@ -7,16 +7,17 @@ license = "MIT"
skipDirs = @["tests"]
# TODO: fix versions after tagging the version in the corresponding package
# Dependencies
requires "nim >= 1.2.0",
"nimcrypto >= 0.5.4 & < 0.6.0",
"secp256k1#b3f38e2795e805743b299dc5d96d332db375b520", # >= 0.5.2 & < 0.6.0
"protobufserialization#27b400fdf3bd8ce7120ca66fc1de39d3f1a5804a", # >= 0.2.0 & < 0.3.0
"nimcrypto == 0.5.4",
"bearssl#head",
"chronicles >= 0.10.2 & < 0.11.0",
"chronos >= 3.0.11 & < 3.1.0",
"chronos#1394c9e04957928afc1db33d2e0965cfb677a1e0", # >= 3.0.11 & < 3.1.0
"libp2p#unstable",
"metrics",
"protobufserialization >= 0.2.0 & < 0.3.0",
"secp256k1 >= 0.5.2 & < 0.6.0",
"stew#head",
"stint",
"asynctest >= 0.3.1 & < 0.4.0",
@ -49,7 +50,7 @@ task coverage, "generates code coverage report":
echo " *****************************************************************"
echo ""
exec("nimble --verbose test --opt:speed -d:debug --verbosity:0 --hints:off --lineDir:on -d:chronicles_log_level=INFO --nimcache:nimcache --passC:-fprofile-arcs --passC:-ftest-coverage --passL:-fprofile-arcs --passL:-ftest-coverage")
exec(nimbleExe & " --verbose test --opt:speed -d:debug --verbosity:0 --hints:off --lineDir:on -d:chronicles_log_level=INFO --nimcache:nimcache --passC:-fprofile-arcs --passC:-ftest-coverage --passL:-fprofile-arcs --passL:-ftest-coverage")
exec("cd nimcache; rm *.c; cd ..")
mkDir("coverage")
exec("lcov --capture --directory nimcache --output-file coverage/coverage.info")

View File

@ -1,53 +1,89 @@
{
"version": 1,
"version": 2,
"packages": {
"nim": {
"version": "1.6.14",
"vcsRevision": "71ba2e7f3c5815d956b1ae0341b0743242b8fec6",
"url": "https://github.com/nim-lang/Nim.git",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "f9ce6fa986a4e75514fe26d4c773789b8897eb18"
}
},
"unittest2": {
"version": "0.0.4",
"vcsRevision": "f180f596c88dfd266f746ed6f8dbebce39c824db",
"version": "0.0.2",
"vcsRevision": "02c49b8a994dd3f9eddfaab45262f9b8fa507f8e",
"url": "https://github.com/status-im/nim-unittest2.git",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "fa309c41eaf6ef57895b9e603f2620a2f6e11780"
"sha1": "a7f3331cabb5fad0d04c93be0aad1f020f9c8033"
}
},
"stew": {
"version": "0.1.0",
"vcsRevision": "6ad35b876fb6ebe0dfee0f697af173acc47906ee",
"vcsRevision": "e18f5a62af2ade7a1fd1d39635d4e04d944def08",
"url": "https://github.com/status-im/nim-stew.git",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "46d58c4feb457f3241e3347778334e325dce5268"
}
},
"bearssl": {
"version": "0.1.5",
"vcsRevision": "ba80e2a0d7ae8aab666cee013e38ff8d33a3e5e7",
"url": "https://github.com/status-im/nim-bearssl",
"downloadMethod": "git",
"dependencies": [
"unittest2"
],
"checksums": {
"sha1": "383abd5becc77bf8e365b780a29d20529e1d9c4c"
"sha1": "2a80972f66597bf87d820dca8164d89d3bb24c6d"
}
},
"nimcrypto": {
"version": "0.5.4",
"vcsRevision": "a5742a9a214ac33f91615f3862c7b099aec43b00",
"url": "https://github.com/cheatfate/nimcrypto.git",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "f76c87707cd4e96355b8bb6ef27e7f8b0aac1e08"
}
},
"secp256k1": {
"version": "0.5.2",
"vcsRevision": "5340cf188168d6afcafc8023770d880f067c0b2f",
"url": "https://github.com/status-im/nim-secp256k1.git",
"downloadMethod": "git",
"dependencies": [
"stew",
"nimcrypto"
],
"checksums": {
"sha1": "ae9cbea4487be94a06653ffee075a7f1bd1e231e"
}
},
"bearssl": {
"version": "0.1.5",
"vcsRevision": "f4c4233de453cb7eac0ce3f3ffad6496295f83ab",
"url": "https://github.com/status-im/nim-bearssl.git",
"downloadMethod": "git",
"dependencies": [
"unittest2"
],
"checksums": {
"sha1": "dabf4aaac8969fb10281ebd9ff51875d37eeaaa9"
}
},
"httputils": {
"version": "0.3.0",
"vcsRevision": "689da19e9e9cfff4ced85e2b25c6b2b5598ed079",
"vcsRevision": "e88e231dfcef4585fe3b2fbd9b664dbd28a88040",
"url": "https://github.com/status-im/nim-http-utils.git",
"downloadMethod": "git",
"dependencies": [
"stew"
"stew",
"unittest2"
],
"checksums": {
"sha1": "4ad3ad68d13c50184180ab4b2eacc0bd7ed2ed44"
"sha1": "dd0dcef76616ad35922944671c49222c8a17fb1f"
}
},
"chronos": {
"version": "3.0.11",
"vcsRevision": "17fed89c99beac5a92d3668d0d3e9b0e4ac13936",
"vcsRevision": "6525f4ce1d1a7eba146e5f1a53f6f105077ae686",
"url": "https://github.com/status-im/nim-chronos.git",
"downloadMethod": "git",
"dependencies": [
@ -57,41 +93,31 @@
"unittest2"
],
"checksums": {
"sha1": "f6fffc87571e5f76af2a77c4ebcc0e00909ced4e"
"sha1": "8cdf821ecc76fb91fdfb5191cad31f813822fcb2"
}
},
"metrics": {
"version": "0.0.1",
"vcsRevision": "71e0f0e354e1f4c59e3dc92153989c8b723c3440",
"url": "https://github.com/status-im/nim-metrics",
"vcsRevision": "743f81d4f6c6ebf0ac02389f2392ff8b4235bee5",
"url": "https://github.com/status-im/nim-metrics.git",
"downloadMethod": "git",
"dependencies": [
"chronos"
],
"checksums": {
"sha1": "86da251fe532ef2163da30343688ab1c148c0340"
}
},
"combparser": {
"version": "0.2.0",
"vcsRevision": "ba4464c005d7617c008e2ed2ebc1ba52feb469c6",
"url": "https://github.com/PMunch/combparser",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "a3635260961a893b88f69aac19f1b24e032a7e97"
"sha1": "6274c7ae424b871bc21ca3a6b6713971ff6a8095"
}
},
"testutils": {
"version": "0.4.2",
"vcsRevision": "aa6e5216f4b4ab5aa971cdcdd70e1ec1203cedf2",
"version": "0.5.0",
"vcsRevision": "dfc4c1b39f9ded9baf6365014de2b4bfb4dafc34",
"url": "https://github.com/status-im/nim-testutils",
"downloadMethod": "git",
"dependencies": [
"unittest2"
],
"checksums": {
"sha1": "94427e0cce0e0c5841edcd3a6530b4e6b857a3cb"
"sha1": "756d0757c4dd06a068f9d38c7f238576ba5ee897"
}
},
"faststreams": {
@ -111,7 +137,7 @@
},
"serialization": {
"version": "0.1.0",
"vcsRevision": "fcd0eadadde0ee000a63df8ab21dc4e9f015a790",
"vcsRevision": "493d18b8292fc03aa4f835fd825dea1183f97466",
"url": "https://github.com/status-im/nim-serialization.git",
"downloadMethod": "git",
"dependencies": [
@ -120,12 +146,12 @@
"stew"
],
"checksums": {
"sha1": "fef59519892cac70cccd81b612085caaa5e3e6cf"
"sha1": "893921d41eb4e90a635442f02dd17b5f90bcbb00"
}
},
"json_serialization": {
"version": "0.1.0",
"vcsRevision": "c5f0e2465e8375dfc7aa0f56ccef67cb680bc6b0",
"vcsRevision": "e5b18fb710c3d0167ec79f3b892f5a7a1bc6d1a4",
"url": "https://github.com/status-im/nim-json-serialization.git",
"downloadMethod": "git",
"dependencies": [
@ -133,12 +159,12 @@
"stew"
],
"checksums": {
"sha1": "d89d79d0679a3a41b350e3ad4be56c0308cc5ec6"
"sha1": "bdcdeefca4e2b31710a23cc817aa6abfa0d041e2"
}
},
"chronicles": {
"version": "0.10.2",
"vcsRevision": "1682096306ddba8185dcfac360a8c3f952d721e4",
"version": "0.10.3",
"vcsRevision": "7631f7b2ee03398cb1512a79923264e8f9410af6",
"url": "https://github.com/status-im/nim-chronicles.git",
"downloadMethod": "git",
"dependencies": [
@ -146,27 +172,17 @@
"json_serialization"
],
"checksums": {
"sha1": "9a5bebb76b0f7d587a31e621d260119279e91c76"
"sha1": "2b6795cc40a687d3716b617e70d96e5af361c4af"
}
},
"asynctest": {
"version": "0.3.1",
"vcsRevision": "5347c59b4b057443a014722aa40800cd8bb95c69",
"url": "https://github.com/status-im/asynctest.git",
"dnsclient": {
"version": "0.3.4",
"vcsRevision": "23214235d4784d24aceed99bbfe153379ea557c8",
"url": "https://github.com/ba0f3/dnsclient.nim",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "53e0b610d13700296755a4ebe789882cae47a3b9"
}
},
"nimcrypto": {
"version": "0.5.4",
"vcsRevision": "a5742a9a214ac33f91615f3862c7b099aec43b00",
"url": "https://github.com/cheatfate/nimcrypto",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "f76c87707cd4e96355b8bb6ef27e7f8b0aac1e08"
"sha1": "65262c7e533ff49d6aca5539da4bc6c6ce132f40"
}
},
"zlib": {
@ -183,50 +199,26 @@
},
"websock": {
"version": "0.1.0",
"vcsRevision": "73edde4417f7b45003113b7a34212c3ccd95b9fd",
"url": "https://github.com/status-im/nim-websock",
"vcsRevision": "7b2ed397d6e4c37ea4df08ae82aeac7ff04cd180",
"url": "https://github.com/status-im/nim-websock.git",
"downloadMethod": "git",
"dependencies": [
"chronos",
"httputils",
"chronicles",
"stew",
"asynctest",
"nimcrypto",
"bearssl",
"zlib"
],
"checksums": {
"sha1": "ec2b137543f280298ca48de9ed4461a033ba88d3"
}
},
"dnsclient": {
"version": "0.1.2",
"vcsRevision": "fbb76f8af8a33ab818184a7d4406d9fee20993be",
"url": "https://github.com/ba0f3/dnsclient.nim.git",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "663239a914c814204b30dda6e0902cc0fbd0b8ee"
}
},
"secp256k1": {
"version": "0.5.2",
"vcsRevision": "5340cf188168d6afcafc8023770d880f067c0b2f",
"url": "https://github.com/status-im/nim-secp256k1.git",
"downloadMethod": "git",
"dependencies": [
"stew",
"nimcrypto"
],
"checksums": {
"sha1": "ae9cbea4487be94a06653ffee075a7f1bd1e231e"
"sha1": "d27f126527be59f5a0dc35303cb37b82d4e2770b"
}
},
"libp2p": {
"version": "0.0.2",
"vcsRevision": "c7504d2446717a48a79c8b15e0f21bbfc84957ba",
"url": "https://github.com/status-im/nim-libp2p",
"version": "1.0.0",
"vcsRevision": "a3e9d1ed80c048cd5abc839cbe0863cefcedc702",
"url": "https://github.com/status-im/nim-libp2p.git",
"downloadMethod": "git",
"dependencies": [
"nimcrypto",
@ -240,13 +232,63 @@
"websock"
],
"checksums": {
"sha1": "ba1aed8860c8771ef23ae7600bbfd459d5651a2c"
"sha1": "65e473566f19f7f9a3529745e7181fb58d30b5ef"
}
},
"combparser": {
"version": "0.2.0",
"vcsRevision": "ba4464c005d7617c008e2ed2ebc1ba52feb469c6",
"url": "https://github.com/PMunch/combparser.git",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "a3635260961a893b88f69aac19f1b24e032a7e97"
}
},
"asynctest": {
"version": "0.3.2",
"vcsRevision": "a236a5f0f3031573ac2cb082b63dbf6e170e06e7",
"url": "https://github.com/status-im/asynctest.git",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "0ef50d086659835b0a23a4beb77cb11747695448"
}
},
"questionable": {
"version": "0.10.6",
"vcsRevision": "30e4184a99c8c1ba329925912d2c5d4b09acf8cc",
"url": "https://github.com/status-im/questionable.git",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "ca2d1e2e0be6566b4bf13261b29645721d01673d"
}
},
"upraises": {
"version": "0.1.0",
"vcsRevision": "ff4f8108e44fba9b35cac535ab63d3927e8fd3c2",
"url": "https://github.com/markspanbroek/upraises.git",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "a0243c8039e12d547dbb2e9c73789c16bb8bc956"
}
},
"sqlite3_abi": {
"version": "3.40.1.1",
"vcsRevision": "362e1bd9f689ad9f5380d9d27f0705b3d4dfc7d3",
"url": "https://github.com/arnetheduck/nim-sqlite3-abi",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "8e91db8156a82383d9c48f53b33e48f4e93077b1"
}
},
"protobuf_serialization": {
"version": "0.2.0",
"vcsRevision": "f7d671f877e01213494aac7903421ccdbe70616f",
"url": "https://github.com/status-im/nim-protobuf-serialization.git",
"vcsRevision": "27b400fdf3bd8ce7120ca66fc1de39d3f1a5804a",
"url": "https://github.com/status-im/nim-protobuf-serialization",
"downloadMethod": "git",
"dependencies": [
"stew",
@ -255,13 +297,31 @@
"combparser"
],
"checksums": {
"sha1": "9418459027d0d5eb30a974649dc615a76e8e4aca"
"sha1": "9c30c45b92900b425b147aeceae87bee6295dd80"
}
},
"datastore": {
"version": "0.0.1",
"vcsRevision": "0cde8aeb67c59fd0ac95496dc6b5e1168d6632aa",
"url": "https://github.com/status-im/nim-datastore",
"downloadMethod": "git",
"dependencies": [
"asynctest",
"chronos",
"questionable",
"sqlite3_abi",
"stew",
"unittest2",
"upraises"
],
"checksums": {
"sha1": "2c03bb47de97962d2a64be1ed0a8161cd9d65159"
}
},
"stint": {
"version": "0.0.1",
"vcsRevision": "036c71d06a6b22f8f967ba9d54afd2189c3872ca",
"url": "https://github.com/status-im/stint.git",
"url": "https://github.com/status-im/nim-stint",
"downloadMethod": "git",
"dependencies": [
"stew"
@ -270,5 +330,6 @@
"sha1": "0f187a2115315ca898e5f9a30c5e506cf6057062"
}
}
}
}
},
"tasks": {}
}