Skip to content

Commit

Permalink
CI: test with Nim-1.6 and C++ (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefantalpalaru authored Jan 8, 2022
1 parent 2c0c486 commit 71e0f0e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 44 deletions.
85 changes: 43 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
cpu: amd64
- os: windows
cpu: amd64
branch: [version-1-2, version-1-4, devel]
branch: [version-1-2, version-1-4, version-1-6, devel]
include:
- target:
os: linux
Expand All @@ -45,41 +45,6 @@ jobs:
- name: Git checkout
uses: actions/checkout@v2

- name: Derive environment variables
shell: bash
run: |
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
ARCH=64
PLATFORM=x64
else
ARCH=32
PLATFORM=x86
fi
echo "ARCH=$ARCH" >> $GITHUB_ENV
echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV
if [[ '${{ matrix.target.os }}' == 'windows' ]]; then
MAKE_CMD="mingw32-make"
else
MAKE_CMD="make"
fi
echo "MAKE_CMD=$MAKE_CMD" >> $GITHUB_ENV
ncpu=
case '${{ runner.os }}' in
'Linux')
ncpu=$(nproc)
;;
'macOS')
ncpu=$(sysctl -n hw.ncpu)
;;
'Windows')
ncpu=$NUMBER_OF_PROCESSORS
;;
esac
[[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
echo "ncpu=$ncpu" >> $GITHUB_ENV
- name: Install build dependencies (Linux i386)
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
run: |
Expand Down Expand Up @@ -136,26 +101,62 @@ jobs:
run: |
mkdir -p external
curl -L "https://nim-lang.org/download/windeps.zip" -o external/windeps.zip
7z x -y external/windeps.zip -oexternal/dlls-${{ matrix.target.cpu }}
7z x -y external/windeps.zip -oexternal/dlls
- name: Path to cached dependencies (Windows)
if: >
runner.os == 'Windows'
run: |
echo "${{ github.workspace }}/external/dlls-${{ matrix.target.cpu }}" >> $GITHUB_PATH
echo "${{ github.workspace }}/external/dlls" >> $GITHUB_PATH
- name: Build the Nim compiler
- name: Derive environment variables
run: |
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
PLATFORM=x64
else
PLATFORM=x86
fi
echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV
ncpu=
MAKE_CMD="make"
case '${{ runner.os }}' in
'Linux')
ncpu=$(nproc)
;;
'macOS')
ncpu=$(sysctl -n hw.ncpu)
;;
'Windows')
ncpu=$NUMBER_OF_PROCESSORS
MAKE_CMD="mingw32-make"
;;
esac
[[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
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} CC=gcc NIM_COMMIT=${{ matrix.branch }} bash build_nim.sh nim csources dist/nimble NimBinaries
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: Run tests
run: |
if [[ "${{ matrix.target.os }}" == "windows" ]]; then
# https://github.com/status-im/nimbus-eth2/issues/3121
export NIMFLAGS="-d:nimRawSetjmp"
fi
nim --version
nimble --version
nimble install -y --depsOnly
nimble develop
nimble install chronicles -y
nimble install -y chronicles
nimble test
nimble test_chronicles
export TEST_LANG=cpp
nimble test
nimble test_chronicles
4 changes: 2 additions & 2 deletions metrics.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ requires "nim >= 1.2.0",
"chronos >= 2.6.0"

### Helper functions
proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
proc buildBinary(name: string, srcDir = "./", params = "") =
if not dirExists "build":
mkDir "build"
var extra_params = params
if paramStr(1) != "e":
# we're under Nim, not Nimble
for i in 2..<paramCount():
extra_params &= " " & paramStr(i)
exec "nim " & lang & " --out:./build/" & name & " -f --skipParentCfg --hints:off " & extra_params & " " & srcDir & name & ".nim"
exec "nim " & getEnv("TEST_LANG", "c") & " " & getEnv("NIMFLAGS") & " --out:./build/" & name & " -f --skipParentCfg --hints:off " & extra_params & " " & srcDir & name & ".nim"

### tasks
task test, "Main tests":
Expand Down

0 comments on commit 71e0f0e

Please sign in to comment.