Skip to content

Commit 9b60f81

Browse files
authored
Merge pull request #10616 from Byron/fix
Enable more fine-grained caching for Rust enabled CI pipelines
2 parents ab37c0c + 55a5ee6 commit 9b60f81

File tree

2 files changed

+61
-40
lines changed

2 files changed

+61
-40
lines changed

.github/workflows/push.yaml

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,25 @@ jobs:
9494
needs: changes
9595
if: ${{ needs.changes.outputs.rust == 'true' }}
9696
runs-on: ubuntu-latest
97-
container:
98-
image: ghcr.io/gitbutlerapp/ci-base-image:latest
9997
env:
10098
CARGO_TERM_COLOR: always
10199
steps:
100+
- name: Rust Cache
101+
uses: Swatinem/[email protected]
102+
with:
103+
shared-key: rust-lint
104+
save-if: ${{ github.ref == 'refs/heads/master' }}
102105
- uses: actions/checkout@v5
103106
with:
104107
persist-credentials: false
108+
- run: sudo scripts/install-debian-dependencies.sh
109+
name: Install Dependencies
105110
- run: cargo fmt --check --all
106111
- run: cargo check --workspace --all-targets
112+
- name: cargo clippy
113+
run: |
114+
rustup component add clippy
115+
cargo clippy --workspace --all-targets -- -D warnings
107116
108117
rust-but-binary-no-tauri:
109118
needs: changes
@@ -112,6 +121,11 @@ jobs:
112121
env:
113122
CARGO_TERM_COLOR: always
114123
steps:
124+
- name: Rust Cache
125+
uses: Swatinem/[email protected]
126+
with:
127+
shared-key: rust-but-binary
128+
save-if: ${{ github.ref == 'refs/heads/master' }}
115129
- uses: actions/checkout@v5
116130
with:
117131
persist-credentials: false
@@ -124,16 +138,19 @@ jobs:
124138
needs: changes
125139
if: ${{ needs.changes.outputs.rust == 'true' }}
126140
runs-on: ubuntu-latest
127-
container:
128-
image: ghcr.io/gitbutlerapp/ci-base-image:latest
129141
env:
130142
CARGO_TERM_COLOR: always
131143
steps:
132144
- uses: actions/checkout@v5
133145
with:
134146
persist-credentials: false
135-
# TODO(qix-): we have to exclude the app here for now because for some
136-
# TODO(qix-): reason it doesn't build with the docs feature enabled.
147+
- name: Rust Cache
148+
uses: Swatinem/[email protected]
149+
with:
150+
shared-key: rust-docs
151+
save-if: ${{ github.ref == 'refs/heads/master' }}
152+
- run: sudo scripts/install-debian-dependencies.sh
153+
name: Install Dependencies
137154
- run: cargo doc --no-deps --all-features --document-private-items -p gitbutler-git
138155
env:
139156
RUSTDOCFLAGS: -Dwarnings
@@ -166,29 +183,15 @@ jobs:
166183
- name: Rust Cache
167184
uses: Swatinem/[email protected]
168185
with:
169-
shared-key: unix-rust-testing-v2
170-
- run: |
171-
sudo apt update
172-
sudo apt install libwebkit2gtk-4.1-dev \
173-
build-essential \
174-
curl \
175-
wget \
176-
file \
177-
libxdo-dev \
178-
libssl-dev \
179-
libayatana-appindicator3-dev \
180-
librsvg2-dev \
181-
cmake
186+
shared-key: rust-testing
187+
save-if: ${{ github.ref == 'refs/heads/master' }}
188+
- run: sudo scripts/install-debian-dependencies.sh
182189
name: Install Dependencies
183190
- run: |
184191
cargo test --workspace
185192
env:
186193
GITBUTLER_TESTS_NO_CLEANUP: '1'
187194
name: cargo test
188-
- run: |
189-
rustup component add clippy
190-
cargo clippy --workspace --all-targets -- -D warnings
191-
name: cargo clippy
192195
- run: |
193196
set -e
194197
cargo check -p gitbutler-tauri --no-default-features
@@ -197,6 +200,24 @@ jobs:
197200
done
198201
name: Check Tauri App
199202
203+
check-rust-windows:
204+
needs: changes
205+
runs-on: windows-latest
206+
if: ${{ needs.changes.outputs.rust == 'true' }}
207+
env:
208+
CARGO_TERM_COLOR: always
209+
steps:
210+
- uses: actions/checkout@v5
211+
with:
212+
persist-credentials: false
213+
- name: Rust Cache
214+
uses: Swatinem/[email protected]
215+
with:
216+
shared-key: rust-testing
217+
save-if: ${{ github.ref == 'refs/heads/master' }}
218+
- name: 'cargo check'
219+
run: cargo check --workspace --all-targets --features windows
220+
200221
check-rust:
201222
if: always()
202223
needs:
@@ -214,23 +235,6 @@ jobs:
214235
allowed-skips: ${{ toJSON(needs) }}
215236
jobs: ${{ toJSON(needs) }}
216237

217-
check-rust-windows:
218-
needs: changes
219-
runs-on: windows-latest
220-
if: ${{ needs.changes.outputs.rust == 'true' }}
221-
env:
222-
CARGO_TERM_COLOR: always
223-
steps:
224-
- uses: actions/checkout@v5
225-
with:
226-
persist-credentials: false
227-
- name: Rust Cache
228-
uses: Swatinem/[email protected]
229-
with:
230-
shared-key: windows-rust-testing
231-
- name: 'cargo check'
232-
run: cargo check --workspace --all-targets --features windows
233-
234238
# Check that all `actions/checkout` in CI jobs have `persist-credentials: false`.
235239
check-no-persist-credentials:
236240
runs-on: ubuntu-latest
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
set -eu -o pipefail
4+
5+
# Install the dependencies needed to build tauri, mainly.
6+
7+
apt update
8+
apt install libwebkit2gtk-4.1-dev \
9+
build-essential \
10+
curl \
11+
wget \
12+
file \
13+
libxdo-dev \
14+
libssl-dev \
15+
libayatana-appindicator3-dev \
16+
librsvg2-dev \
17+
cmake

0 commit comments

Comments
 (0)