Skip to content

Commit c313d87

Browse files
authored
Merge pull request #10587 from Turbo87/ci-caching
CI: Fix caching
2 parents 0241fd3 + 37d7b8a commit c313d87

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ jobs:
106106
- run: rustup component add clippy
107107

108108
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
109+
with:
110+
save-if: ${{ github.ref == 'refs/heads/main' }}
109111

110112
- run: cargo fmt --check --all
111113
- run: cargo clippy --all-targets --all-features --workspace
@@ -133,6 +135,8 @@ jobs:
133135
persist-credentials: false
134136

135137
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
138+
with:
139+
save-if: ${{ github.ref == 'refs/heads/main' }}
136140

137141
- run: cargo install cargo-deny --vers ${CARGO_DENY_VERSION}
138142
- run: cargo deny check
@@ -151,30 +155,24 @@ jobs:
151155
TEST_DATABASE_URL: postgres://postgres:postgres@localhost/postgres
152156
RUSTFLAGS: "-D warnings -Cinstrument-coverage"
153157
MALLOC_CONF: "background_thread:true,abort_conf:true,abort:true,junk:true"
154-
CARGO_TARGET_DIR: /mnt/target
155158

156159
steps:
157160
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
158161
with:
159162
persist-credentials: false
160163

164+
# Remove the Android SDK to free up space
165+
- run: sudo rm -rf /usr/local/lib/android
166+
161167
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
162168
with:
163-
# Ensure that we cache from the right target directory. (See below
164-
# for the details of how and when this gets created.)
165-
workspaces: '. -> ${{ env.CARGO_TARGET_DIR }}'
169+
save-if: ${{ github.ref == 'refs/heads/main' }}
166170

167171
# Update `pg_dump` to the same version as the running PostgreSQL server
168172
- run: sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -v ${POSTGRES_VERSION} -i -p
169173
- run: sudo systemctl start postgresql.service
170174
- run: sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'postgres'"
171175

172-
# Create a working directory on /mnt, which is a larger temporary
173-
# filesystem than /, that we can then point our later commands to.
174-
- run: |
175-
sudo mkdir ${CARGO_TARGET_DIR}
176-
sudo chown $(id -u):$(id -g) ${CARGO_TARGET_DIR}
177-
178176
- run: cargo build --tests --workspace
179177
- run: cargo test --workspace
180178

0 commit comments

Comments
 (0)