Plan: speed up test suite (~3 min → <60 s) (#2) #7
Workflow file for this run
This file contains hidden or 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
| # Builds the circ-compile CLI when you push a version tag (e.g. v0.1.0). | |
| name: CLI (tag build) | |
| on: | |
| push: | |
| tags: | |
| - "v*" # use '*' if you publish non-v-prefixed tags | |
| env: | |
| ZIG_VERSION: "0.15.1" | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - zig_target: x86_64-linux-gnu | |
| artifact_suffix: linux-x86_64 | |
| binary: zig-out/bin/circ-compile | |
| - zig_target: aarch64-macos | |
| artifact_suffix: macos-aarch64 | |
| binary: zig-out/bin/circ-compile | |
| - zig_target: x86_64-windows-gnu | |
| artifact_suffix: windows-x86_64 | |
| binary: zig-out/bin/circ-compile.exe | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Zig | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| pkg="zig-x86_64-linux-${ZIG_VERSION}" | |
| curl -fsSL -o zig.tar.xz "https://ziglang.org/download/${ZIG_VERSION}/${pkg}.tar.xz" | |
| tar -xf zig.tar.xz | |
| echo "${PWD}/${pkg}" >> "${GITHUB_PATH}" | |
| - name: Build circ-compile (${{ matrix.artifact_suffix }}) | |
| run: zig build -Doptimize=ReleaseFast "-Dtarget=${{ matrix.zig_target }}" circ-compile | |
| - name: Upload binary | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: circ-compile-${{ github.ref_name }}-${{ matrix.artifact_suffix }} | |
| path: ${{ matrix.binary }} | |
| release: | |
| name: Draft GitHub release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| # gh looks up the repo via git remote; this job never checks out source. | |
| env: | |
| GH_REPO: ${{ github.repository }} | |
| steps: | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: assets | |
| pattern: circ-compile-${{ github.ref_name }}-* | |
| merge-multiple: false | |
| - name: Create draft release and upload binaries | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| shopt -s nullglob | |
| TAG="${{ github.ref_name }}" | |
| dirs=(assets/circ-compile-${TAG}-*) | |
| if (( ${#dirs[@]} == 0 )); then | |
| echo "::error::No artifact directories under assets/ (expected circ-compile-${TAG}-*)" | |
| ls -laR assets 2>/dev/null || true | |
| exit 1 | |
| fi | |
| if gh release view "$TAG" >/dev/null 2>&1; then | |
| echo "Release $TAG already exists; uploading or replacing assets only." | |
| else | |
| gh release create "$TAG" \ | |
| --draft \ | |
| --title "Release ${TAG}" \ | |
| --notes "Draft release for **${TAG}**. Attached: Linux (x86_64), macOS (aarch64), Windows (x86_64) CLI builds (cross-compiled from Linux)." | |
| fi | |
| for dir in "${dirs[@]}"; do | |
| [[ -d "$dir" ]] || continue | |
| name="$(basename "$dir")" | |
| if [[ -f "${dir}/circ-compile.exe" ]]; then | |
| install -m 0755 "${dir}/circ-compile.exe" "./${name}.exe" | |
| gh release upload "$TAG" "./${name}.exe" --clobber | |
| rm -f "./${name}.exe" | |
| elif [[ -f "${dir}/circ-compile" ]]; then | |
| install -m 0755 "${dir}/circ-compile" "./${name}" | |
| gh release upload "$TAG" "./${name}" --clobber | |
| rm -f "./${name}" | |
| else | |
| echo "::error::Expected circ-compile or circ-compile.exe in ${dir}"; exit 1 | |
| fi | |
| done |