nim-codex/.github/workflows/ci.yml

133 lines
3.6 KiB
YAML

name: CI
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
env:
cache_nonce: 0 # Allows for easily busting actions/cache caches
nim_version: v1.6.14
jobs:
build:
strategy:
matrix:
include:
- os: linux
cpu: amd64
builder: ubuntu-latest
shell: bash --noprofile --norc -e -o pipefail
tests: all
- os: linux
cpu: amd64
builder: ubuntu-latest
shell: bash --noprofile --norc -e -o pipefail
tests: orc
- os: macos
cpu: amd64
builder: macos-latest
shell: bash --noprofile --norc -e -o pipefail
tests: all
- os: windows
cpu: amd64
builder: windows-latest
shell: msys2
tests: unittest
- os: windows
cpu: amd64
builder: windows-latest
shell: msys2
tests: contract
- os: windows
cpu: amd64
builder: windows-latest
shell: msys2
tests: integration
defaults:
run:
shell: ${{ matrix.shell }} {0}
name: '${{ matrix.os }}-${{ matrix.cpu }}-tests-${{ matrix.tests }}'
runs-on: ${{ matrix.builder }}
timeout-minutes: 80
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: recursive
## Configure ORC on certain runs
- name: Setup ORC Test
if: matrix.tests == 'orc'
run: |
echo "CODEX_USE_ORC=1" >> $GITHUB_ENV
- name: Setup Nimbus Build System
uses: ./.github/actions/nimbus-build-system
with:
os: ${{ matrix.os }}
shell: ${{ matrix.shell }}
nim_version: ${{ env.nim_version }}
## Part 1 Tests ##
- name: Unit tests
if: matrix.tests == 'unittest' || matrix.tests == 'all' || matrix.tests == 'orc'
run: make -j${ncpu} 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: Start Ethereum node with Codex contracts
if: matrix.tests == 'contract' || matrix.tests == 'integration' || matrix.tests == 'all' || matrix.tests == 'orc'
working-directory: vendor/codex-contracts-eth
env:
MSYS2_PATH_TYPE: inherit
run: |
npm install
npm start &
## Part 2 Tests ##
- name: Contract tests
if: matrix.tests == 'contract' || matrix.tests == 'all' || matrix.tests == 'orc'
run: make -j${ncpu} testContracts
## Part 3 Tests ##
- name: Integration tests
if: matrix.tests == 'integration' || matrix.tests == 'all' || matrix.tests == 'orc'
run: make -j${ncpu} testIntegration
coverage:
continue-on-error: true
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Nimbus Build System
uses: ./.github/actions/nimbus-build-system
with:
os: linux
nim_version: ${{ env.nim_version }}
- name: Generate coverage data
run: |
# make -j${ncpu} coverage
make -j${ncpu} coverage-script
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