# =============================================================================
# Nimcheck CI pipeline (Gitea Actions)
#
# Default branch: master
# Requires act_runner with label: ubuntu-latest
#
# Jobs: lint → test (matrix) → build artifact
# Optional: coverage (manual / master push)
# =============================================================================
name: CI
on:
push:
branches: [master, main, develop]
pull_request:
branches: [master, main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NIM_VERSION: "stable"
DEFAULT_BRANCH: "master"
jobs:
lint:
name: Lint (${{ env.NIM_VERSION }})
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache choosenim toolchains
uses: actions/cache@v4
with:
path: ~/.choosenim
key: choosenim-${{ runner.os }}-${{ env.NIM_VERSION }}
- name: Cache nimble packages
uses: actions/cache@v4
with:
path: ~/.nimble
key: nimble-${{ runner.os }}-${{ hashFiles('nimcheck.nimble') }}
- name: Install Nim
run: |
if ! command -v nim &>/dev/null; then
curl https://nim-lang.org/choosenim/init.sh -sSf | sh -s -- -y "${{ env.NIM_VERSION }}"
fi
echo "$HOME/.nimble/bin" >> "$GITHUB_PATH"
- name: Lint
run: make lint
test:
name: Test (nim-${{ matrix.nim-version }})
needs: [lint]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
nim-version: ["2.0.8", "stable"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache choosenim toolchains
uses: actions/cache@v4
with:
path: ~/.choosenim
key: choosenim-${{ runner.os }}-${{ matrix.nim-version }}
- name: Cache nimble packages
uses: actions/cache@v4
with:
path: ~/.nimble
key: nimble-${{ runner.os }}-${{ hashFiles('nimcheck.nimble') }}
- name: Install Nim
run: |
curl https://nim-lang.org/choosenim/init.sh -sSf | sh -s -- -y "${{ matrix.nim-version }}"
echo "$HOME/.nimble/bin" >> "$GITHUB_PATH"
- name: Run tests
run: make test
build:
name: Build
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache choosenim toolchains
uses: actions/cache@v4
with:
path: ~/.choosenim
key: choosenim-${{ runner.os }}-${{ env.NIM_VERSION }}
- name: Cache nimble packages
uses: actions/cache@v4
with:
path: ~/.nimble
key: nimble-${{ runner.os }}-${{ hashFiles('nimcheck.nimble') }}
- name: Install Nim
run: |
curl https://nim-lang.org/choosenim/init.sh -sSf | sh -s -- -y "${{ env.NIM_VERSION }}"
echo "$HOME/.nimble/bin" >> "$GITHUB_PATH"
- name: Build (release)
run: |
make build
strip bin/nimcheck 2>/dev/null || true
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: nimcheck-${{ runner.os }}-${{ github.sha }}
path: bin/nimcheck
retention-days: 7
coverage:
name: Coverage
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'))
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache choosenim toolchains
uses: actions/cache@v4
with:
path: ~/.choosenim
key: choosenim-${{ runner.os }}-${{ env.NIM_VERSION }}
- name: Cache nimble packages
uses: actions/cache@v4
with:
path: ~/.nimble
key: nimble-${{ runner.os }}-${{ hashFiles('nimcheck.nimble') }}
- name: Install Nim
run: |
curl https://nim-lang.org/choosenim/init.sh -sSf | sh -s -- -y "${{ env.NIM_VERSION }}"
echo "$HOME/.nimble/bin" >> "$GITHUB_PATH"
- name: Install coverage tool
run: nimble install -y nimcoverage 2>/dev/null || true
- name: Run tests with coverage
run: make coverage || true