ci: Rework the integration tests to be reusable #14737
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: Continuous Integration | |
| on: | |
| push: | |
| branches: | |
| - "master" | |
| pull_request: | |
| types: [opened, synchronize, edited] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| # Makes the upload-artifact work more reliably at the cost | |
| # of a bit of compile time. | |
| RUST_PROFILE: release | |
| SLOW_MACHINE: 1 | |
| CI_SERVER_URL: "http://35.239.136.52:3170" | |
| jobs: | |
| prebuild: | |
| name: Pre-build checks | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 30 | |
| if: | | |
| github.event.action != 'edited' || | |
| contains(github.event.pull_request.body, 'Changelog') | |
| env: | |
| BOLTDIR: bolts | |
| strategy: | |
| fail-fast: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| fetch-depth: 0 | |
| - name: Rebase | |
| # We can't rebase if we're on master already. | |
| if: github.ref != 'refs/heads/master' | |
| run: | | |
| git config user.name github-actions | |
| git config user.email [email protected] | |
| git fetch origin ${{ github.base_ref }} | |
| git rebase origin/${{ github.base_ref }} | |
| - name: Check changelog | |
| env: | |
| PR_DESCRIPTION: "${{ github.event.pull_request.body || '' }}" | |
| EVENT_NAME: "${{ github.event_name }}" | |
| BASE_REF: "${{ github.base_ref || 'master' }}" | |
| run: | | |
| echo "Event Name: $EVENT_NAME" | |
| echo "Base Ref: $BASE_REF" | |
| echo "PR DESCRIPTION: $PR_DESCRIPTION" | |
| if [ "$EVENT_NAME" = "pull_request" ]; then | |
| if [[ "$PR_DESCRIPTION" != *"Changelog-None"* && \ | |
| -z "$(git log origin/$BASE_REF..HEAD --oneline --grep='Changelog-')" && \ | |
| "$(git rev-parse --abbrev-ref HEAD)" != "$BASE_REF" ]]; then | |
| echo "::error::'Changelog' entry is missing in all commits, and 'Changelog-None' not specified in the PR description" | |
| exit 1 | |
| else | |
| if [[ "$PR_DESCRIPTION" == *"Changelog-None"* ]]; then | |
| echo "Changelog found in PR description" | |
| else | |
| echo "Changelog found in Commit \"$(git log origin/$BASE_REF..HEAD --oneline --grep='Changelog-')\"" | |
| fi | |
| fi | |
| else | |
| echo "Not a PR event." | |
| fi | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install dependencies | |
| run: | | |
| bash -x .github/scripts/setup.sh | |
| # We're going to check BOLT quotes, so get the latest version | |
| git clone https://github.com/lightning/bolts.git ../${BOLTDIR} | |
| - name: Configure | |
| run: ./configure --enable-debugbuild --enable-rust | |
| - name: Check source | |
| env: | |
| VALGRIND: 0 | |
| PYTEST_OPTS: --timeout=1200 --durations=10 | |
| run: | | |
| uv run make check-source BASE_REF="origin/${{ github.base_ref }}" | |
| - name: Check Generated Files have been updated | |
| run: uv run make check-gen-updated | |
| - name: Check docs | |
| run: uv run make check-doc | |
| compile-gcc: | |
| name: Compile CLN (GCC) | |
| needs: | |
| - prebuild | |
| uses: ./.github/workflows/build-cln.yaml | |
| with: | |
| cfg: compile-gcc | |
| compiler: gcc | |
| valgrind: 1 | |
| compile-gcc-O3: | |
| name: Compile CLN (GCC -O3) | |
| needs: | |
| - prebuild | |
| uses: ./.github/workflows/build-cln.yaml | |
| with: | |
| cfg: compile-gcc-O3 | |
| compiler: gcc | |
| valgrind: 1 | |
| coptflags: 'COPTFLAGS="-O3 -Werror"' | |
| compile-clang: | |
| name: Compile CLN (Clang) | |
| needs: | |
| - prebuild | |
| uses: ./.github/workflows/build-cln.yaml | |
| with: | |
| cfg: compile-clang | |
| compiler: clang | |
| valgrind: 1 | |
| compile-clang-sanitizers: | |
| name: Compile CLN (Clang with sanitizers) | |
| needs: | |
| - prebuild | |
| uses: ./.github/workflows/build-cln.yaml | |
| with: | |
| cfg: compile-clang-sanitizers | |
| compiler: clang | |
| valgrind: 0 | |
| asan: 1 | |
| ubsan: 1 | |
| check-units: | |
| # The unit test checks are not in the critical path (not dependent | |
| # on the integration tests), so run them with `valgrind` | |
| name: Run unit tests | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 30 | |
| env: | |
| BOLTDIR: bolts | |
| needs: | |
| - compile-gcc | |
| - compile-clang-sanitizers | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| include: | |
| - CFG: compile-gcc | |
| VALGRIND: 1 | |
| - CFG: compile-clang-sanitizers | |
| VALGRIND: 0 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install dependencies | |
| run: | | |
| bash -x .github/scripts/setup.sh | |
| sudo apt-get update -qq | |
| # We're going to check BOLT quotes, so get the latest version | |
| git clone https://github.com/lightning/bolts.git ../${BOLTDIR} | |
| - name: Download build | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: cln-${{ matrix.CFG }}.tar.bz2 | |
| - name: Check | |
| run: | | |
| tar -xaf cln-${{ matrix.CFG }}.tar.bz2 | |
| uv run eatmydata make -j $(nproc) check-units installcheck VALGRIND=${{ matrix.VALGRIND }} | |
| check-fuzz: | |
| name: Run fuzz regression tests | |
| runs-on: ubuntu-22.04 | |
| needs: | |
| - prebuild | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install dependencies | |
| run: | | |
| bash -x .github/scripts/setup.sh | |
| - name: Build | |
| run: | | |
| ./configure --enable-debugbuild --enable-fuzzing --enable-address-sanitizer --enable-ub-sanitizer --disable-valgrind CC=clang | |
| uv run make -j $(nproc) check-fuzz | |
| check-downgrade-sqlite: | |
| name: Check downgrade (SQLite) | |
| needs: | |
| - compile-gcc | |
| uses: ./.github/workflows/test-cln.yaml | |
| with: | |
| name: Check downgrade (SQLite) | |
| cfg: compile-gcc | |
| test_path: tests/test_downgrade.py | |
| test_db_provider: sqlite3 | |
| valgrind: 1 | |
| setup_old_cln: true | |
| check-downgrade-postgres: | |
| name: Check downgrade (Postgres) | |
| needs: | |
| - compile-gcc | |
| uses: ./.github/workflows/test-cln.yaml | |
| with: | |
| name: Check downgrade (Postgres) | |
| cfg: compile-gcc | |
| test_path: tests/test_downgrade.py | |
| test_db_provider: postgres | |
| setup_old_cln: true | |
| check-downgrade-liquid: | |
| name: Check downgrade (Liquid) | |
| needs: | |
| - compile-gcc | |
| uses: ./.github/workflows/test-cln.yaml | |
| with: | |
| name: Check downgrade (Liquid) | |
| cfg: compile-gcc | |
| test_path: tests/test_downgrade.py | |
| test_db_provider: sqlite3 | |
| test_network: liquid-regtest | |
| setup_old_cln: true | |
| integration-gcc: | |
| name: Test CLN (GCC) | |
| needs: | |
| - compile-gcc | |
| uses: ./.github/workflows/test-cln.yaml | |
| with: | |
| name: Test CLN (GCC) | |
| cfg: compile-gcc | |
| test_db_provider: sqlite3 | |
| compiler: gcc | |
| compat: 1 | |
| integration-clang: | |
| name: Test CLN (Clang) | |
| needs: | |
| - compile-clang | |
| uses: ./.github/workflows/test-cln.yaml | |
| with: | |
| name: Test CLN (Clang) | |
| cfg: compile-clang | |
| test_db_provider: sqlite3 | |
| compiler: clang | |
| compat: 1 | |
| integration-postgres: | |
| name: Test CLN (Postgres) | |
| needs: | |
| - compile-gcc | |
| uses: ./.github/workflows/test-cln.yaml | |
| with: | |
| name: Test CLN (Postgres) | |
| cfg: compile-gcc | |
| test_db_provider: postgres | |
| compiler: gcc | |
| compat: 1 | |
| integration-liquid: | |
| name: Test CLN (Liquid) | |
| needs: | |
| - compile-gcc | |
| uses: ./.github/workflows/test-cln.yaml | |
| with: | |
| name: Test CLN (Liquid) | |
| cfg: compile-gcc | |
| test_db_provider: sqlite3 | |
| compiler: gcc | |
| test_network: liquid-regtest | |
| compat: 1 | |
| integration-dual-fund: | |
| name: Test CLN (Dual Fund) | |
| needs: | |
| - compile-gcc | |
| uses: ./.github/workflows/test-cln.yaml | |
| with: | |
| name: Test CLN (Dual Fund) | |
| cfg: compile-gcc | |
| test_db_provider: sqlite3 | |
| compiler: gcc | |
| experimental_dual_fund: 1 | |
| compat: 1 | |
| integration-splicing: | |
| name: Test CLN (Splicing) | |
| needs: | |
| - compile-gcc | |
| uses: ./.github/workflows/test-cln.yaml | |
| with: | |
| name: Test CLN (Splicing) | |
| cfg: compile-gcc | |
| test_db_provider: sqlite3 | |
| compiler: gcc | |
| experimental_splicing: 1 | |
| compat: 1 | |
| integration-valgrind: | |
| name: Valgrind Test CLN (${{ matrix.shard }}/10) | |
| needs: | |
| - compile-gcc | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
| uses: ./.github/workflows/test-cln.yaml | |
| with: | |
| name: Valgrind Test CLN | |
| cfg: compile-gcc | |
| pytest_opts: '--test-group-random-seed=42 --timeout=1800 --durations=10' | |
| pytest_workers: 3 | |
| valgrind: 1 | |
| install_valgrind: true | |
| shard_count: 10 | |
| shard_index: ${{ matrix.shard }} | |
| integration-sanitizers: | |
| name: Sanitizers Test CLN (${{ matrix.shard }}/10) | |
| needs: | |
| - compile-clang-sanitizers | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
| uses: ./.github/workflows/test-cln.yaml | |
| with: | |
| name: ASan/UBSan Test CLN | |
| cfg: compile-clang-sanitizers | |
| pytest_opts: '--test-group-random-seed=42 --timeout=1800 --durations=10' | |
| pytest_workers: 2 | |
| shard_count: 10 | |
| shard_index: ${{ matrix.shard }} | |
| update-docs-examples: | |
| name: Update examples in doc schemas (disabled temporarily!) | |
| if: false | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| env: | |
| VALGRIND: 0 | |
| GENERATE_EXAMPLES: 1 | |
| PYTEST_OPTS: --timeout=1200 --durations=10 | |
| TEST_NETWORK: regtest | |
| needs: | |
| - compile-gcc | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install dependencies | |
| run: | | |
| bash -x .github/scripts/setup.sh | |
| - name: Install bitcoind | |
| env: | |
| TEST_NETWORK: regtest | |
| run: .github/scripts/install-bitcoind.sh | |
| - name: Download build | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: cln-compile-gcc.tar.bz2 | |
| - name: Unpack pre-built CLN | |
| run: | | |
| tar -xaf cln-compile-gcc.tar.bz2 | |
| - name: Test | |
| run: | | |
| uv run eatmydata make -j $(nproc) check-doc-examples | |
| min-btc-support: | |
| name: Test minimum supported BTC v${{ matrix.MIN_BTC_VERSION }} with ${{ matrix.NAME }} | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 120 | |
| env: | |
| RUST_PROFILE: release # Has to match the one in the compile step | |
| PYTEST_OPTS: --timeout=1200 --durations=10 | |
| needs: | |
| - compile-clang | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - NAME: clang | |
| CFG: compile-clang | |
| TEST_DB_PROVIDER: sqlite3 | |
| COMPILER: clang | |
| TEST_NETWORK: regtest | |
| MIN_BTC_VERSION: "25.0" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install dependencies | |
| run: | | |
| bash -x .github/scripts/setup.sh | |
| - name: Download Bitcoin Core | |
| run: wget "https://bitcoincore.org/bin/bitcoin-core-${{ matrix.MIN_BTC_VERSION }}/bitcoin-${{ matrix.MIN_BTC_VERSION }}-x86_64-linux-gnu.tar.gz" | |
| - name: Extract Bitcoin Core | |
| run: tar -xf "bitcoin-${{ matrix.MIN_BTC_VERSION }}-x86_64-linux-gnu.tar.gz" | |
| - name: Move Bitcoin Core Binaries | |
| run: sudo mv bitcoin-${{ matrix.MIN_BTC_VERSION }}/bin/* /usr/local/bin/ | |
| - name: Clean Up Downloaded Bitcoin | |
| run: rm -rf "bitcoin-${{ matrix.MIN_BTC_VERSION }}-x86_64-linux-gnu.tar.gz" "bitcoin-${{ matrix.MIN_BTC_VERSION }}" | |
| - name: Download build | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: cln-${{ matrix.CFG }}.tar.bz2 | |
| - name: Unpack pre-built CLN | |
| env: | |
| CFG: ${{ matrix.CFG }} | |
| run: | | |
| tar -xaf cln-${CFG}.tar.bz2 | |
| - name: Test | |
| env: | |
| COMPILER: ${{ matrix.COMPILER }} | |
| COMPAT: 1 | |
| CFG: ${{ matrix.CFG }} | |
| SLOW_MACHINE: 1 | |
| PYTEST_PAR: 10 | |
| TEST_DEBUG: 1 | |
| TEST_DB_PROVIDER: ${{ matrix.TEST_DB_PROVIDER }} | |
| TEST_NETWORK: ${{ matrix.TEST_NETWORK }} | |
| LIGHTNINGD_POSTGRES_NO_VACUUM: 1 | |
| run: | | |
| env | |
| cat config.vars | |
| VALGRIND=0 uv run eatmydata pytest tests/ -vvv -n ${PYTEST_PAR} ${PYTEST_OPTS} | |
| check-flake: | |
| name: Check Nix Flake | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| fail-fast: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Check Nix flake inputs | |
| uses: DeterminateSystems/flake-checker-action@v8 | |
| - name: Install Nix | |
| uses: cachix/install-nix-action@v31 | |
| with: | |
| nix_path: nixpkgs=channel:nixos-unstable | |
| - name: Check flake | |
| run: nix flake check | |
| gather: | |
| # A dummy task that depends on the full matrix of tests, and | |
| # signals successful completion. Used for the PR status to pass | |
| # before merging. Needs to run even if they failed! | |
| name: CI completion | |
| runs-on: ubuntu-22.04 | |
| needs: | |
| - integration-gcc | |
| - integration-clang | |
| - integration-postgres | |
| - integration-liquid | |
| - integration-dual-fund | |
| - integration-splicing | |
| - check-units | |
| - integration-valgrind | |
| - integration-sanitizers | |
| - min-btc-support | |
| - check-downgrade-sqlite | |
| - check-downgrade-postgres | |
| - check-downgrade-liquid | |
| if: ${{ always() }} | |
| steps: | |
| - name: Complete | |
| env: | |
| JOB_NAMES: "INTEGRATION_GCC INTEGRATION_CLANG INTEGRATION_POSTGRES INTEGRATION_LIQUID INTEGRATION_DUAL_FUND INTEGRATION_SPLICING CHECK_UNITS VALGRIND SANITIZERS BTC CHECK_DOWNGRADE_SQLITE CHECK_DOWNGRADE_POSTGRES CHECK_DOWNGRADE_LIQUID" | |
| INTEGRATION_GCC: ${{ needs['integration-gcc'].result }} | |
| INTEGRATION_CLANG: ${{ needs['integration-clang'].result }} | |
| INTEGRATION_POSTGRES: ${{ needs['integration-postgres'].result }} | |
| INTEGRATION_LIQUID: ${{ needs['integration-liquid'].result }} | |
| INTEGRATION_DUAL_FUND: ${{ needs['integration-dual-fund'].result }} | |
| INTEGRATION_SPLICING: ${{ needs['integration-splicing'].result }} | |
| CHECK_UNITS: ${{ needs['check-units'].result }} | |
| VALGRIND: ${{ needs['integration-valgrind'].result }} | |
| SANITIZERS: ${{ needs['integration-sanitizers'].result }} | |
| BTC: ${{ needs['min-btc-support'].result }} | |
| CHECK_DOWNGRADE_SQLITE: ${{ needs['check-downgrade-sqlite'].result }} | |
| CHECK_DOWNGRADE_POSTGRES: ${{ needs['check-downgrade-postgres'].result }} | |
| CHECK_DOWNGRADE_LIQUID: ${{ needs['check-downgrade-liquid'].result }} | |
| run: | | |
| failed="" | |
| for name in $JOB_NAMES; do | |
| result="${!name}" | |
| echo "$name: $result" | |
| if [[ "$result" != "success" ]]; then | |
| failed="yes" | |
| fi | |
| done | |
| if [[ "$failed" == "yes" ]]; then | |
| echo "One or more required jobs failed" | |
| exit 1 | |
| fi |