Skip to content

Commit 1ee3cf4

Browse files
committed
ci: Cache and use latest bindgen version
1 parent 66d53cb commit 1ee3cf4

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,25 @@ jobs:
1111
matrix:
1212
arch: [x86_64, arm64, riscv, loongarch, arm]
1313
config: [generic.config]
14+
bindgen: [latest]
1415
include:
1516
- arch: x86_64
1617
config: generic.config no-jump-label.config
18+
bindgen: latest
1719

1820
steps:
1921
- uses: actions/checkout@v4
2022
with:
2123
submodules: true
24+
- name: Resolve bindgen version
25+
run: |
26+
if [[ "${{ matrix.bindgen }}" == "latest" ]]; then
27+
echo "BINDGEN_VERSION=$(gh api repos/rust-lang/rust-bindgen/releases/latest --jq .tag_name | sed 's/^v//')" >> $GITHUB_ENV
28+
else
29+
echo "BINDGEN_VERSION=${{ matrix.bindgen }}" >> $GITHUB_ENV
30+
fi
31+
env:
32+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2233
- name: Install dependencies
2334
run: |
2435
sudo apt-get update
@@ -27,8 +38,15 @@ jobs:
2738
uses: dtolnay/rust-toolchain@stable
2839
with:
2940
components: rust-src
41+
- name: Cache bindgen
42+
id: cache-bindgen
43+
uses: actions/cache@v4
44+
with:
45+
path: ~/.cargo/bin/bindgen
46+
key: bindgen-${{ runner.os }}-${{ env.BINDGEN_VERSION }}
3047
- name: Install bindgen
31-
run: cargo install bindgen-cli
48+
if: steps.cache-bindgen.outputs.cache-hit != 'true'
49+
run: cargo install bindgen-cli --version ${{ env.BINDGEN_VERSION }}
3250
- name: Configure kernel
3351
run: |
3452
mkdir -p out

0 commit comments

Comments
 (0)