Repository navigation
88 lines (78 loc) · 3.11 KB
/
Copy pathzig-test.yml
File metadata and controls
88 lines (78 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# This workflow is managed by gh actions-lock.
# SPDX-License-Identifier: MPL-2.0
# This workflow is managed by gh actions-lock.
# This workflow is managed by gh actions-lock.
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
#
# BoJ Server — Zig FFI test & build pipeline
name: Zig FFI Tests
# NOTE: this workflow used to be workflow-level path-filtered (on.*.paths).
# That made it a REQUIRED check that simply never ran on PRs touching none of
# its paths — GitHub then left the check "Expected" forever and the PR sat at
# mergeable_state=blocked. It now always runs; a lightweight `changes` job
# decides whether the heavy `test` job is needed. A job skipped via `if:`
# reports SUCCESS to required status checks, so the required context is always
# satisfied without running heavy work on unrelated PRs.
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
actions: read
contents: read
jobs:
changes:
name: Detect relevant changes
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
run: ${{ steps.detect.outputs.run }}
steps:
- uses: actions/checkout@v6.0.2
with:
fetch-depth: 0
- id: detect
env:
EVENT: ${{ github.event_name }}
BASE: ${{ github.base_ref }}
BEFORE: ${{ github.event.before }}
run: |
# Fail-safe: default to running; only set run=false when a successful
# diff shows NOTHING in this gate's path set changed.
set -uo pipefail
run=true
if [ "$EVENT" = pull_request ]; then
git fetch --no-tags --depth=200 origin "$BASE" 2>/dev/null \
&& changed=$(git diff --name-only "origin/${BASE}...HEAD" 2>/dev/null) \
&& { printf '%s\n' "$changed" | grep -qE '^ffi/' && run=true || run=false; }
elif [ "$EVENT" = push ] && [ -n "$BEFORE" ] && [ "$BEFORE" != 0000000000000000000000000000000000000000 ]; then
changed=$(git diff --name-only "${BEFORE}...${GITHUB_SHA}" 2>/dev/null) \
&& { printf '%s\n' "$changed" | grep -qE '^ffi/' && run=true || run=false; }
fi
printf 'run=%s\n' "$run" >> "$GITHUB_OUTPUT"
echo "relevant=$run; changed files:"; printf '%s\n' "${changed:-<none computed>}"
test:
name: Zig FFI Tests
needs: changes
if: needs.changes.outputs.run == 'true'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v6.0.2
- name: Install Zig
uses: mlugg/setup-zig@v2.2.1
with:
version: 0.16.0
# Bundled cartridges/ was retired; per-cartridge FFI builds are gated
# in hyperpolymath/boj-server-cartridges. This workflow now covers the
# core FFI tree (ffi/zig) only.
- name: Run catalogue tests
run: cd ffi/zig && zig build test --summary all
- name: Run readiness tests
run: cd ffi/zig && zig build readiness --summary all
- name: Build static library
run: cd ffi/zig && zig build lib
- name: Run benchmarks
run: cd ffi/zig && zig build bench