Skip to content

Commit 4c28a92

Browse files
authored
Set Rust caching key per language group (#2250)
Fixes #2247 (a follow-up from #2195). * Add a workflow dispatch manual trigger to the tests workflow. * Move the link-checked languages JSON list to the build job's env. * Set a caching key per language group to avoid extra `mdbook-linkcheck` installation on non-link-checked translations. For the meaning of this key, see: https://github.com/Swatinem/rust-cache?tab=readme-ov-file#example-usage * Fix newly broken web link in 8a3ed21 ✅ I tested it on my fork, and it looks good: https://github.com/jond01/comprehensive-rust/actions/workflows/build.yml https://github.com/jond01/comprehensive-rust/actions/caches
1 parent ad9b41c commit 4c28a92

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
push:
66
branches:
77
- main
8+
workflow_dispatch:
89

910
env:
1011
CARGO_TERM_COLOR: always
@@ -120,6 +121,9 @@ jobs:
120121
matrix:
121122
language: ${{ fromJSON(needs.find-languages.outputs.languages) }}
122123
fail-fast: false
124+
env:
125+
# Opt-in for checking links in translations - add the language below.
126+
LINK_CHECKED_LANGUAGES: '["en", ]'
123127
steps:
124128
- name: Checkout
125129
uses: actions/checkout@v4
@@ -128,6 +132,8 @@ jobs:
128132

129133
- name: Setup Rust cache
130134
uses: ./.github/workflows/setup-rust-cache
135+
with:
136+
key: ${{ contains(fromJSON(env.LINK_CHECKED_LANGUAGES), matrix.language) }}
131137

132138
- name: Install Gettext
133139
run: |
@@ -148,8 +154,7 @@ jobs:
148154
msgfmt -o /dev/null --statistics po/messages.pot
149155
150156
- name: Install mdbook-linkcheck
151-
# Opt-in for checking links in translations - add the language below.
152-
if: contains(fromJSON('["en", ]'), matrix.language)
157+
if: contains(fromJSON(env.LINK_CHECKED_LANGUAGES), matrix.language)
153158
run: cargo install mdbook-linkcheck --locked --version 0.7.7
154159

155160
- name: Build ${{ matrix.language }} translation

.github/workflows/setup-rust-cache/action.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@ name: Setup Rust cache
22

33
description: Configure the rust-cache workflow.
44

5+
inputs:
6+
key:
7+
description: Additional caching key
8+
required: false
9+
default:
10+
511
runs:
612
using: composite
713
steps:
814
- name: Setup Rust cache
915
uses: Swatinem/rust-cache@v2
1016
with:
1117
# Only save the cache on the main branch to avoid PRs filling
12-
# up the cache. Further, only save it if we are working on the
13-
# English source (or if no language has been set).
14-
save-if: ${{ github.ref == 'refs/heads/main' && (matrix.language == 'en' || matrix.language == '') }}
18+
# up the cache.
19+
save-if: ${{ github.ref == 'refs/heads/main' }}
20+
# Further, save the cache per key - e.g. language grouping.
21+
key: ${{ inputs.key }}

src/bare-metal/android/vmbase.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ pub fn main(arg0: u64, arg1: u64, arg2: u64, arg3: u64) {
2828

2929
</details>
3030

31-
[1]: https://android.googlesource.com/platform/packages/modules/Virtualization/+/refs/heads/master/vmbase/
31+
[1]: https://android.googlesource.com/platform/packages/modules/Virtualization/+/refs/heads/main/libs/libvmbase/

0 commit comments

Comments
 (0)