Skip to content

Commit 96a1da5

Browse files
authored
Better DX: cargo green (#46)
* ran: cargo generate-lockfile Signed-off-by: Pierre Fenoll <[email protected]> * add clap Signed-off-by: Pierre Fenoll <[email protected]> * wip Signed-off-by: Pierre Fenoll <[email protected]> * it works! Signed-off-by: Pierre Fenoll <[email protected]> * lock Signed-off-by: Pierre Fenoll <[email protected]> * do the thing! Signed-off-by: Pierre Fenoll <[email protected]> * fix passing args through Signed-off-by: Pierre Fenoll <[email protected]> * ohwell Signed-off-by: Pierre Fenoll <[email protected]> * adapt ci Signed-off-by: Pierre Fenoll <[email protected]> * woops Signed-off-by: Pierre Fenoll <[email protected]> * ci: add cudeps job + show failing nightly support Signed-off-by: Pierre Fenoll <[email protected]> * fix dep issue (#49) * fix dep issue Signed-off-by: Pierre Fenoll <[email protected]> * fix formatting Signed-off-by: Pierre Fenoll <[email protected]> --------- Signed-off-by: Pierre Fenoll <[email protected]> * todo-s Signed-off-by: Pierre Fenoll <[email protected]> * more reliable way of getting cargo home Signed-off-by: Pierre Fenoll <[email protected]> * nit Signed-off-by: Pierre Fenoll <[email protected]> * ah Signed-off-by: Pierre Fenoll <[email protected]> --------- Signed-off-by: Pierre Fenoll <[email protected]>
1 parent 1e668ae commit 96a1da5

File tree

14 files changed

+617
-282
lines changed

14 files changed

+617
-282
lines changed

.github/workflows/clis.yml

Lines changed: 62 additions & 57 deletions
Large diffs are not rendered by default.

.github/workflows/self.yml

Lines changed: 93 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,21 @@ jobs:
3838
${{ runner.os }}-cargo-install-${{ hashFiles('**/Cargo.lock') }}-and-
3939
${{ runner.os }}-cargo-install-
4040
41-
- name: Compile HEAD
41+
- name: Compile HEAD cargo-green
42+
run: |
43+
CARGO_TARGET_DIR=~/instmp cargo install --locked --force --path=./cargo-green
44+
- name: Compile HEAD rustcbuildx
4245
run: |
4346
CARGO_TARGET_DIR=~/instmp cargo install --locked --force --path=./rustcbuildx
4447
- run: ls -lha ~/instmp/release/
4548
- run: ls -lha /home/runner/.cargo/bin/
4649

4750
- uses: actions/upload-artifact@v4
4851
with:
49-
name: bin-artifact
50-
path: /home/runner/.cargo/bin/rustcbuildx
52+
name: bin-artifacts
53+
path: |
54+
/home/runner/.cargo/bin/cargo-green
55+
/home/runner/.cargo/bin/rustcbuildx
5156
5257
5358
installs:
@@ -62,19 +67,20 @@ jobs:
6267
- name: Retrieve saved bin
6368
uses: actions/download-artifact@v4
6469
with:
65-
name: bin-artifact
70+
name: bin-artifacts
6671
- run: | # TODO: whence https://github.com/actions/download-artifact/issues/236
67-
chmod +x ./rustcbuildx
72+
chmod +x ./cargo-green ./rustcbuildx
6873
./rustcbuildx --version | grep rustcbuildx
6974
mv ./rustcbuildx /home/runner/.cargo/bin/
75+
mv ./cargo-green /home/runner/.cargo/bin/
76+
cargo green --version
7077
7178
- uses: actions/checkout@v4
7279

7380
- name: cargo install net=ON cache=OFF remote=OFF jobs=$(nproc)
7481
run: |
7582
RUSTCBUILDX_LOG=debug \
76-
RUSTC_WRAPPER=/home/runner/.cargo/bin/rustcbuildx \
77-
CARGO_TARGET_DIR=~/instst cargo -vv install --jobs=$(nproc) --locked --force --path=./rustcbuildx
83+
CARGO_TARGET_DIR=~/instst cargo green -vv install --jobs=$(nproc) --locked --force --path=./rustcbuildx
7884
7985
8086
audits:
@@ -89,11 +95,13 @@ jobs:
8995
- name: Retrieve saved bin
9096
uses: actions/download-artifact@v4
9197
with:
92-
name: bin-artifact
98+
name: bin-artifacts
9399
- run: | # TODO: whence https://github.com/actions/download-artifact/issues/236
94-
chmod +x ./rustcbuildx
100+
chmod +x ./cargo-green ./rustcbuildx
95101
./rustcbuildx --version | grep rustcbuildx
96102
mv ./rustcbuildx /home/runner/.cargo/bin/
103+
mv ./cargo-green /home/runner/.cargo/bin/
104+
cargo green --version
97105
98106
- uses: actions/checkout@v4
99107

@@ -122,8 +130,58 @@ jobs:
122130
run: |
123131
RUSTCBUILDX_LOG=debug \
124132
RUSTCBUILDX_LOG_PATH="$PWD"/logs.txt \
125-
RUSTC_WRAPPER=/home/runner/.cargo/bin/rustcbuildx \
126-
cargo -vv audit || \
133+
cargo green -vv audit || \
134+
cat logs.txt
135+
136+
137+
udeps:
138+
runs-on: ubuntu-latest
139+
needs: bin
140+
steps:
141+
- uses: actions-rs/toolchain@v1
142+
with:
143+
profile: minimal
144+
toolchain: nightly
145+
146+
- name: Retrieve saved bin
147+
uses: actions/download-artifact@v4
148+
with:
149+
name: bin-artifacts
150+
- run: | # TODO: whence https://github.com/actions/download-artifact/issues/236
151+
chmod +x ./cargo-green ./rustcbuildx
152+
./rustcbuildx --version | grep rustcbuildx
153+
mv ./rustcbuildx /home/runner/.cargo/bin/
154+
mv ./cargo-green /home/runner/.cargo/bin/
155+
cargo green --version
156+
157+
- uses: actions/checkout@v4
158+
159+
# Actually, the whole archives
160+
- name: Cache `cargo fetch`
161+
uses: actions/cache@v4
162+
with:
163+
path: |
164+
~/.cargo/registry/index/
165+
~/.cargo/registry/cache/
166+
~/.cargo/git/db/
167+
key: cargo-deps-${{ hashFiles('**/Cargo.lock') }}
168+
restore-keys: cargo-deps-
169+
170+
- name: Cache `cargo install`
171+
uses: actions/cache@v4
172+
with:
173+
path: ~/cargo-udeps
174+
key: ${{ runner.os }}-cargo-install-udeps
175+
176+
- name: Compile cargo-udeps
177+
run: |
178+
CARGO_TARGET_DIR=~/cargo-udeps cargo install --locked --force cargo-udeps
179+
180+
- name: cargo green +nightly udeps --all-targets net=ON cache=OFF remote=OFF
181+
run: |
182+
RUSTCBUILDX_LOG=debug \
183+
RUSTCBUILDX_LOG_PATH="$PWD"/logs.txt \
184+
cargo green +nightly udeps --all-targets || \
127185
cat logs.txt
128186
129187
@@ -139,11 +197,13 @@ jobs:
139197
- name: Retrieve saved bin
140198
uses: actions/download-artifact@v4
141199
with:
142-
name: bin-artifact
200+
name: bin-artifacts
143201
- run: | # TODO: whence https://github.com/actions/download-artifact/issues/236
144-
chmod +x ./rustcbuildx
202+
chmod +x ./cargo-green ./rustcbuildx
145203
./rustcbuildx --version | grep rustcbuildx
146204
mv ./rustcbuildx /home/runner/.cargo/bin/
205+
mv ./cargo-green /home/runner/.cargo/bin/
206+
cargo green --version
147207
148208
- uses: actions/checkout@v4
149209

@@ -163,8 +223,7 @@ jobs:
163223
run: |
164224
RUSTCBUILDX_LOG=debug \
165225
RUSTCBUILDX_LOG_PATH="$PWD"/logs.txt \
166-
RUSTC_WRAPPER=/home/runner/.cargo/bin/rustcbuildx \
167-
cargo -vv build --jobs=$(nproc) --all-targets --all-features --locked --frozen --offline
226+
cargo green -vv build --jobs=$(nproc) --all-targets --all-features --locked --frozen --offline
168227
169228
- if: ${{ failure() || success() }}
170229
run: cat logs.txt && echo >logs.txt
@@ -174,8 +233,7 @@ jobs:
174233
run: |
175234
RUSTCBUILDX_LOG=debug \
176235
RUSTCBUILDX_LOG_PATH="$PWD"/logs.txt \
177-
RUSTC_WRAPPER=/home/runner/.cargo/bin/rustcbuildx \
178-
cargo -vv build --jobs=1 --all-targets --all-features --locked --frozen --offline 2>&1 | tee _
236+
cargo green -vv build --jobs=1 --all-targets --all-features --locked --frozen --offline 2>&1 | tee _
179237
cat _ | grep Finished | grep 0...s
180238
cat _ | grep Fresh
181239
! cat _ | grep Compiling
@@ -197,11 +255,13 @@ jobs:
197255
- name: Retrieve saved bin
198256
uses: actions/download-artifact@v4
199257
with:
200-
name: bin-artifact
258+
name: bin-artifacts
201259
- run: | # TODO: whence https://github.com/actions/download-artifact/issues/236
202-
chmod +x ./rustcbuildx
260+
chmod +x ./cargo-green ./rustcbuildx
203261
./rustcbuildx --version | grep rustcbuildx
204262
mv ./rustcbuildx /home/runner/.cargo/bin/
263+
mv ./cargo-green /home/runner/.cargo/bin/
264+
cargo green --version
205265
206266
- uses: actions/checkout@v4
207267

@@ -221,8 +281,7 @@ jobs:
221281
run: |
222282
RUSTCBUILDX_LOG=debug \
223283
RUSTCBUILDX_LOG_PATH="$PWD"/logs.txt \
224-
RUSTC_WRAPPER=/home/runner/.cargo/bin/rustcbuildx \
225-
cargo -vv test --jobs=$(nproc) --all-targets --all-features --locked --frozen --offline
284+
cargo green -vv test --jobs=$(nproc) --all-targets --all-features --locked --frozen --offline
226285
227286
- if: ${{ failure() || success() }}
228287
run: cat logs.txt && echo >logs.txt
@@ -232,8 +291,7 @@ jobs:
232291
run: |
233292
RUSTCBUILDX_LOG=debug \
234293
RUSTCBUILDX_LOG_PATH="$PWD"/logs.txt \
235-
RUSTC_WRAPPER=/home/runner/.cargo/bin/rustcbuildx \
236-
cargo -vv test --jobs=1 --all-targets --all-features --locked --frozen --offline 2>&1 | tee _
294+
cargo green -vv test --jobs=1 --all-targets --all-features --locked --frozen --offline 2>&1 | tee _
237295
cat _ | grep Finished | grep 0...s
238296
cat _ | grep Fresh
239297
! cat _ | grep Compiling
@@ -255,11 +313,13 @@ jobs:
255313
- name: Retrieve saved bin
256314
uses: actions/download-artifact@v4
257315
with:
258-
name: bin-artifact
316+
name: bin-artifacts
259317
- run: | # TODO: whence https://github.com/actions/download-artifact/issues/236
260-
chmod +x ./rustcbuildx
318+
chmod +x ./cargo-green ./rustcbuildx
261319
./rustcbuildx --version | grep rustcbuildx
262320
mv ./rustcbuildx /home/runner/.cargo/bin/
321+
mv ./cargo-green /home/runner/.cargo/bin/
322+
cargo green --version
263323
264324
- uses: actions/checkout@v4
265325

@@ -279,8 +339,7 @@ jobs:
279339
run: |
280340
RUSTCBUILDX_LOG=debug \
281341
RUSTCBUILDX_LOG_PATH="$PWD"/logs.txt \
282-
RUSTC_WRAPPER=/home/runner/.cargo/bin/rustcbuildx \
283-
cargo -vv check --jobs=$(nproc) --all-targets --all-features --locked --frozen --offline
342+
cargo green -vv check --jobs=$(nproc) --all-targets --all-features --locked --frozen --offline
284343
285344
- if: ${{ failure() || success() }}
286345
run: cat logs.txt && echo >logs.txt
@@ -290,8 +349,7 @@ jobs:
290349
run: |
291350
RUSTCBUILDX_LOG=debug \
292351
RUSTCBUILDX_LOG_PATH="$PWD"/logs.txt \
293-
RUSTC_WRAPPER=/home/runner/.cargo/bin/rustcbuildx \
294-
cargo -vv check --jobs=1 --all-targets --all-features --locked --frozen --offline 2>&1 | tee _
352+
cargo green -vv check --jobs=1 --all-targets --all-features --locked --frozen --offline 2>&1 | tee _
295353
cat _ | grep Finished | grep 0...s
296354
cat _ | grep Fresh
297355
! cat _ | grep Compiling
@@ -315,11 +373,13 @@ jobs:
315373
- name: Retrieve saved bin
316374
uses: actions/download-artifact@v4
317375
with:
318-
name: bin-artifact
376+
name: bin-artifacts
319377
- run: | # TODO: whence https://github.com/actions/download-artifact/issues/236
320-
chmod +x ./rustcbuildx
378+
chmod +x ./cargo-green ./rustcbuildx
321379
./rustcbuildx --version | grep rustcbuildx
322380
mv ./rustcbuildx /home/runner/.cargo/bin/
381+
mv ./cargo-green /home/runner/.cargo/bin/
382+
cargo green --version
323383
324384
- uses: actions/checkout@v4
325385

@@ -339,8 +399,7 @@ jobs:
339399
run: |
340400
RUSTCBUILDX_LOG=debug \
341401
RUSTCBUILDX_LOG_PATH="$PWD"/logs.txt \
342-
RUSTC_WRAPPER=/home/runner/.cargo/bin/rustcbuildx \
343-
cargo -vv clippy --jobs=$(nproc) --all-targets --all-features --locked --frozen --offline
402+
cargo green -vv clippy --jobs=$(nproc) --all-targets --all-features --locked --frozen --offline
344403
345404
- if: ${{ failure() || success() }}
346405
run: cat logs.txt && echo >logs.txt
@@ -350,8 +409,7 @@ jobs:
350409
run: |
351410
RUSTCBUILDX_LOG=debug \
352411
RUSTCBUILDX_LOG_PATH="$PWD"/logs.txt \
353-
RUSTC_WRAPPER=/home/runner/.cargo/bin/rustcbuildx \
354-
cargo -vv clippy --jobs=1 --all-targets --all-features --locked --frozen --offline 2>&1 | tee _
412+
cargo green -vv clippy --jobs=1 --all-targets --all-features --locked --frozen --offline 2>&1 | tee _
355413
cat _ | grep Finished | grep 0...s
356414
! cat _ | grep 'Compiling|Compiling'
357415
! cat _ | grep 'DEBUG|INFO|WARN|ERROR'

0 commit comments

Comments
 (0)