feat: modernize context APIs and add allocator-explicit variants #4
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| format: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup mise | |
| uses: jdx/mise-action@v3 | |
| - name: Install tools with mise | |
| run: mise install | |
| - name: Check formatting | |
| run: mise exec -- zig fmt --check src/lite3.zig src/tests.zig src/bench.zig | |
| test: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| optimize: [Debug, ReleaseSafe, ReleaseFast] | |
| json: [true, false] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup mise | |
| uses: jdx/mise-action@v3 | |
| - name: Install tools with mise | |
| run: mise install | |
| - name: Build | |
| run: mise exec -- zig build | |
| - name: Test (${{ matrix.optimize }}, json=${{ matrix.json }}) | |
| run: mise exec -- zig build test -Doptimize=${{ matrix.optimize }} -Djson=${{ matrix.json }} | |
| - name: Build examples (${{ matrix.optimize }}, json=${{ matrix.json }}) | |
| run: mise exec -- zig build examples -Doptimize=${{ matrix.optimize }} -Djson=${{ matrix.json }} | |
| - name: Run examples (${{ matrix.optimize }}, json=${{ matrix.json }}) | |
| run: | | |
| mise exec -- ./zig-out/bin/basic | |
| mise exec -- ./zig-out/bin/json_roundtrip | |
| unsupported-options: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup mise | |
| uses: jdx/mise-action@v3 | |
| - name: Install tools with mise | |
| run: mise install | |
| - name: Verify -Dlto=true fails with clear message | |
| run: | | |
| set +e | |
| output=$(mise exec -- zig build test -Dlto=true 2>&1) | |
| status=$? | |
| echo "$output" | |
| if [ "$status" -eq 0 ]; then | |
| echo "Expected -Dlto=true to fail." | |
| exit 1 | |
| fi | |
| echo "$output" | grep -q "currently unsupported in lite3-zig" | |
| cross-compile: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target: | |
| - aarch64-linux-gnu | |
| - x86_64-linux-gnu | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup mise | |
| uses: jdx/mise-action@v3 | |
| - name: Install tools with mise | |
| run: mise install | |
| - name: Cross-compile (${{ matrix.target }}) | |
| run: mise exec -- zig build -Dtarget=${{ matrix.target }} |