This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nim CI | ||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
jobs: | ||
Test: | ||
if: | | ||
!contains(github.event.head_commit.message, '[skip ci]') | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
compiler: | ||
- name: nim | ||
version: devel | ||
- name: nimskull | ||
version: "*" | ||
name: "${{ matrix.os }} (${{ matrix.compiler.name }} ${{ matrix.compiler.version }})" | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: project | ||
- name: Compiler (nim) | ||
if: matrix.compiler.name == 'nim' | ||
uses: alaviss/[email protected] | ||
with: | ||
path: nim | ||
version: ${{ matrix.compiler.version }} | ||
- name: Compiler (nimskull) | ||
id: nimskull | ||
if: matrix.compiler.name == 'nimskull' | ||
uses: nim-works/[email protected] | ||
with: | ||
nimskull-version: ${{ matrix.compiler.version }} | ||
- if: matrix.compiler.name == 'nimskull' | ||
name: Fetch nimble's fork for nimskull | ||
uses: actions/checkout@v4 | ||
with: | ||
path: nimble | ||
repository: alaviss/nimble | ||
ref: nimskull | ||
- if: matrix.compiler.name == 'nimskull' | ||
name: Build nimble and add to PATH | ||
shell: bash | ||
run: | | ||
cd nimble | ||
nim c -d:release -o:nimble src/nimble.nim | ||
cp nimble "$NIMSKULL_BIN/nimble" | ||
# Add nimble binary folder to PATH too | ||
echo "$HOME/.nimble/bin" >> $GITHUB_PATH | ||
env: | ||
NIMSKULL_BIN: ${{ steps.nimskull.outputs.bin-path }} | ||
- name: Dependencies | ||
shell: bash | ||
run: | | ||
cd project | ||
nimble --accept develop | ||
env: | ||
NIM: ${{ matrix.compiler.name }} | ||
- name: Tests | ||
shell: bash | ||
run: | | ||
cd project | ||
nimble test | ||
env: | ||
NIM: ${{ matrix.compiler.name }} | ||
# Set check-required on this | ||
success: | ||
needs: build | ||
if: always() | ||
runs-on: ubuntu-latest | ||
name: 'All check passes' | ||
steps: | ||
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') | ||
name: 'Fail when previous jobs fails' | ||
run: | | ||
echo "::error::One of the previous jobs failed" | ||
exit 1 |