CI workflow (cashubtc/nutshell)
The CI workflow from cashubtc/nutshell, explained and optimized by Latchkey.
C
CI health: C - fair
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the CI workflow from the cashubtc/nutshell repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
workflow (.yml)
name: CI
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
checks:
uses: ./.github/workflows/checks.yml
tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
poetry-version: ["2.3.2"]
# Wallet v0 / deprecated mint API support was removed in https://github.com/cashubtc/nutshell/pull/814; deprecated-only CI runs are no longer valid.
# mint-only-deprecated: ["false", "true"]
mint-only-deprecated: ["false"]
mint-database: ["./test_data/test_mint", "postgres://cashu:cashu@localhost:5432/cashu"]
backend-wallet-class: ["FakeWallet"]
uses: ./.github/workflows/tests.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
poetry-version: ${{ matrix.poetry-version }}
mint-only-deprecated: ${{ matrix.mint-only-deprecated }}
mint-database: ${{ matrix.mint-database }}
tests_redis_cache:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
poetry-version: ["2.3.2"]
mint-database: ["./test_data/test_mint", "postgres://cashu:cashu@localhost:5432/cashu"]
uses: ./.github/workflows/tests_redis_cache.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
poetry-version: ${{ matrix.poetry-version }}
mint-database: ${{ matrix.mint-database }}
tests_keycloak_auth:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
poetry-version: ["2.3.2"]
mint-database: ["./test_data/test_mint", "postgres://cashu:cashu@localhost:5432/cashu"]
uses: ./.github/workflows/tests_keycloak_auth.yml
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
poetry-version: ${{ matrix.poetry-version }}
mint-database: ${{ matrix.mint-database }}
regtest-mint:
uses: ./.github/workflows/regtest-mint.yml
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
poetry-version: ["2.3.2"]
backend-wallet-class:
["LndRPCWallet", "LndRestWallet", "CLNRestWallet", "CoreLightningRestWallet", "LNbitsWallet"]
mint-database: ["./test_data/test_mint", "postgres://cashu:cashu@localhost:5432/cashu"]
# mint-database: ["./test_data/test_mint"]
with:
python-version: ${{ matrix.python-version }}
backend-wallet-class: ${{ matrix.backend-wallet-class }}
mint-database: ${{ matrix.mint-database }}
regtest-wallet:
uses: ./.github/workflows/regtest-wallet.yml
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
poetry-version: ["2.3.2"]
backend-wallet-class:
["LndRPCWallet", "LndRestWallet", "CLNRestWallet", "CoreLightningRestWallet", "LNbitsWallet"]
mint-database: ["./test_data/test_mint", "postgres://cashu:cashu@localhost:5432/cashu"]
# mint-database: ["./test_data/test_mint"]
with:
python-version: ${{ matrix.python-version }}
backend-wallet-class: ${{ matrix.backend-wallet-class }}
mint-database: ${{ matrix.mint-database }}
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: CI on: push: branches: - main pull_request: permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: checks: timeout-minutes: 30 uses: ./.github/workflows/checks.yml tests: timeout-minutes: 30 strategy: fail-fast: false matrix: os: [ubuntu-latest] python-version: ["3.12"] poetry-version: ["2.3.2"] # Wallet v0 / deprecated mint API support was removed in https://github.com/cashubtc/nutshell/pull/814; deprecated-only CI runs are no longer valid. # mint-only-deprecated: ["false", "true"] mint-only-deprecated: ["false"] mint-database: ["./test_data/test_mint", "postgres://cashu:cashu@localhost:5432/cashu"] backend-wallet-class: ["FakeWallet"] uses: ./.github/workflows/tests.yml with: os: ${{ matrix.os }} python-version: ${{ matrix.python-version }} poetry-version: ${{ matrix.poetry-version }} mint-only-deprecated: ${{ matrix.mint-only-deprecated }} mint-database: ${{ matrix.mint-database }} tests_redis_cache: timeout-minutes: 30 strategy: fail-fast: false matrix: os: [ubuntu-latest] python-version: ["3.12"] poetry-version: ["2.3.2"] mint-database: ["./test_data/test_mint", "postgres://cashu:cashu@localhost:5432/cashu"] uses: ./.github/workflows/tests_redis_cache.yml with: os: ${{ matrix.os }} python-version: ${{ matrix.python-version }} poetry-version: ${{ matrix.poetry-version }} mint-database: ${{ matrix.mint-database }} tests_keycloak_auth: timeout-minutes: 30 strategy: fail-fast: false matrix: os: [ubuntu-latest] python-version: ["3.12"] poetry-version: ["2.3.2"] mint-database: ["./test_data/test_mint", "postgres://cashu:cashu@localhost:5432/cashu"] uses: ./.github/workflows/tests_keycloak_auth.yml with: os: ${{ matrix.os }} python-version: ${{ matrix.python-version }} poetry-version: ${{ matrix.poetry-version }} mint-database: ${{ matrix.mint-database }} regtest-mint: timeout-minutes: 30 uses: ./.github/workflows/regtest-mint.yml strategy: fail-fast: false matrix: python-version: ["3.12"] poetry-version: ["2.3.2"] backend-wallet-class: ["LndRPCWallet", "LndRestWallet", "CLNRestWallet", "CoreLightningRestWallet", "LNbitsWallet"] mint-database: ["./test_data/test_mint", "postgres://cashu:cashu@localhost:5432/cashu"] # mint-database: ["./test_data/test_mint"] with: python-version: ${{ matrix.python-version }} backend-wallet-class: ${{ matrix.backend-wallet-class }} mint-database: ${{ matrix.mint-database }} regtest-wallet: timeout-minutes: 30 uses: ./.github/workflows/regtest-wallet.yml strategy: fail-fast: false matrix: python-version: ["3.12"] poetry-version: ["2.3.2"] backend-wallet-class: ["LndRPCWallet", "LndRestWallet", "CLNRestWallet", "CoreLightningRestWallet", "LNbitsWallet"] mint-database: ["./test_data/test_mint", "postgres://cashu:cashu@localhost:5432/cashu"] # mint-database: ["./test_data/test_mint"] with: python-version: ${{ matrix.python-version }} backend-wallet-class: ${{ matrix.backend-wallet-class }} mint-database: ${{ matrix.mint-database }}
What changed
- Cancel superseded runs when a branch or PR gets a newer push.
- Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 6 jobs (27 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.