Skip to content

fix: resolve deleteTree AccessDenied on macOS #37

fix: resolve deleteTree AccessDenied on macOS

fix: resolve deleteTree AccessDenied on macOS #37

Workflow file for this run

name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name != 'main' && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
backend: epoll
zig_arch: x86_64
zig_os: linux
- os: ubuntu-latest
backend: io_uring
zig_arch: x86_64
zig_os: linux
- os: macos-latest
backend: kqueue
zig_arch: aarch64
zig_os: macos
name: ${{ matrix.os }} / ${{ matrix.backend }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Resolve Zig URL
id: zig-resolve
run: |
VERSION="0.16.0"
ARCH="${{ matrix.zig_arch }}"
OS="${{ matrix.zig_os }}"
curl -sL https://ziglang.org/download/index.json > /tmp/zig-index.json
URL=$(jq -r --arg v "$VERSION" '.[$v]."'"$ARCH-$OS"'".tarball // empty' /tmp/zig-index.json)
SHA=$(jq -r --arg v "$VERSION" '.[$v]."'"$ARCH-$OS"'".shasum // empty' /tmp/zig-index.json)
if [ -z "$URL" ]; then
echo "::error::Zig $VERSION not found in index.json"
exit 1
fi
echo "url=$URL" >> "$GITHUB_OUTPUT"
echo "sha256=$SHA" >> "$GITHUB_OUTPUT"
echo "Installing Zig $VERSION from $URL"
- name: Cache Zig
id: cache-zig
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.local/share/zig
key: zig-${{ runner.os }}-${{ runner.arch }}-0.16.0
save-always: true
- name: Install Zig
if: steps.cache-zig.outputs.cache-hit != 'true'
run: |
set -eu
ZIG_URL="${{ steps.zig-resolve.outputs.url }}"
EXPECTED_SHA="${{ steps.zig-resolve.outputs.sha256 }}"
ZIG_ROOT="$HOME/.local/share/zig"
TARBALL="/tmp/zig.tar.xz"
curl -fsSL "$ZIG_URL" -o "$TARBALL"
if command -v sha256sum >/dev/null 2>&1; then
ACTUAL_SHA=$(sha256sum "$TARBALL" | cut -d' ' -f1)
elif command -v shasum >/dev/null 2>&1; then
ACTUAL_SHA=$(shasum -a 256 "$TARBALL" | cut -d' ' -f1)
else
echo "::error::No SHA-256 tool found"
exit 1
fi
if [ "$ACTUAL_SHA" != "$EXPECTED_SHA" ]; then
echo "::error::SHA-256 mismatch"
exit 1
fi
echo "SHA-256 OK"
mkdir -p "$ZIG_ROOT"
tar -xf "$TARBALL" -C "$ZIG_ROOT" --strip-components=1
rm -f "$TARBALL"
- name: Add Zig to PATH
run: echo "$HOME/.local/share/zig" >> "$GITHUB_PATH"
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Python dependencies
run: pip install boto3 botocore
- name: Build z3
run: zig build -Doptimize=ReleaseFast -Dbackend=${{ matrix.backend }}
- name: Create data and tmp directories
run: mkdir -p data tmp
- name: Start z3 server
run: |
./zig-out/bin/z3 --port=9000 --data-dir=./data --tmp=./tmp &
echo $! > ${{ runner.temp }}/z3.pid
- name: Wait for server
run: |
for i in $(seq 1 30); do
if curl -sf -o /dev/null -w '%{http_code}' http://localhost:9000/ 2>/dev/null | grep -q '200\|403'; then
echo "Server is ready (attempt $i)"
exit 0
fi
sleep 1
done
echo "::error::Server failed to start"
exit 1
- name: Run test_client.py
id: test-client
continue-on-error: true
run: |
python3 test_client.py
echo "exit=$?" >> "$GITHUB_OUTPUT"
- name: Run test_comprehensive.py
id: test-comprehensive
continue-on-error: true
run: |
python3 test_comprehensive.py
echo "exit=$?" >> "$GITHUB_OUTPUT"
- name: Run benchmark.py (smoke test)
id: benchmark
continue-on-error: true
run: |
python3 benchmark.py \
--only=zs3
echo "exit=$?" >> "$GITHUB_OUTPUT"
- name: Report test results
if: always()
run: |
echo "::group::Test Summary"
echo "test_client: exit ${{ steps.test-client.outputs.exit }}"
echo "test_comprehensive: exit ${{ steps.test-comprehensive.outputs.exit }}"
echo "benchmark: exit ${{ steps.benchmark.outputs.exit }}"
echo "::endgroup::"
if [ "${{ steps.test-client.outputs.exit }}" != "0" ] || \
[ "${{ steps.test-comprehensive.outputs.exit }}" != "0" ] || \
[ "${{ steps.benchmark.outputs.exit }}" != "0" ]; then
echo "::error::One or more test suites failed"
exit 1
fi
echo "All test suites passed"
- name: Stop z3 server
if: always()
run: |
if [ -f ${{ runner.temp }}/z3.pid ]; then
kill $(cat ${{ runner.temp }}/z3.pid) 2>/dev/null || true
fi