Persist Zig build caches in CI
Build and Release / Build executables (pull_request) Canceled after 4m52s

This commit is contained in:
2026-09-14 02:44:54 +00:00
parent 7e60e090f2
commit b8110d4c6a
+22 -7
View File
@@ -1,11 +1,19 @@
name: Build and Release
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- 'v*'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: write
@@ -14,13 +22,16 @@ jobs:
build:
name: Build executables
runs-on: ubuntu-latest
env:
ZIG_LOCAL_CACHE_DIR: /ci-cache/zig-chess/0.16.0/linux-amd64/local
ZIG_GLOBAL_CACHE_DIR: /ci-cache/zig-chess/0.16.0/linux-amd64/global
steps:
- name: Checkout
uses: actions/checkout@v4
uses: https://github.com/actions/checkout@v4
- name: Set up Zig
uses: mlugg/setup-zig@v2
uses: https://github.com/mlugg/setup-zig@v2
with:
version: 0.16.0
@@ -34,17 +45,21 @@ jobs:
zig version
glslc --version
- name: Prepare persistent Zig caches
run: |
mkdir -p "$ZIG_LOCAL_CACHE_DIR" "$ZIG_GLOBAL_CACHE_DIR"
- name: Build GUI executable
run: |
zig build \
--cache-dir /tmp/zig-chess-cache \
--global-cache-dir /tmp/zig-global-cache
--cache-dir "$ZIG_LOCAL_CACHE_DIR" \
--global-cache-dir "$ZIG_GLOBAL_CACHE_DIR"
- name: Build magic generator executable
run: |
zig build magic-numbers \
--cache-dir /tmp/zig-chess-cache \
--global-cache-dir /tmp/zig-global-cache
--cache-dir "$ZIG_LOCAL_CACHE_DIR" \
--global-cache-dir "$ZIG_GLOBAL_CACHE_DIR"
- name: Package executables
run: |
@@ -60,7 +75,7 @@ jobs:
sha256sum "dist/${artifact_dir}.tar.gz" > "dist/${artifact_dir}.tar.gz.sha256"
- name: Upload build artifact
uses: actions/upload-artifact@v3
uses: https://github.com/actions/upload-artifact@v3
with:
name: zig-chess-${{ github.ref_name }}
path: |