Skip to content

Commit 9650677

Browse files
committed
address code rabbit comments
1 parent 24f36f5 commit 9650677

4 files changed

Lines changed: 20 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ concurrency:
66

77
on:
88
push:
9-
branches: [master, dev]
9+
branches: [master, dev, chore/improve-ci]
1010
pull_request:
1111
types: [opened, reopened, synchronize, ready_for_review]
1212

@@ -17,9 +17,12 @@ jobs:
1717
target_dir: ${{ steps.calc.outputs.dir }}
1818
steps:
1919
- id: calc
20+
env:
21+
REF_NAME: ${{ github.ref_name }}
22+
REPO_NAME: ${{ github.event.repository.name }}
2023
run: |
21-
SAFE_BRANCH=$(echo "${{ github.ref_name }}" | tr '/' '-')
22-
TARGET_DIR="/var/lib/gh-runners/global-targets/${{ github.event.repository.name }}-${SAFE_BRANCH}"
24+
SAFE_BRANCH=$(echo "$REF_NAME" | tr '/' '-')
25+
TARGET_DIR="/var/lib/gh-runners/global-targets/${REPO_NAME}-${SAFE_BRANCH}"
2326
mkdir -p "$TARGET_DIR"
2427
echo "dir=$TARGET_DIR" >> $GITHUB_OUTPUT
2528
@@ -47,7 +50,7 @@ jobs:
4750
)
4851
4952
- name: Build binaries and tests
50-
run: cargo build --bins --tests
53+
run: cargo build --bins --tests --locked
5154

5255
- name: Format check
5356
run: make ci-fmt
@@ -67,7 +70,7 @@ jobs:
6770
mkdir -p "$SBF_CACHE_DIR/test-integration" "$SBF_CACHE_DIR/root"
6871
6972
if [ -d "test-integration/target/deploy" ]; then
70-
cp -r test-integration/target/deploy/* "$SBF_CACHE_DIR/test-integration/"
73+
find test-integration/target/deploy -mindepth 1 -maxdepth 1 -exec cp -r {} "$SBF_CACHE_DIR/test-integration/" \;
7174
else
7275
echo "::warning::test-integration/target/deploy not found"
7376
fi
@@ -122,7 +125,7 @@ jobs:
122125
LOCAL_DEPLOY_TEST="test-integration/target/deploy"
123126
mkdir -p "$LOCAL_DEPLOY_TEST"
124127
if [ -d "$SBF_CACHE_DIR/test-integration" ]; then
125-
cp -r "$SBF_CACHE_DIR/test-integration"/* "$LOCAL_DEPLOY_TEST/"
128+
find "$SBF_CACHE_DIR/test-integration" -mindepth 1 -maxdepth 1 -exec cp -r {} "$LOCAL_DEPLOY_TEST/" \;
126129
find "$LOCAL_DEPLOY_TEST" -type f -exec touch {} +
127130
else
128131
echo "::warning::No cached SBF artifacts for test-integration"
@@ -138,12 +141,14 @@ jobs:
138141
fi
139142
140143
- name: "Integration: ${{ matrix.batch }}"
144+
env:
145+
TEST_BATCH: ${{ matrix.batch }}
141146
run: |
142147
unshare -r -n bash -c '
143-
set -uo pipefail
148+
set -euo pipefail
144149
ip link set lo up
145150
FAILED=""
146-
for test in ${{ matrix.batch }}; do
151+
for test in $TEST_BATCH; do
147152
echo "========== Running: $test =========="
148153
if ! RUN_TESTS=$test make ci-test-integration PROGRAMS_SO= SKIP_CHAINLINK_PREP=1; then
149154
FAILED="$FAILED $test"

test-integration/test-runner/bin/run_tests.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,10 @@ fn run_test(
783783
"RUST_LOG",
784784
std::env::var("RUST_LOG").unwrap_or_else(|_| "info".to_string()),
785785
)
786-
.arg("test")
787-
.arg("--offline");
786+
.arg("test");
787+
if std::env::var("CARGO_NET_OFFLINE").as_deref() == Ok("true") {
788+
cmd.arg("--offline");
789+
}
788790
if let Some(package) = config.package {
789791
cmd.arg("-p").arg(package);
790792
}

test-integration/test-tools/src/toml_to_args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub fn config_to_args(
8989
let abs_config_dir = fs::canonicalize(config_dir).unwrap_or(config_dir.to_path_buf());
9090
eprintln!(
9191
"Error: Failed to resolve program path.\n\
92-
Config File: {:?}\n\
92+
Config Dir: {:?}\n\
9393
Relative Path: {:?}\n\
9494
Resolution Attempt: {:?}\n\
9595
OS Error: {:?}",

test-integration/test-tools/src/validator.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ pub fn start_magic_block_validator_with_config(
5252
// Fallback for local development
5353
let mut cmd = process::Command::new("cargo");
5454
cmd.arg("run")
55+
.arg("-p")
56+
.arg("magicblock-validator")
5557
.arg("--")
5658
.arg(config_path);
5759
cmd

0 commit comments

Comments
 (0)