@@ -55,55 +55,81 @@ jobs:
5555 # Use GITHUB_WORKSPACE parent directory or current working directory
5656 WORK_DIR="${GITHUB_WORKSPACE:-$(pwd)}"
5757 if [ -d "$WORK_DIR" ]; then
58- sudo chown -R $(whoami):$(whoami) "$WORK_DIR" || true
58+ sudo chown -R ci:ci "$WORK_DIR" || true
59+ fi
60+ # Ensure cargo cache has correct permissions
61+ if [ -d /home/ci/.cargo ]; then
62+ sudo chown -R ci:ci /home/ci/.cargo || true
5963 fi
60-
6164 - uses : actions/checkout@v4
6265
6366 - name : Fix permissions on current directory
6467 run : |
6568 # Clean up any files left from previous sudo runs
6669 if [ -d target ]; then
67- sudo chown -R $(whoami):$(whoami) target || true
70+ sudo chown -R ci:ci target || true
6871 fi
69- if [ -d ~/.cargo/registry ]; then
70- sudo chown -R $(whoami):$(whoami) ~/.cargo/registry || true
72+ # Fix cargo registry permissions to enable cache reuse
73+ if [ -d /home/ci/.cargo/registry ]; then
74+ sudo chown -R ci:ci /home/ci/.cargo/registry || true
75+ fi
76+ # Ensure git index cache has correct permissions
77+ if [ -d /home/ci/.cargo/git ]; then
78+ sudo chown -R ci:ci /home/ci/.cargo/git || true
7179 fi
7280
73- - name : Install nextest
81+ - name : Setup Rust environment and install nextest
7482 run : |
75- source ~/.cargo/env
83+ # Ensure we're using the ci user's cargo
84+ export PATH="/home/ci/.cargo/bin:$PATH"
85+ export CARGO_HOME="/home/ci/.cargo"
86+ export RUSTUP_HOME="/home/ci/.rustup"
87+
88+ # Install nextest if not already present
7689 if ! command -v cargo-nextest &> /dev/null; then
7790 cargo install cargo-nextest --locked
7891 fi
7992
8093 - name : Build
8194 run : |
82- source ~/.cargo/env
95+ export PATH="/home/ci/.cargo/bin:$PATH"
96+ export CARGO_HOME="/home/ci/.cargo"
97+ export RUSTUP_HOME="/home/ci/.rustup"
98+ # Use incremental compilation for faster builds
99+ export CARGO_INCREMENTAL=1
83100 cargo build --verbose
84101
85102 - name : Run unit tests
86103 run : |
87- source ~/.cargo/env
104+ export PATH="/home/ci/.cargo/bin:$PATH"
105+ export CARGO_HOME="/home/ci/.cargo"
106+ export RUSTUP_HOME="/home/ci/.rustup"
88107 cargo nextest run --profile ci --bins --verbose
89108
90109 - name : Run smoke tests
91110 run : |
92- source ~/.cargo/env
111+ export PATH="/home/ci/.cargo/bin:$PATH"
112+ export CARGO_HOME="/home/ci/.cargo"
113+ export RUSTUP_HOME="/home/ci/.rustup"
93114 cargo nextest run --profile ci --test smoke_test --verbose
94115
95116 - name : Run Linux jail integration tests
96117 run : |
97- source ~/.cargo/env
118+ export PATH="/home/ci/.cargo/bin:$PATH"
119+ export CARGO_HOME="/home/ci/.cargo"
120+ export RUSTUP_HOME="/home/ci/.rustup"
98121 # Run all tests without CI workarounds since this is a self-hosted runner
99- sudo -E $(which cargo) nextest run --profile ci --test linux_integration --verbose
122+ # Preserve environment for sudo to maintain cargo paths
123+ sudo -E PATH="$PATH" CARGO_HOME="$CARGO_HOME" RUSTUP_HOME="$RUSTUP_HOME" $(which cargo) nextest run --profile ci --test linux_integration --verbose
100124
101125 - name : Run isolated cleanup tests
102126 run : |
103- source ~/.cargo/env
127+ export PATH="/home/ci/.cargo/bin:$PATH"
128+ export CARGO_HOME="/home/ci/.cargo"
129+ export RUSTUP_HOME="/home/ci/.rustup"
104130 # Run only the comprehensive cleanup and sigint tests with the feature flag
105131 # These tests need to run in isolation from other tests
106- sudo -E $(which cargo) test --test linux_integration --features isolated-cleanup-tests -- test_comprehensive_resource_cleanup test_cleanup_after_sigint
132+ sudo -E PATH="$PATH" CARGO_HOME="$CARGO_HOME" RUSTUP_HOME="$RUSTUP_HOME" $(which cargo) test --test linux_integration --features isolated-cleanup-tests -- test_comprehensive_resource_cleanup test_cleanup_after_sigint
107133
108134 test-weak :
109135 name : Weak Mode Integration Tests (Linux)
0 commit comments