GitHub CI: modularize LiT setup, add reusable cleanup action, and adopt matrix builds #5489
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: | |
| - 'main' | |
| pull_request: | |
| branches: | |
| - '*' | |
| merge_group: | |
| branches: | |
| - 'main' | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| # Go needs absolute directories; using the $HOME variable doesn't work here. | |
| GOPATH: /home/runner/work/go | |
| GO_VERSION: '1.24.9' | |
| LITD_ITEST_BRANCH: 'master' | |
| jobs: | |
| # Validate generated SQL models stay in sync with queries. | |
| sqlc-check: | |
| name: SQLC Model Generation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: git checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup go ${{ env.GO_VERSION }} | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '${{ env.GO_VERSION }}' | |
| - name: docker image cache | |
| uses: jpribyl/[email protected] | |
| continue-on-error: true | |
| - name: Generate sql models | |
| run: make sqlc-check | |
| # Rebuild RPC stubs and REST annotations to detect drift. | |
| rpc-check: | |
| name: RPC Stub and REST Annotation Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: git checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup go ${{ env.GO_VERSION }} | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '${{ env.GO_VERSION }}' | |
| - name: Generate RPC stubs and check REST annotations | |
| run: make rpc-check | |
| # Ensure go.mod and go.sum remain tidy. | |
| mod-check: | |
| name: Go Module Tidy Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: git checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup go ${{ env.GO_VERSION }} | |
| uses: actions/setup-go@v3 | |
| with: | |
| go-version: '${{ env.GO_VERSION }}' | |
| - name: Run go mod tidy | |
| run: make mod-check | |
| # Confirm deterministic test vectors are up to date. | |
| test-vector-check: | |
| name: Test Vector Regeneration Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: git checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup go ${{ env.GO_VERSION }} | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '${{ env.GO_VERSION }}' | |
| - name: Run test vector creation check | |
| run: make test-vector-check | |
| # Verify database migration numbering and versions. | |
| migration-check: | |
| name: Database Migration Version Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: git checkout | |
| uses: actions/checkout@v4 | |
| - name: Run migration check | |
| run: make migration-check | |
| # Build the codebase and docs examples to catch compilation regressions. | |
| compile-check: | |
| name: Code and Docs Compilation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: git checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup go ${{ env.GO_VERSION }} | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '${{ env.GO_VERSION }}' | |
| - name: compile code | |
| run: go install -v ./... | |
| - name: Compile docs examples | |
| run: make build-docs-examples | |
| # Guard sample-tapd.conf defaults against accidental drift. | |
| sample-conf-check: | |
| name: Sample Config Defaults | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: git checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup go ${{ env.GO_VERSION }} | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '${{ env.GO_VERSION }}' | |
| - name: check default values in sample-tapd.conf file | |
| run: make sample-conf-check | |
| # Smoke test Docker builds for default and dev images. | |
| docker-build-check: | |
| name: Docker Build Smoke Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: git checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Build default image | |
| uses: docker/build-push-action@v4 | |
| with: | |
| tags: 'default-taproot-assets' | |
| - name: Build dev image | |
| uses: docker/build-push-action@v4 | |
| with: | |
| file: dev.Dockerfile | |
| tags: 'dev-taproot-assets' | |
| # Cross-compile release binaries across supported targets. | |
| cross-compile: | |
| name: Release Cross-Compile (${{ matrix.sys }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| sys: | |
| - darwin-amd64 | |
| - darwin-arm64 | |
| - linux-386 | |
| - linux-amd64 | |
| - linux-armv6 | |
| - linux-armv7 | |
| - linux-arm64 | |
| - windows-amd64 | |
| steps: | |
| - name: git checkout | |
| uses: actions/checkout@v5 | |
| - name: Clean up runner space | |
| uses: ./.github/actions/cleanup-space | |
| - name: Setup go ${{ env.GO_VERSION }} | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '${{ env.GO_VERSION }}' | |
| - name: Build release for ${{ matrix.sys }} | |
| run: make release sys=${{ matrix.sys }} | |
| # Run the lint suite for static analysis coverage. | |
| lint-check: | |
| name: Lint Suite | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: git checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup go ${{ env.GO_VERSION }} | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '${{ env.GO_VERSION }}' | |
| - name: run lint | |
| run: make lint | |
| # Enforce formatting consistency. | |
| format-check: | |
| name: Formatting Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: git checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup go ${{ env.GO_VERSION }} | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '${{ env.GO_VERSION }}' | |
| - name: run format | |
| run: make fmt | |
| # Ensure pull requests update release notes unless explicitly skipped. | |
| milestone-check: | |
| name: Release Notes Gate | |
| runs-on: ubuntu-latest | |
| if: '!contains(github.event.pull_request.labels.*.name, ''no-changelog'')' | |
| steps: | |
| - name: Git checkout | |
| uses: actions/checkout@v4 | |
| - name: Release notes check | |
| run: scripts/check-release-notes.sh | |
| # Unit tests with race detection, coverage, and Postgres backend variants. | |
| unit-test: | |
| name: Unit Tests - ${{ matrix.unit_type }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| # Allow other tests in the matrix to continue if one fails. | |
| fail-fast: false | |
| matrix: | |
| unit_type: | |
| - unit-race | |
| - unit-cover | |
| - unit dbbackend=postgres | |
| steps: | |
| - name: git checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup go ${{ env.GO_VERSION }} | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '${{ env.GO_VERSION }}' | |
| - name: Run ${{ matrix.unit_type }} | |
| run: make ${{ matrix.unit_type }} | |
| - name: Send coverage | |
| uses: coverallsapp/github-action@v2 | |
| if: matrix.unit_type == 'unit-cover' | |
| continue-on-error: true | |
| with: | |
| file: coverage.txt | |
| flag-name: 'unit' | |
| format: 'golang' | |
| parallel: true | |
| # Integration tests on SQLite backend. | |
| integration-test: | |
| name: Integration Tests (SQLite) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: git checkout | |
| uses: actions/checkout@v5 | |
| - name: Clean up runner space | |
| uses: ./.github/actions/cleanup-space | |
| - name: Setup go ${{ env.GO_VERSION }} | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '${{ env.GO_VERSION }}' | |
| - name: run itest | |
| run: make itest-parallel | |
| - name: Zip log files on failure | |
| if: ${{ failure() }} | |
| run: 7z a logs-itest.zip itest/**/*.log | |
| - name: Upload log files on failure | |
| uses: actions/upload-artifact@v4 | |
| if: ${{ failure() }} | |
| with: | |
| name: logs-itest | |
| path: logs-itest.zip | |
| retention-days: 5 | |
| - name: Send coverage | |
| uses: coverallsapp/github-action@v2 | |
| if: ${{ success() }} | |
| continue-on-error: true | |
| with: | |
| file: itest/coverage.txt | |
| flag-name: 'itest' | |
| format: 'golang' | |
| parallel: true | |
| # Integration tests on Postgres backend. | |
| integration-test-postgres: | |
| name: Integration Tests (Postgres) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: git checkout | |
| uses: actions/checkout@v5 | |
| - name: Clean up runner space | |
| uses: ./.github/actions/cleanup-space | |
| - name: Setup go ${{ env.GO_VERSION }} | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '${{ env.GO_VERSION }}' | |
| - name: run itest | |
| run: make itest-parallel dbbackend=postgres tranches=4 | |
| - name: Zip log files on failure | |
| if: ${{ failure() }} | |
| run: 7z a logs-itest-postgres.zip itest/**/*.log | |
| - name: Upload log files on failure | |
| uses: actions/upload-artifact@v4 | |
| if: ${{ failure() }} | |
| with: | |
| name: logs-itest-postgres | |
| path: logs-itest-postgres.zip | |
| retention-days: 5 | |
| - name: Send coverage | |
| uses: coverallsapp/github-action@v2 | |
| if: ${{ success() }} | |
| continue-on-error: true | |
| with: | |
| file: itest/coverage.txt | |
| flag-name: 'itest' | |
| format: 'golang' | |
| parallel: true | |
| # LiT integration/unit tests with Taproot Assets replacements. | |
| run-lit: | |
| name: LiT Tests - ${{ matrix.task_name }} | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - task_name: itests (custom_channels) | |
| run_cmd: make itest icase=custom_channels | |
| - task_name: unit | |
| run_cmd: make unit | |
| steps: | |
| - name: git checkout | |
| uses: actions/checkout@v4 | |
| - name: Prepare LiT workspace | |
| uses: ./.github/actions/lit-setup | |
| - name: Run LiT ${{ matrix.task_name }} | |
| working-directory: ./lightning-terminal | |
| run: ${{ matrix.run_cmd }} | |
| # Finalize Coveralls reporting after parallel coverage jobs. | |
| finish: | |
| name: Finalize Coverage Reporting | |
| if: ${{ always() }} | |
| needs: [ unit-test ] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: coverallsapp/github-action@v2 | |
| continue-on-error: true | |
| with: | |
| parallel-finished: true |