ci(release): reuse dev-fast build for tests and cleanup target

This commit is contained in:
James Peter
2025-10-06 18:14:50 +10:00
parent c71c5cbb32
commit e53db0d243
2 changed files with 39 additions and 6 deletions
+22 -5
View File
@@ -28,6 +28,8 @@ jobs:
preflight-tests:
name: Preflight Tests (Linux fast E2E)
runs-on: ubuntu-24.04
env:
CARGO_TARGET_DIR: /home/runner/.cargo-target
steps:
- name: Checkout code
uses: actions/checkout@v4
@@ -46,18 +48,22 @@ jobs:
shared-key: code-preflight-1.90
workspaces: |
code-rs -> target
cache-targets: true
cache-targets: false
cache-workspace-crates: true
cache-on-failure: true
cache-on-failure: false
- name: Build (fast profile)
- name: Build CLI (dev-fast)
shell: bash
run: ./build-fast.sh
run: |
set -euo pipefail
cd code-rs
cargo build --locked --profile dev-fast --bin code
- name: CLI smokes (skip duplicated cargo tests)
shell: bash
env:
SKIP_CARGO_TESTS: "1"
CI_CLI_BIN: ${{ env.CARGO_TARGET_DIR }}/dev-fast/code
run: bash scripts/ci-tests.sh
- name: Install cargo-nextest
@@ -69,7 +75,18 @@ jobs:
shell: bash
run: |
cd code-rs
cargo nextest run --no-fail-fast
cargo nextest run --no-fail-fast --cargo-args "--profile dev-fast --locked"
- name: Free disk after tests
if: always()
shell: bash
run: |
echo "Disk usage before cleanup" && df -h
rm -rf ~/.cache/sccache || true
rm -rf ~/.cargo/registry/index || true
rm -rf ~/.cargo/git/db || true
rm -rf "$CARGO_TARGET_DIR" || true
echo "Disk usage after cleanup" && df -h
determine-version:
name: Determine Version
+17 -1
View File
@@ -16,7 +16,23 @@ fi
echo "[ci-tests] CLI smokes with host binary..."
BIN=./code-rs/target/dev-fast/code
BIN="${CI_CLI_BIN:-}"
if [[ -z "${BIN}" ]]; then
if [[ -x ./code-rs/target/dev-fast/code ]]; then
BIN=./code-rs/target/dev-fast/code
elif [[ -x ./code-rs/target/debug/code ]]; then
BIN=./code-rs/target/debug/code
fi
fi
if [[ -z "${BIN}" || ! -x "${BIN}" ]]; then
echo "[ci-tests] CLI binary not found; building debug binary..."
pushd code-rs >/dev/null
cargo build --bin code -q
popd >/dev/null
BIN=./code-rs/target/debug/code
fi
"${BIN}" --version >/dev/null
"${BIN}" completion bash >/dev/null
"${BIN}" doctor >/dev/null || true