-
Notifications
You must be signed in to change notification settings - Fork 38
chore: CI on self-hosted runner #975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lucacillario
wants to merge
59
commits into
master
Choose a base branch
from
chore/improve-ci
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
4db251b
ci
lucacillario f77c101
deleted old workflows
lucacillario 2622c4f
fix unit
lucacillario b68905b
debug
lucacillario f16e7b4
debug
lucacillario 50674fb
debug
lucacillario e51a8ee
debug
lucacillario e10e4ef
debug
lucacillario ffdf3c6
debug
lucacillario e12e0cd
debug
lucacillario bc764dc
debug
lucacillario 49886ec
debug
lucacillario ce52d97
debug
lucacillario ec96e8e
debug
lucacillario e92e1ae
debug
lucacillario 110014d
debug
lucacillario 9623924
debug
lucacillario 8f63fdd
debug
lucacillario b6c51ee
debug
lucacillario f1ddfbd
debug
lucacillario b55967e
debug
lucacillario 1b30d29
debug
lucacillario 785d190
debug
lucacillario 794fe35
debug
lucacillario 594d556
debig
lucacillario da06109
debug
lucacillario 512b041
debug
lucacillario 90fb8cf
debug
lucacillario 4b77c42
debug
lucacillario 3ca2026
debug
lucacillario 19e6706
debug
lucacillario 6da3f61
debug
lucacillario 18e1f3d
debug
lucacillario 1970d40
debug
lucacillario c90a5e3
debug
lucacillario 0294544
debug
lucacillario 4c4894e
debug
lucacillario 511f67f
debug
lucacillario 731563d
debug
lucacillario 6f5080b
debug
lucacillario 30848ae
debug
lucacillario c8f2ae5
debug
lucacillario a8c4f7c
debug
lucacillario 8249172
improve
lucacillario ffd430d
improve
lucacillario 02fa791
improve
lucacillario 56edf7e
code clean up
lucacillario 25d0221
fix bug with mold linker
lucacillario cb0dc52
fix bug
lucacillario 90d3847
fix remotes
lucacillario 71038f6
fix lificycle in test
lucacillario 04ed7ea
add cargo test --manifest-path test-integration/Cargo.toml --workspac…
lucacillario a095d83
reverted cargo build workspace
lucacillario bf9032e
update ci trigger
lucacillario 0e3ef7e
address code rabbit comments
lucacillario c283b9f
updated trigger
lucacillario d8e33e1
removed ready_for_reviews trigger
lucacillario eae01ba
Merge branch 'master' into chore/improve-ci
GabrielePicco b326a8f
remove ignore flag from ledger flaky test
lucacillario File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,174 @@ | ||
| name: CI | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} | ||
| cancel-in-progress: true | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master, dev] | ||
| pull_request: | ||
| types: [opened, reopened, synchronize] | ||
|
|
||
| jobs: | ||
| prepare-env: | ||
| runs-on: self-hosted | ||
| outputs: | ||
| target_dir: ${{ steps.calc.outputs.dir }} | ||
| steps: | ||
| - id: calc | ||
| env: | ||
| REF_NAME: ${{ github.ref_name }} | ||
| REPO_NAME: ${{ github.event.repository.name }} | ||
| run: | | ||
| SAFE_BRANCH=$(echo "$REF_NAME" | tr '/' '-') | ||
| TARGET_DIR="/var/lib/gh-runners/global-targets/${REPO_NAME}-${SAFE_BRANCH}" | ||
| mkdir -p "$TARGET_DIR" | ||
| echo "dir=$TARGET_DIR" >> $GITHUB_OUTPUT | ||
|
|
||
| build: | ||
| needs: prepare-env | ||
| runs-on: self-hosted | ||
| env: | ||
| CARGO_TARGET_DIR: ${{ needs.prepare-env.outputs.target_dir }} | ||
| CARGO_INCREMENTAL: 1 | ||
| CARGO_BUILD_JOBS: 30 | ||
| RUSTFLAGS: -C link-arg=-fuse-ld=mold | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| submodules: recursive | ||
lucacillario marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: Build SBF programs | ||
| env: | ||
| RUSTFLAGS: "" | ||
| run: | | ||
| ( | ||
| unset CARGO_TARGET_DIR | ||
| make -C test-integration programs | ||
| make chainlink-prep-programs -C test-integration/test-chainlink | ||
| ) | ||
|
|
||
| - name: Build binaries and tests | ||
| run: cargo build --bins --tests --locked | ||
|
|
||
| - name: Format check | ||
| run: make ci-fmt | ||
|
|
||
| - name: Lint | ||
| run: make ci-lint | ||
|
|
||
| - name: Unit tests | ||
| run: make ci-test-unit | ||
|
|
||
| - name: Pre-fetch integration test dependencies | ||
| run: cargo test --test '*' --no-run | ||
|
|
||
| - name: Cache SBF artifacts | ||
| run: | | ||
| SBF_CACHE_DIR="$CARGO_TARGET_DIR/sbf-artifacts" | ||
| mkdir -p "$SBF_CACHE_DIR/test-integration" "$SBF_CACHE_DIR/root" | ||
|
|
||
| if [ -d "test-integration/target/deploy" ]; then | ||
| find test-integration/target/deploy -mindepth 1 -maxdepth 1 -exec cp -r {} "$SBF_CACHE_DIR/test-integration/" \; | ||
| else | ||
| echo "::warning::test-integration/target/deploy not found" | ||
| fi | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if ls target/deploy/*.so >/dev/null 2>&1; then | ||
| cp target/deploy/*.so "$SBF_CACHE_DIR/root/" | ||
| else | ||
| echo "::warning::No SBF artifacts found in target/deploy" | ||
| fi | ||
|
|
||
| integration-tests: | ||
| needs: [prepare-env, build] | ||
| runs-on: self-hosted | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| batch: | ||
| - "committor config" | ||
| - "restore_ledger schedulecommit" | ||
| - "table_mania cloning" | ||
| - "magicblock_api schedule_intents" | ||
| - "task-scheduler chainlink pubsub" | ||
| env: | ||
| TMPDIR: /dev/shm | ||
| CARGO_NET_OFFLINE: "true" | ||
| CARGO_BUILD_JOBS: 6 | ||
| NEXTEST_RETRIES: 0 | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Restore source file timestamps | ||
| run: git restore-mtime | ||
lucacillario marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: Link pre-built artifacts | ||
| run: | | ||
| GLOBAL_TARGET="${{ needs.prepare-env.outputs.target_dir }}" | ||
| mkdir -p target | ||
|
|
||
| if ! cp -rl "$GLOBAL_TARGET/debug" target/ 2>/dev/null; then | ||
| echo "::warning::Hardlink failed (cross-device?), falling back to copy" | ||
| cp -r "$GLOBAL_TARGET/debug" target/ | ||
| fi | ||
lucacillario marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| rm -rf target/debug/incremental | ||
|
|
||
| - name: Restore SBF artifacts | ||
| run: | | ||
| SBF_CACHE_DIR="${{ needs.prepare-env.outputs.target_dir }}/sbf-artifacts" | ||
|
|
||
| LOCAL_DEPLOY_TEST="test-integration/target/deploy" | ||
| mkdir -p "$LOCAL_DEPLOY_TEST" | ||
| if [ -d "$SBF_CACHE_DIR/test-integration" ]; then | ||
| find "$SBF_CACHE_DIR/test-integration" -mindepth 1 -maxdepth 1 -exec cp -r {} "$LOCAL_DEPLOY_TEST/" \; | ||
| find "$LOCAL_DEPLOY_TEST" -type f -exec touch {} + | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| else | ||
| echo "::warning::No cached SBF artifacts for test-integration" | ||
| fi | ||
|
|
||
| LOCAL_DEPLOY_ROOT="target/deploy" | ||
| mkdir -p "$LOCAL_DEPLOY_ROOT" | ||
| if ls "$SBF_CACHE_DIR/root"/*.so >/dev/null 2>&1; then | ||
| cp "$SBF_CACHE_DIR/root"/*.so "$LOCAL_DEPLOY_ROOT/" | ||
| touch "$LOCAL_DEPLOY_ROOT"/*.so | ||
| else | ||
| echo "::warning::No cached SBF artifacts for root" | ||
| fi | ||
|
|
||
| - name: "Integration: ${{ matrix.batch }}" | ||
| env: | ||
| TEST_BATCH: ${{ matrix.batch }} | ||
| run: | | ||
| unshare -r -n bash -c ' | ||
| set -euo pipefail | ||
| ip link set lo up | ||
| FAILED="" | ||
| for test in $TEST_BATCH; do | ||
| echo "========== Running: $test ==========" | ||
| if ! RUN_TESTS=$test make ci-test-integration PROGRAMS_SO= SKIP_CHAINLINK_PREP=1; then | ||
| FAILED="$FAILED $test" | ||
| fi | ||
| done | ||
| if [ -n "$FAILED" ]; then | ||
| echo "::error::Failed test suites:$FAILED" | ||
| exit 1 | ||
| fi | ||
| ' | ||
|
|
||
| ci-status: | ||
| if: always() | ||
| needs: [build, integration-tests] | ||
| runs-on: self-hosted | ||
| steps: | ||
| - name: Verify pipeline status | ||
| run: | | ||
| if [[ "${{ needs.build.result }}" != "success" || | ||
| "${{ needs.integration-tests.result }}" != "success" ]]; then | ||
| echo "::error::CI failed" | ||
| exit 1 | ||
| fi | ||
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.