fix #136
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 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} | |
| cancel-in-progress: true | |
| on: | |
| push: | |
| branches: [master, dev, chore/self-hosted-ci] | |
| pull_request: | |
| types: [opened, reopened, synchronize] | |
| env: | |
| CARGO_HOME: /cargo-home | |
| RUSTUP_HOME: /usr/local/rustup | |
| CARGO_TERM_COLOR: always | |
| CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
| RUSTFLAGS: -C link-arg=-fuse-ld=mold | |
| jobs: | |
| fmt: | |
| runs-on: self-hosted | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: rust-ci-${{ hashFiles('Cargo.lock', 'test-integration/Cargo.lock', 'rust-toolchain.toml', 'test-integration/rust-toolchain.toml') }} | |
| add-job-id-key: false | |
| add-rust-environment-hash-key: false | |
| workspaces: | | |
| . -> target | |
| test-integration -> target | |
| cache-targets: false | |
| cache-all-crates: false | |
| cache-workspace-crates: false | |
| cache-bin: false | |
| cache-on-failure: true | |
| save-if: false | |
| - name: Format check | |
| run: make ci-fmt | |
| - name: Format check (test-integration) | |
| run: | | |
| cd test-integration | |
| make ci-fmt | |
| lint: | |
| runs-on: self-hosted | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: rust-ci-${{ hashFiles('Cargo.lock', 'test-integration/Cargo.lock', 'rust-toolchain.toml', 'test-integration/rust-toolchain.toml') }} | |
| add-job-id-key: false | |
| add-rust-environment-hash-key: false | |
| workspaces: | | |
| . -> target | |
| test-integration -> target | |
| cache-targets: true | |
| cache-all-crates: false | |
| cache-workspace-crates: true | |
| cache-bin: false | |
| cache-on-failure: true | |
| save-if: false | |
| - name: Lint | |
| run: make ci-lint | |
| - name: Lint (test-integration) | |
| run: | | |
| cd test-integration | |
| make ci-lint | |
| unit-tests: | |
| runs-on: self-hosted | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: rust-ci-${{ hashFiles('Cargo.lock', 'test-integration/Cargo.lock', 'rust-toolchain.toml', 'test-integration/rust-toolchain.toml') }} | |
| add-job-id-key: false | |
| add-rust-environment-hash-key: false | |
| workspaces: | | |
| . -> target | |
| test-integration -> target | |
| cache-targets: true | |
| cache-all-crates: false | |
| cache-workspace-crates: true | |
| cache-bin: false | |
| cache-on-failure: true | |
| save-if: true | |
| - name: Unit tests | |
| run: make ci-test-unit | |
| build: | |
| needs: [fmt, lint, unit-tests] | |
| runs-on: self-hosted | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: integration-${{ hashFiles('Cargo.lock', 'test-integration/Cargo.lock', 'rust-toolchain.toml', 'test-integration/rust-toolchain.toml') }} | |
| add-job-id-key: false | |
| add-rust-environment-hash-key: false | |
| workspaces: | | |
| . -> target | |
| test-integration -> target | |
| cache-targets: true | |
| cache-all-crates: false | |
| cache-workspace-crates: true | |
| cache-bin: false | |
| cache-on-failure: true | |
| save-if: true | |
| - name: Build project | |
| run: cargo build --locked | |
| - name: Prebuild integration test binaries | |
| working-directory: test-integration | |
| run: cargo test --workspace --locked --no-run | |
| - name: Build SBF programs | |
| env: | |
| RUSTFLAGS: "" | |
| run: | | |
| make -C test-integration programs | |
| make chainlink-prep-programs -C test-integration/test-chainlink | |
| - name: Pack only SBF artifacts | |
| run: | | |
| set -euo pipefail | |
| mkdir -p ci-artifacts/test-integration-deploy | |
| mkdir -p ci-artifacts/root-deploy | |
| mkdir -p ci-artifacts/chainlink-artifacts | |
| if [ -d "test-integration/target/deploy" ]; then | |
| find test-integration/target/deploy -mindepth 1 -maxdepth 1 -exec cp -r {} ci-artifacts/test-integration-deploy/ \; | |
| else | |
| echo "::warning::test-integration/target/deploy not found" | |
| fi | |
| if [ -d "target/deploy" ]; then | |
| find target/deploy -mindepth 1 -maxdepth 1 -exec cp -r {} ci-artifacts/root-deploy/ \; | |
| else | |
| echo "::warning::target/deploy not found" | |
| fi | |
| if [ -d "test-integration/test-chainlink/target/deploy" ]; then | |
| find test-integration/test-chainlink/target/deploy -mindepth 1 -maxdepth 1 -exec cp -r {} ci-artifacts/chainlink-artifacts/ \; | |
| else | |
| echo "::warning::test-integration/test-chainlink/target/deploy not found" | |
| fi | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: sbf-artifacts-${{ github.sha }} | |
| path: ci-artifacts | |
| if-no-files-found: warn | |
| retention-days: 3 | |
| integration-tests: | |
| needs: build | |
| runs-on: self-hosted | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| test: | |
| - schedulecommit | |
| - chainlink | |
| - cloning | |
| - restore_ledger | |
| - magicblock_api | |
| - config | |
| - table_mania | |
| - committor | |
| - pubsub | |
| - schedule_intents | |
| - task-scheduler | |
| name: "Integration: ${{ matrix.test }}" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: integration-${{ hashFiles('Cargo.lock', 'test-integration/Cargo.lock', 'rust-toolchain.toml', 'test-integration/rust-toolchain.toml') }} | |
| add-job-id-key: false | |
| add-rust-environment-hash-key: false | |
| workspaces: | | |
| . -> target | |
| test-integration -> target | |
| cache-targets: true | |
| cache-all-crates: false | |
| cache-workspace-crates: true | |
| cache-bin: false | |
| cache-on-failure: true | |
| save-if: false | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: sbf-artifacts-${{ github.sha }} | |
| path: ci-artifacts | |
| - name: Restore SBF artifacts only | |
| run: | | |
| set -euo pipefail | |
| mkdir -p test-integration/target/deploy | |
| mkdir -p target/deploy | |
| mkdir -p test-integration/test-chainlink/target/deploy | |
| if [ -d "ci-artifacts/test-integration-deploy" ]; then | |
| find ci-artifacts/test-integration-deploy -mindepth 1 -maxdepth 1 -exec cp -r {} test-integration/target/deploy/ \; | |
| find test-integration/target/deploy -type f -exec touch {} + | |
| else | |
| echo "::warning::No cached test-integration deploy artifacts found" | |
| fi | |
| if [ -d "ci-artifacts/root-deploy" ]; then | |
| find ci-artifacts/root-deploy -mindepth 1 -maxdepth 1 -exec cp -r {} target/deploy/ \; | |
| find target/deploy -type f -exec touch {} + | |
| else | |
| echo "::warning::No cached root deploy artifacts found" | |
| fi | |
| if [ -d "ci-artifacts/chainlink-artifacts" ]; then | |
| find ci-artifacts/chainlink-artifacts -mindepth 1 -maxdepth 1 -exec cp -r {} test-integration/test-chainlink/target/deploy/ \; | |
| find test-integration/test-chainlink/target/deploy -type f -exec touch {} + | |
| else | |
| echo "::warning::No cached chainlink deploy artifacts found" | |
| fi | |
| - name: Run integration test | |
| env: | |
| RUN_TESTS: ${{ matrix.test }} | |
| SKIP_CHAINLINK_PREP: "1" | |
| PROGRAMS_SO: "" | |
| RUSTFLAGS: "" | |
| run: make ci-test-integration | |
| ci-status: | |
| if: always() | |
| needs: [fmt, lint, unit-tests, build, integration-tests] | |
| runs-on: self-hosted | |
| steps: | |
| - name: Verify pipeline | |
| run: | | |
| results=( | |
| "${{ needs.fmt.result }}" | |
| "${{ needs.lint.result }}" | |
| "${{ needs.unit-tests.result }}" | |
| "${{ needs.build.result }}" | |
| "${{ needs.integration-tests.result }}" | |
| ) | |
| for r in "${results[@]}"; do | |
| if [[ "$r" != "success" ]]; then | |
| echo "::error::CI failed" | |
| exit 1 | |
| fi | |
| done | |
| echo "All checks passed." |