Add Nim-matrix workflow to run on merge queue (#693)

* Add Nim-matrix workflow to run on merge queue

* Use reusable workflows for CI and Nim-matrix
This commit is contained in:
Slava 2024-02-06 12:56:27 +02:00 committed by GitHub
parent 591be9446a
commit 403b9baf9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 139 additions and 78 deletions

79
.github/workflows/ci-reusable.yml vendored Normal file
View File

@ -0,0 +1,79 @@
name: Reusable - CI
on:
workflow_call:
inputs:
matrix:
type: string
cache_nonce:
default: '0'
description: Allows for easily busting actions/cache caches
required: false
type: string
env:
cache_nonce: ${{ inputs.cache_nonce }}
jobs:
build:
strategy:
matrix:
include: ${{ fromJson(inputs.matrix) }}
defaults:
run:
shell: ${{ matrix.shell }} {0}
name: '${{ matrix.os }}-${{ matrix.cpu }}-${{ matrix.nim_version }}-${{ matrix.tests }}'
runs-on: ${{ matrix.builder }}
timeout-minutes: 80
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Nimbus Build System
uses: ./.github/actions/nimbus-build-system
with:
os: ${{ matrix.os }}
shell: ${{ matrix.shell }}
nim_version: ${{ matrix.nim_version }}
## Part 1 Tests ##
- name: Unit tests
if: matrix.tests == 'unittest' || matrix.tests == 'all'
run: make -j${ncpu} test
# workaround for https://github.com/NomicFoundation/hardhat/issues/3877
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18.15
- name: Start Ethereum node with Codex contracts
if: matrix.tests == 'contract' || matrix.tests == 'integration' || matrix.tests == 'all'
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'
run: make -j${ncpu} testContracts
## Part 3 Tests ##
- name: Integration tests
if: matrix.tests == 'integration' || matrix.tests == 'all'
run: make -j${ncpu} testIntegration
status:
if: always()
needs: [build]
runs-on: ubuntu-latest
steps:
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}
run: exit 1

View File

@ -1,93 +1,45 @@
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
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
include:
- os: linux
cpu: amd64
builder: ubuntu-latest
shell: bash --noprofile --norc -e -o pipefail
tests: all
- 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
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
cache_nonce: ${{ env.cache_nonce }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Compute matrix
id: matrix
uses: fabiocaccamo/create-matrix-action@v4
with:
submodules: recursive
matrix: |
os {linux}, cpu {amd64}, builder {ubuntu-latest}, tests {all}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
os {macos}, cpu {amd64}, builder {macos-latest}, tests {all}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
os {windows}, cpu {amd64}, builder {windows-latest}, tests {unittest}, nim_version {${{ env.nim_version }}}, shell {msys2}
os {windows}, cpu {amd64}, builder {windows-latest}, tests {contract}, nim_version {${{ env.nim_version }}}, shell {msys2}
os {windows}, cpu {amd64}, builder {windows-latest}, tests {integration}, nim_version {${{ env.nim_version }}}, shell {msys2}
- name: Setup Nimbus Build System
uses: ./.github/actions/nimbus-build-system
build:
needs: matrix
uses: ./.github/workflows/ci-reusable.yml
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'
run: make -j${ncpu} test
# workaround for https://github.com/NomicFoundation/hardhat/issues/3877
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18.15
- name: Start Ethereum node with Codex contracts
if: matrix.tests == 'contract' || matrix.tests == 'integration' || matrix.tests == 'all'
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'
run: make -j${ncpu} testContracts
## Part 3 Tests ##
- name: Integration tests
if: matrix.tests == 'integration' || matrix.tests == 'all'
run: make -j${ncpu} testIntegration
matrix: ${{ needs.matrix.outputs.matrix }}
cache_nonce: ${{ needs.matrix.outputs.cache_nonce }}
coverage:
continue-on-error: true

View File

@ -1,4 +1,4 @@
name: Docker - Reusable
name: Reusable - Docker
on:

30
.github/workflows/nim-matrix.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: Nim matrix
on:
merge_group:
workflow_dispatch:
env:
cache_nonce: 0 # Allows for easily busting actions/cache caches
nim_version: v1.6.14, v1.6.16, v1.6.18, v2.0.0, v2.0.2
jobs:
matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
cache_nonce: ${{ env.cache_nonce }}
steps:
- name: Compute matrix
id: matrix
uses: fabiocaccamo/create-matrix-action@v4
with:
matrix: |
os {linux}, cpu {amd64}, builder {ubuntu-latest}, tests {all}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
build:
needs: matrix
uses: ./.github/workflows/ci-reusable.yml
with:
matrix: ${{ needs.matrix.outputs.matrix }}
cache_nonce: ${{ needs.matrix.outputs.cache_nonce }}