CI cache reorder and fix dependencies for different optimizations #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Zig Build | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
board: [pico, pico_w, pico2, pico2_w, pico2-riscv, pico2-riscv_w] | |
optimize: [Debug, ReleaseSafe, ReleaseFast, ReleaseSmall] | |
zig: [latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Zig Compiler | |
uses: mlugg/[email protected] | |
with: | |
version: ${{ matrix.zig }} | |
- name: Cache Dependencies | |
id: cache-deps | |
uses: actions/cache@v4 | |
with: | |
path: ./build/${{ matrix.board }}/${{ matrix.optimize }}/_deps | |
key: ${{ matrix.board }}-${{ matrix.optimize }}-deps | |
- name: Cache Toolchains | |
id: cache-toolchains | |
uses: actions/cache@v4 | |
with: | |
path: ./build/${{ matrix.board }}/${{ matrix.optimize }}/toolchain | |
key: ${{ matrix.board }}-toolchain | |
- name: Build | |
run: zig build -Dboard=${{ matrix.board }} -Doptimize=${{ matrix.optimize }} -Dbuild_dir=./build/${{ matrix.board }}/${{ matrix.optimize }} | |
- name: Upload Build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-${{ matrix.board }}-${{ matrix.optimize }} | |
path: "./build/${{ matrix.board }}/${{ matrix.optimize }}\n!./build/${{ matrix.board }}/${{ matrix.optimize }}/_deps\n!./build/${{ matrix.board }}/${{ matrix.optimize }}/toolchain" |