Skip to content

Commit c18638c

Browse files
cache toolchain
1 parent 523dff0 commit c18638c

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,29 @@ jobs:
5555
cache: ${{ !startsWith(github.ref, 'refs/tags/') }}
5656
target: ${{ steps.target.outputs.target }}
5757

58-
- name: Cache Zig
58+
- name: Cache Zig toolchain
5959
if: ${{ runner.os == 'Linux' && matrix.platform.target == 'aarch64' }}
60+
id: cache-zig
6061
uses: actions/cache@v4
6162
with:
62-
path: zig-linux-x86_64-${{ env.ZIG_VERSION }}
63-
key: ${{ runner.os }}-zig-${{ env.ZIG_VERSION }}
63+
path: |
64+
zig-linux-x86_64-${{ env.ZIG_VERSION }}
65+
~/.cargo/bin/cargo-zigbuild
66+
key: ${{ runner.os }}-zig-toolchain-${{ env.ZIG_VERSION }}
6467

6568
- name: Install Zig and cargo-zigbuild
66-
if: ${{ runner.os == 'Linux' && matrix.platform.target == 'aarch64' }}
69+
if: ${{ runner.os == 'Linux' && matrix.platform.target == 'aarch64' && steps.cache-zig.outputs. cache-hit != 'true' }}
6770
shell: bash
6871
run: |
69-
wget -q https://ziglang.org/download/${{ env.ZIG_VERSION }}/zig-linux-x86_64-${{ env.ZIG_VERSION }}.tar.xz
72+
wget -q https://ziglang.org/download/${{ env.ZIG_VERSION }}/zig-linux-x86_64-${{ env. ZIG_VERSION }}.tar.xz
7073
tar xf zig-linux-x86_64-${{ env.ZIG_VERSION }}.tar.xz
71-
echo "$PWD/zig-linux-x86_64-${{ env.ZIG_VERSION }}" >> $GITHUB_PATH
7274
cargo install cargo-zigbuild
7375
76+
- name: Add Zig to PATH
77+
if: ${{ runner.os == 'Linux' && matrix.platform.target == 'aarch64' }}
78+
shell: bash
79+
run: echo "$PWD/zig-linux-x86_64-${{ env.ZIG_VERSION }}" >> $GITHUB_PATH
80+
7481
- name: Build release binary
7582
id: build
7683
shell: bash

0 commit comments

Comments
 (0)