@@ -30,25 +30,18 @@ jobs:
3030 shared-key : ${{ runner.os }}
3131
3232 - name : Install nextest
33- uses : taiki-e/ install-action@ nextest
33+ run : cargo install cargo- nextest --locked
3434
35- - name : Build
36- run : cargo build --verbose
37-
38- - name : Run unit tests
39- run : cargo nextest run --profile ci --lib --verbose
40-
41- - name : Run smoke tests
42- run : cargo nextest run --profile ci --test smoke_test --verbose
43-
44- - name : Run script integration tests
45- run : cargo nextest run --profile ci --test script_integration --verbose
46-
47- - name : Run weak mode integration tests
35+ - name : Build httpjail binary
4836 run : |
49- # On macOS, we only support weak mode due to PF limitations
50- # (PF translation rules cannot match on user/group)
51- cargo nextest run --profile ci --test weak_integration --verbose
37+ cargo build --bin httpjail --target-dir target
38+ export HTTPJAIL_BIN="$(pwd)/target/debug/httpjail"
39+ echo "Binary built at: ${HTTPJAIL_BIN}"
40+ ls -la "${HTTPJAIL_BIN}"
41+ echo "HTTPJAIL_BIN=${HTTPJAIL_BIN}" >> $GITHUB_ENV
42+
43+ - name : Run all tests
44+ run : cargo nextest run --profile ci
5245
5346 test-linux :
5447 name : Linux Tests
@@ -92,76 +85,43 @@ jobs:
9285 - name : Setup Rust environment and install nextest
9386 run : |
9487 source ~/.cargo/env
88+ rustup default stable
89+ cargo install cargo-nextest || true
9590
96- # Install nextest if not already present
97- if ! command -v cargo-nextest &> /dev/null; then
98- cargo install cargo-nextest --locked
91+ - name : Fix target directory permissions from previous runs
92+ run : |
93+ if [ -d target ]; then
94+ sudo chown -R ci:ci target || true
9995 fi
10096
101- - name : Build
97+ - name : Build httpjail binary
10298 run : |
10399 source ~/.cargo/env
104- # Use incremental compilation for faster builds
105- export CARGO_INCREMENTAL=1
106- cargo build --verbose
100+ cargo build --bin httpjail --target-dir target
101+ export HTTPJAIL_BIN="$(pwd)/target/debug/httpjail"
102+ echo "Binary built at: ${HTTPJAIL_BIN}"
103+ ls -la "${HTTPJAIL_BIN}"
104+ echo "HTTPJAIL_BIN=${HTTPJAIL_BIN}" >> $GITHUB_ENV
107105
108- - name : Run unit tests
106+ - name : Run all tests (non-root)
109107 run : |
110108 source ~/.cargo/env
111- cargo nextest run --profile ci --lib --verbose
109+ cargo nextest run --profile ci --verbose -E 'not (binary(linux_integration) or binary(weak_integration))'
112110
113- - name : Run smoke tests
114- run : |
115- source ~/.cargo/env
116- cargo nextest run --profile ci --test smoke_test --verbose
111+ - name : Install dependencies for weak mode (curl)
112+ run : sudo apt-get update && sudo apt-get install -y curl
117113
118- - name : Run script integration tests
114+ - name : Run weak mode integration tests (Linux)
119115 run : |
120116 source ~/.cargo/env
121- cargo nextest run --profile ci --test script_integration --verbose
117+ cargo nextest run --profile ci --test weak_integration
122118
123- - name : Run Linux jail integration tests
119+ - name : Run Linux jail integration tests (sudo)
124120 run : |
125121 source ~/.cargo/env
126- # Run all tests without CI workarounds since this is a self-hosted runner
122+ # Run Linux-specific jail tests with sudo to satisfy root requirements
127123 sudo -E $(which cargo) nextest run --profile ci --test linux_integration --verbose
128124
129- - name : Run isolated cleanup tests
130- run : |
131- source ~/.cargo/env
132- # Run only the comprehensive cleanup and sigint tests with the feature flag
133- # These tests need to run in isolation from other tests
134- sudo -E $(which cargo) test --test linux_integration --features isolated-cleanup-tests -- test_comprehensive_resource_cleanup test_cleanup_after_sigint
135-
136- test-weak :
137- name : Weak Mode Integration Tests (Linux)
138- runs-on : ubuntu-latest-8-cores
139-
140- steps :
141- - uses : actions/checkout@v4
142-
143- - name : Install Rust
144- uses : dtolnay/rust-toolchain@stable
145- with :
146- toolchain : stable
147-
148- - name : Setup Rust cache
149- uses : Swatinem/rust-cache@v2
150- with :
151- shared-key : ${{ runner.os }}
152-
153- - name : Install nextest
154- uses : taiki-e/install-action@nextest
155-
156- - name : Build
157- run : cargo build --verbose
158-
159- - name : Run script integration tests
160- run : cargo nextest run --profile ci --test script_integration --verbose
161-
162- - name : Run weak mode integration tests
163- run : cargo nextest run --profile ci --test weak_integration --verbose
164-
165125 clippy :
166126 name : Clippy (${{ matrix.os }})
167127 runs-on : ${{ matrix.os }}
0 commit comments