1515jobs :
1616 lint :
1717 runs-on : ubuntu-latest
18+ env :
19+ CARGO_TARGET_DIR : target/ci/lint
1820 steps :
1921 - name : Checkout
2022 uses : actions/checkout@v4
3032 path : |
3133 ~/.cargo/registry
3234 ~/.cargo/git
33- target
35+ target/ci/lint
3436 key : ${{ runner.os }}-lint-cargo-${{ hashFiles('**/Cargo.lock') }}
3537 restore-keys : |
3638 ${{ runner.os }}-lint-cargo-
4951 tests :
5052 runs-on : ubuntu-latest
5153 needs : lint
54+ env :
55+ CARGO_TARGET_DIR : target/ci/tests-${{ matrix.php }}
5256 strategy :
5357 fail-fast : false
5458 matrix :
8286 path : |
8387 ~/.cargo/registry
8488 ~/.cargo/git
85- target
86- key : ${{ runner.os }}-tests-cargo-${{ hashFiles('**/Cargo.lock') }}
89+ target/ci/tests-${{ matrix.php }}
90+ key : ${{ runner.os }}-tests-${{ matrix.php }}- cargo-${{ hashFiles('**/Cargo.lock') }}
8791 restore-keys : |
92+ ${{ runner.os }}-tests-${{ matrix.php }}-cargo-
8893 ${{ runner.os }}-tests-cargo-
8994
9095 - name : Cache Composer
@@ -120,6 +125,8 @@ jobs:
120125 build-linux :
121126 runs-on : ubuntu-latest
122127 needs : tests
128+ env :
129+ CARGO_TARGET_DIR : target/ci/build-linux-${{ matrix.php }}
123130 strategy :
124131 fail-fast : false
125132 matrix :
@@ -153,9 +160,10 @@ jobs:
153160 path : |
154161 ~/.cargo/registry
155162 ~/.cargo/git
156- target
157- key : ${{ runner.os }}-build-linux-cargo-${{ hashFiles('**/Cargo.lock') }}
163+ target/ci/build-linux-${{ matrix.php }}
164+ key : ${{ runner.os }}-build-linux-${{ matrix.php }}- cargo-${{ hashFiles('**/Cargo.lock') }}
158165 restore-keys : |
166+ ${{ runner.os }}-build-linux-${{ matrix.php }}-cargo-
159167 ${{ runner.os }}-build-linux-cargo-
160168
161169 - name : Cargo build (release)
@@ -168,8 +176,13 @@ jobs:
168176 mkdir -p dist
169177 ref="${GITHUB_REF_NAME:-$GITHUB_SHA}"
170178 short="${ref:0:7}"
179+ artifact_path="${CARGO_TARGET_DIR}/release/librabbit_rs.so"
180+ if [ ! -f "${artifact_path}" ]; then
181+ echo "Artifact not found at ${artifact_path}" >&2
182+ exit 1
183+ fi
171184 scripts/package-extension.sh \
172- "target/release/librabbit_rs.so " \
185+ "${artifact_path} " \
173186 "${{ matrix.php }}" \
174187 "linux-gnu-$(uname -m)" \
175188 "${short}" \
@@ -184,6 +197,8 @@ jobs:
184197 build-macos :
185198 runs-on : macos-14
186199 needs : tests
200+ env :
201+ CARGO_TARGET_DIR : target/ci/build-macos-${{ matrix.php }}
187202 strategy :
188203 fail-fast : false
189204 matrix :
@@ -214,9 +229,10 @@ jobs:
214229 path : |
215230 ~/.cargo/registry
216231 ~/.cargo/git
217- target
218- key : ${{ runner.os }}-build-macos-cargo-${{ hashFiles('**/Cargo.lock') }}
232+ target/ci/build-macos-${{ matrix.php }}
233+ key : ${{ runner.os }}-build-macos-${{ matrix.php }}- cargo-${{ hashFiles('**/Cargo.lock') }}
219234 restore-keys : |
235+ ${{ runner.os }}-build-macos-${{ matrix.php }}-cargo-
220236 ${{ runner.os }}-build-macos-cargo-
221237
222238 - name : Cargo build (release)
@@ -229,8 +245,13 @@ jobs:
229245 mkdir -p dist
230246 ref="${GITHUB_REF_NAME:-$GITHUB_SHA}"
231247 short="${ref:0:7}"
248+ artifact_path="${CARGO_TARGET_DIR}/release/librabbit_rs.dylib"
249+ if [ ! -f "${artifact_path}" ]; then
250+ echo "Artifact not found at ${artifact_path}" >&2
251+ exit 1
252+ fi
232253 scripts/package-extension.sh \
233- "target/release/librabbit_rs.dylib " \
254+ "${artifact_path} " \
234255 "${{ matrix.php }}" \
235256 "darwin-$(uname -m)" \
236257 "${short}" \
0 commit comments