V0.0.2 #2
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
| name: Release | |
| permissions: | |
| contents: write | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| test: | |
| name: Test on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.15.2 | |
| - name: Run Tests | |
| run: zig build test | |
| bench: | |
| name: Run Benchmarks | |
| needs: test | |
| runs-on: ubuntu-latest | |
| outputs: | |
| bench_output: ${{ steps.run_bench.outputs.bench_output }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.15.2 | |
| - name: Run Benchmarks | |
| id: run_bench | |
| run: | | |
| # Run benchmarks (generates benchmark-results.md) | |
| zig build bench || true | |
| # Prepare output for release body from the generated markdown file | |
| echo "bench_output<<EOF" >> $GITHUB_OUTPUT | |
| if [ -f benchmark-results.md ]; then | |
| cat benchmark-results.md >> $GITHUB_OUTPUT | |
| else | |
| echo "No benchmark results found." >> $GITHUB_OUTPUT | |
| fi | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| build-library: | |
| name: Build Library (${{ matrix.target }}) | |
| needs: test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target: | |
| - x86_64-windows | |
| - x86-windows | |
| - x86_64-linux | |
| - x86-linux | |
| - aarch64-linux | |
| - x86_64-macos | |
| - aarch64-macos | |
| - x86_64-freestanding | |
| - aarch64-freestanding | |
| - riscv64-freestanding | |
| - arm-freestanding | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.15.2 | |
| - name: Build Library | |
| run: zig build -Doptimize=ReleaseSafe -Dtarget=${{ matrix.target }} | |
| - name: Prepare Release Artifacts | |
| run: | | |
| mkdir -p release | |
| if [[ "${{ matrix.target }}" == *"windows"* ]]; then | |
| cp zig-out/lib/zigantic.lib release/zigantic-${{ matrix.target }}.lib || true | |
| else | |
| cp zig-out/lib/libzigantic.a release/libzigantic-${{ matrix.target }}.a || true | |
| fi | |
| - name: Upload Release Artifacts | |
| run: | | |
| gh release upload "${{ github.event.release.tag_name }}" release/* --clobber || true | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| update-release: | |
| name: Update Release Description | |
| needs: [test, bench] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get Release URL | |
| id: get_url | |
| run: echo "url=https://github.com/${{ github.repository }}/archive/refs/tags/${{ github.event.release.tag_name }}.tar.gz" >> $GITHUB_OUTPUT | |
| - uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.15.2 | |
| - name: Calculate Hash | |
| id: calc_hash | |
| run: | | |
| zig fetch --save ${{ steps.get_url.outputs.url }} | |
| HASH=$(grep '.hash =' build.zig.zon | cut -d '"' -f 2) | |
| echo "hash=$HASH" >> $GITHUB_OUTPUT | |
| - name: Update Release Body | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| body: | | |
| ${{ github.event.release.body }} | |
| ## 📃 Documentation | |
| Full documentation can be found at https://muhammad-fiaz.github.io/zigantic/ | |
| ## 📦 Installation | |
| ### Option A — Automatic (Recommended) | |
| Run this to install the dependency and automatically save the hash: | |
| ```bash | |
| zig fetch --save https://github.com/${{ github.repository }}/archive/refs/tags/${{ github.event.release.tag_name }}.tar.gz | |
| ``` | |
| > [!NOTE] | |
| > After running, Zig updates your `build.zig.zon` with the correct hash automatically. | |
| The entry will look like: | |
| ```zig | |
| .dependencies = .{ | |
| .zigantic = .{ | |
| .url = "https://github.com/${{ github.repository }}/archive/refs/tags/${{ github.event.release.tag_name }}.tar.gz", | |
| .hash = "${{ steps.calc_hash.outputs.hash }}", | |
| }, | |
| }, | |
| ``` | |
| ### Option B — Manual | |
| ```bash | |
| zig fetch --hash https://github.com/${{ github.repository }}/archive/refs/tags/${{ github.event.release.tag_name }}.tar.gz | |
| ``` | |
| Copy that hash into your `build.zig.zon`: | |
| ```zig | |
| .hash = "${{ steps.calc_hash.outputs.hash }}" | |
| ``` | |
| ## 📊 Benchmarks | |
| The following benchmark results were captured during the release workflow: | |
| > [!NOTE] | |
| > Benchmarks are automatically generated by GitHub Actions using [bench/benchmark.zig](https://github.com/muhammad-fiaz/zigantic/blob/main/bench/benchmark.zig). Results may vary based on the CI runner environment. | |
| ${{ needs.bench.outputs.bench_output }} | |
| ## ⬇️ Downloads (Prebuilt Library) | |
| | Platform | Architecture | File | | |
| |----------|--------------|------| | |
| | Windows | x86_64 | [zigantic-x86_64-windows.lib](https://github.com/muhammad-fiaz/zigantic/releases/download/${{ github.event.release.tag_name }}/zigantic-x86_64-windows.lib) | | |
| | Windows | x86 | [zigantic-x86-windows.lib](https://github.com/muhammad-fiaz/zigantic/releases/download/${{ github.event.release.tag_name }}/zigantic-x86-windows.lib) | | |
| | Linux | x86_64 | [libzigantic-x86_64-linux.a](https://github.com/muhammad-fiaz/zigantic/releases/download/${{ github.event.release.tag_name }}/libzigantic-x86_64-linux.a) | | |
| | Linux | x86 | [libzigantic-x86-linux.a](https://github.com/muhammad-fiaz/zigantic/releases/download/${{ github.event.release.tag_name }}/libzigantic-x86-linux.a) | | |
| | Linux | aarch64 (ARM64) | [libzigantic-aarch64-linux.a](https://github.com/muhammad-fiaz/zigantic/releases/download/${{ github.event.release.tag_name }}/libzigantic-aarch64-linux.a) | | |
| | macOS | x86_64 (Intel) | [libzigantic-x86_64-macos.a](https://github.com/muhammad-fiaz/zigantic/releases/download/${{ github.event.release.tag_name }}/libzigantic-x86_64-macos.a) | | |
| | macOS | aarch64 (Apple Silicon) | [libzigantic-aarch64-macos.a](https://github.com/muhammad-fiaz/zigantic/releases/download/${{ github.event.release.tag_name }}/libzigantic-aarch64-macos.a) | | |
| | Bare Metal | x86_64 | [libzigantic-x86_64-freestanding.a](https://github.com/muhammad-fiaz/zigantic/releases/download/${{ github.event.release.tag_name }}/libzigantic-x86_64-freestanding.a) | | |
| | Bare Metal | aarch64 | [libzigantic-aarch64-freestanding.a](https://github.com/muhammad-fiaz/zigantic/releases/download/${{ github.event.release.tag_name }}/libzigantic-aarch64-freestanding.a) | | |
| | Bare Metal | RISC-V 64 | [libzigantic-riscv64-freestanding.a](https://github.com/muhammad-fiaz/zigantic/releases/download/${{ github.event.release.tag_name }}/libzigantic-riscv64-freestanding.a) | | |
| | Bare Metal | ARM | [libzigantic-arm-freestanding.a](https://github.com/muhammad-fiaz/zigantic/releases/download/${{ github.event.release.tag_name }}/libzigantic-arm-freestanding.a) | | |
| ### 🛠️ Using Prebuilt Libraries | |
| 1. Download the library for your platform. | |
| 2. Place it in your project (e.g., in a `libs/` folder). | |
| 3. Update your `build.zig`: | |
| ```zig | |
| // Assuming you placed the library in `libs/` | |
| exe.addLibraryPath(b.path("libs")); | |
| exe.linkSystemLibrary("zigantic"); | |
| ``` |