Skip to content

README: refresh the pinned-dependency example to v1.1.0 #28

README: refresh the pinned-dependency example to v1.1.0

README: refresh the pinned-dependency example to v1.1.0 #28

Workflow file for this run

name: ci
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v2
with:
version: 0.16.0
- name: Lint (zig fmt --check)
run: zig build lint
- name: Build
run: zig build
- name: Unit tests
run: zig build test --summary all
- name: Integration tests
if: ${{ matrix.os == 'ubuntu-latest' }}
env:
SERPAPI_KEY: ${{ secrets.SERPAPI_KEY }}
run: zig build itest --summary all
# The demos are standalone projects that depend on this repo by path;
# building them keeps the downstream wiring examples honest.
- name: Build demos
run: |
zig build --build-file demo/flight_tracker/build.zig
zig build test --build-file demo/wasm/build.zig --summary all
# Runs on macOS: kcov reads the unit-test binary's debug info there,
# while on Linux it reports zero instrumented files for that binary
# (the integration binary works on both).
#
# Advisory only: kcov has been observed to hang the unit-test binary under
# ptrace on macOS, so the job is time-boxed and does not fail the workflow.
coverage:
runs-on: macos-latest
# A generous backstop for the whole job (checkout/setup/brew), well
# above the coverage step's own 15m cap so that cap is what normally
# fires. A job-level timeout cancels the job, which continue-on-error
# cannot suppress, so it must not be the common case.
timeout-minutes: 30
continue-on-error: true
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v2
with:
version: 0.16.0
- name: Install kcov
run: brew install kcov
- name: Code coverage
timeout-minutes: 15
env:
SERPAPI_KEY: ${{ secrets.SERPAPI_KEY }}
run: |
zig build cov
for f in $(find zig-out/coverage -maxdepth 3 -name coverage.json); do
echo "$f: $(head -c 300 $f | tr -d '\n')"
done
python3 - <<'EOF' >> "$GITHUB_STEP_SUMMARY"
import json
report = json.load(open("zig-out/coverage/merged/kcov-merged/coverage.json"))
print("## Code coverage: %s%%\n" % report["percent_covered"])
print("| file | covered | total | percent |")
print("|---|---|---|---|")
for f in report["files"]:
print("| %s | %s | %s | %s%% |" % (
f["file"].split("/")[-1], f["covered_lines"],
f["total_lines"], f["percent_covered"]))
EOF
- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
name: coverage
path: zig-out/coverage/merged/kcov-merged