Skip to content

Commit

Permalink
Initial support for nimble lock files
Browse files Browse the repository at this point in the history
- Add parallel ci-lock.yml
- In order to sync the lock file do the following:

``` bash
nimble lock --developFile=nimble-update-lock.develop
```

Note that --developFile support for lock is part of  this PR
nim-lang/nimble#1125 to be merged. If it is not merged,
then you can rename nimble-update-lock.develop to nimble.develop and `nimble
lock` will work just fine.

- I have used different `nim` version for the lock file because current `nim`
does not have the proper nimble structure. I can bump the version in NBS if you
want. I have also changed the versions of some of the packages in `vendor`
folder to pass nimble version checks
  • Loading branch information
yyoncho committed Jul 21, 2023
1 parent 3bb5960 commit 88838ba
Show file tree
Hide file tree
Showing 9 changed files with 458 additions and 218 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/ci-lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: CI Lock
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
env:
cache_nonce: 0 # Allows for easily busting actions/cache caches
nim_version: v1.6.10
jobs:
build:
strategy:
matrix:
os: [linux, macos, windows]
include:
- os: linux
builder: ubuntu-latest
shell: bash --noprofile --norc -e -o pipefail
- os: macos
builder: macos-latest
shell: bash --noprofile --norc -e -o pipefail
- os: windows
builder: windows-latest
shell: bash

defaults:
run:
shell: ${{ matrix.shell }} {0}

name: '${{ matrix.os }}'
runs-on: ${{ matrix.builder }}
timeout-minutes: 80
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Setup Nimble
uses: nim-lang/nimble/.github/actions/install_nimble@master
with:
os: ${{ matrix.os }}
cpu: amd64

- name: Restore nimble dependencies from cache
id: nimble_deps
uses: actions/cache@v3
with:
path: ~/.nimble/
key: ${{ matrix.os }}-${{ env.cache_nonce }}

- name: Install deps
run: nimble -d -y install

- name: Unit tests
run: nimble test

# workaround for https://github.com/NomicFoundation/hardhat/issues/3877
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.15

- name: Checkout sources
uses: actions/checkout@v3
with:
repository: status-im/codex-contracts-eth
ref: 30affa0da85985f6dc90b62f6293de46a9e26130
path: codex-contracts-eth

- name: Start Ethereum node with Codex contracts
working-directory: codex-contracts-eth
env:
MSYS2_PATH_TYPE: inherit
run: |
npm install
npm start &
- name: Contract tests
run: nimble testContracts

- name: Integration tests
run: nimble testIntegration

# coverage:
# continue-on-error: true
# runs-on: ubuntu-latest
# steps:
# - name: Checkout sources
# uses: actions/checkout@v3


# - name: Generate coverage data
# run: make -j${ncpu} coverage
# shell: bash

# - name: Upload coverage data to Codecov
# uses: codecov/codecov-action@v3
# with:
# directory: ./coverage/
# fail_ci_if_error: true
# files: ./coverage/coverage.f.info
# flags: unittests
# name: codecov-umbrella
# verbose: true
5 changes: 4 additions & 1 deletion codex.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ when declared(namedBin):
"codex/codex": "codex"
}.toTable()

when not declared(getPathsClause):
proc getPathsClause(): string = ""

### Helper functions
proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
if not dirExists "build":
Expand All @@ -50,7 +53,7 @@ proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
for i in 2..<paramCount():
extra_params &= " " & paramStr(i)

exec "nim " & lang & " --out:build/" & name & " " & extra_params & " " & srcDir & name & ".nim"
exec "nim " & getPathsClause() & " " & lang & " --out:build/" & name & " " & extra_params & " " & srcDir & name & ".nim"

proc test(name: string, srcDir = "tests/", params = "", lang = "c") =
buildBinary name, srcDir, params
Expand Down
3 changes: 2 additions & 1 deletion config.nims
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import std/os

const currentDir = currentSourcePath()[0 .. ^(len("config.nims") + 1)]

if getEnv("NIMBUS_BUILD_SYSTEM") == "yes" and
when getEnv("NIMBUS_BUILD_SYSTEM") == "yes" and
# BEWARE
# In Nim 1.6, config files are evaluated with a working directory
# matching where the Nim command was invocated. This means that we
# must do all file existance checks with full absolute paths:
system.fileExists(currentDir & "nimbus-build-system.paths"):

include "nimbus-build-system.paths"

if defined(release):
Expand Down
45 changes: 45 additions & 0 deletions nimble-update-lock.develop
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"version": 1,
"includes": [],
"dependencies": [
"vendor/asynctest",
"vendor/combparser",
"vendor/dnsclient.nim",
"vendor/lrucache.nim",
"vendor/nim-bearssl",
"vendor/nim-blscurve",
"vendor/nim-chronicles",
"vendor/nim-chronos",
"vendor/nim-confutils",
"vendor/nim-contract-abi",
"vendor/nim-datastore",
"vendor/nim-eth",
"vendor/nim-ethers",
"vendor/nim-faststreams",
"vendor/nim-http-utils",
"vendor/nim-json-rpc",
"vendor/nim-json-serialization",
"vendor/nim-leopard",
"vendor/nim-libbacktrace",
"vendor/nim-libp2p",
"vendor/nim-libp2p-dht",
"vendor/nim-metrics",
"vendor/nim-nat-traversal",
"vendor/nim-nitro",
"vendor/nim-presto",
"vendor/nim-secp256k1",
"vendor/nim-serialization",
"vendor/nim-sqlite3-abi",
"vendor/nim-stew",
"vendor/nim-taskpools",
"vendor/nim-toml-serialization",
"vendor/nim-unittest2",
"vendor/nim-websock",
"vendor/nim-zlib",
"vendor/nimcrypto",
"vendor/questionable",
"vendor/stint",
"vendor/nimbus-build-system/vendor/Nim",
"vendor/upraises"
]
}
Loading

0 comments on commit 88838ba

Please sign in to comment.