-
-
Notifications
You must be signed in to change notification settings - Fork 0
299 lines (263 loc) · 12.6 KB
/
Copy pathhpc-ci.yml
File metadata and controls
299 lines (263 loc) · 12.6 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# SPDX-License-Identifier: MPL-2.0
# Docudactyl HPC — Chapel + Zig FFI CI Pipeline
#
# Three jobs:
# 1. build-ffi: Zig FFI build + unit/integration tests
# 2. build-chapel: Chapel HPC binary (depends on FFI artifacts)
# 3. check-abi: Idris2 ABI proof compilation
#
name: HPC Build & Test
on:
push:
branches: [main]
paths:
- 'src/chapel/**'
- 'ffi/zig/**'
- 'src/Docudactyl/**'
- 'src/abi/**'
- 'generated/abi/**'
- '.github/workflows/hpc-ci.yml'
pull_request:
paths:
- 'src/chapel/**'
- 'ffi/zig/**'
- 'src/Docudactyl/**'
- 'src/abi/**'
- 'generated/abi/**'
- '.github/workflows/hpc-ci.yml'
permissions:
contents: read
env:
ZIG_VERSION: '0.15.2'
# Chapel 2.8.0 is required by docudactyl#29 — FileSystem.stat was
# removed; code now uses OS.POSIX.stat. echidna#146 set the same floor.
CHAPEL_VERSION: '2.8.0'
IDRIS2_VERSION: '0.8.0'
jobs:
# ═══════════════════════════════════════════════════════════════════════════
# Job 1: Zig FFI — Build + Test
# ═══════════════════════════════════════════════════════════════════════════
build-ffi:
name: Zig FFI Build & Test
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install Zig
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2
with:
version: ${{ env.ZIG_VERSION }}
- name: Install C library headers
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
libpoppler-glib-dev libglib2.0-dev \
libtesseract-dev libleptonica-dev \
libavformat-dev libavcodec-dev libavutil-dev \
libxml2-dev libgdal-dev libvips-dev \
liblmdb-dev libarchive-dev libcurl4-openssl-dev
- name: Build FFI (ReleaseFast)
run: cd ffi/zig && zig build -Doptimize=ReleaseFast
- name: Run FFI tests (unit + integration)
run: cd ffi/zig && zig build test
- name: Verify shared library exists
run: |
ls -la ffi/zig/zig-out/lib/libdocudactyl_ffi.so*
file ffi/zig/zig-out/lib/libdocudactyl_ffi.so
- name: Upload FFI artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: ffi-libs
path: |
ffi/zig/zig-out/lib/libdocudactyl_ffi.so*
ffi/zig/zig-out/lib/libdocudactyl_ffi.a
retention-days: 1
# ═══════════════════════════════════════════════════════════════════════════
# Job 2a: FFI Smoke — decoupled from the metalayer (docudactyl#29 / echidna#146)
# ─────────────────────────────────────────────────────────────────────────────
# Builds and runs `src/chapel/smoke.chpl` linked against the Zig FFI library
# WITHOUT pulling in the full DocudactylHPC metalayer. Strict gate: if the
# FFI ABI surface or the chapel/Zig boundary regresses, this fails fast even
# when the metalayer build is broken. (No continue-on-error.)
# ═══════════════════════════════════════════════════════════════════════════
build-smoke:
name: Chapel FFI Smoke
needs: build-ffi
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Download FFI artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: ffi-libs
path: ffi/zig/zig-out/lib/
- name: Install Chapel
run: |
CHPL_TARBALL="chapel-${CHAPEL_VERSION}-linux64-x86_64.tar.gz"
CHPL_URL="https://github.com/chapel-lang/chapel/releases/download/${CHAPEL_VERSION}/${CHPL_TARBALL}"
wget -q "${CHPL_URL}" -O "/tmp/${CHPL_TARBALL}"
tar xzf "/tmp/${CHPL_TARBALL}" -C /opt/
echo "CHPL_HOME=/opt/chapel-${CHAPEL_VERSION}" >> "$GITHUB_ENV"
echo "/opt/chapel-${CHAPEL_VERSION}/bin/linux64-x86_64" >> "$GITHUB_PATH"
- name: Install C runtime libraries (FFI .so transitively pulls these)
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
libpoppler-glib8t64 libglib2.0-0t64 \
libtesseract5 libleptonica-dev \
libavformat60 libavcodec60 libavutil58 \
libxml2 libgdal34t64 libvips42t64 \
liblmdb0 libarchive13t64 libcurl4t64 \
tesseract-ocr-eng
- name: Verify Chapel installation
run: chpl --version
- name: Build FFI smoke binary
run: |
mkdir -p bin
ABSPATH=$(cd ffi/zig/zig-out/lib && pwd)
chmod +x ffi/zig/zig-out/lib/libdocudactyl_ffi.so* || true
chpl src/chapel/smoke.chpl \
src/chapel/FFIBridge.chpl \
-o bin/docudactyl-smoke \
-Lffi/zig/zig-out/lib -ldocudactyl_ffi \
--ldflags="-Wl,-rpath,$ABSPATH"
- name: Run FFI smoke (init/version/free; no manifest required)
run: |
export LD_LIBRARY_PATH="ffi/zig/zig-out/lib:$LD_LIBRARY_PATH"
OUT=$(bin/docudactyl-smoke)
echo "$OUT"
echo "$OUT" | grep -qE '^\[smoke\] PASS$'
# ═══════════════════════════════════════════════════════════════════════════
# Job 2: Chapel HPC — Build + Smoke Test
# ═══════════════════════════════════════════════════════════════════════════
build-chapel:
name: Chapel HPC Build
needs: build-ffi
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Download FFI artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: ffi-libs
path: ffi/zig/zig-out/lib/
- name: Install Chapel
run: |
CHPL_TARBALL="chapel-${CHAPEL_VERSION}-linux64-x86_64.tar.gz"
CHPL_URL="https://github.com/chapel-lang/chapel/releases/download/${CHAPEL_VERSION}/${CHPL_TARBALL}"
echo "Downloading Chapel ${CHAPEL_VERSION} from ${CHPL_URL}..."
wget -q "${CHPL_URL}" -O "/tmp/${CHPL_TARBALL}"
tar xzf "/tmp/${CHPL_TARBALL}" -C /opt/
echo "CHPL_HOME=/opt/chapel-${CHAPEL_VERSION}" >> "$GITHUB_ENV"
echo "/opt/chapel-${CHAPEL_VERSION}/bin/linux64-x86_64" >> "$GITHUB_PATH"
- name: Install C runtime libraries
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
libpoppler-glib8t64 libglib2.0-0t64 \
libtesseract5 libleptonica-dev \
libavformat60 libavcodec60 libavutil58 \
libxml2 libgdal34t64 libvips42t64 \
liblmdb0 libarchive13t64 libcurl4t64 \
tesseract-ocr-eng
- name: Verify Chapel installation
run: chpl --version
- name: Build Chapel HPC binary
run: |
mkdir -p bin
ABSPATH=$(cd ffi/zig/zig-out/lib && pwd)
chmod +x ffi/zig/zig-out/lib/libdocudactyl_ffi.so* || true
chpl src/chapel/DocudactylHPC.chpl \
src/chapel/Config.chpl \
src/chapel/ContentType.chpl \
src/chapel/FFIBridge.chpl \
src/chapel/ManifestLoader.chpl \
src/chapel/NdjsonManifest.chpl \
src/chapel/FaultHandler.chpl \
src/chapel/ProgressReporter.chpl \
src/chapel/ShardedOutput.chpl \
src/chapel/ResultAggregator.chpl \
src/chapel/Checkpoint.chpl \
-o bin/docudactyl-hpc \
-Lffi/zig/zig-out/lib -ldocudactyl_ffi \
--ldflags="-Wl,-rpath,$ABSPATH" \
--fast
- name: Smoke test (5 files)
run: |
# Create a small manifest from available system files
TMPDIR=$(mktemp -d)
find /usr/share/icons -name '*.png' 2>/dev/null | head -5 > "$TMPDIR/manifest.txt"
COUNT=$(wc -l < "$TMPDIR/manifest.txt")
echo "Smoke test manifest: $COUNT files"
if [ "$COUNT" -lt 1 ]; then
echo "SKIP: No test files available"
exit 0
fi
export LD_LIBRARY_PATH="ffi/zig/zig-out/lib:$LD_LIBRARY_PATH"
bin/docudactyl-hpc \
--manifestPath="$TMPDIR/manifest.txt" \
--outputDir="$TMPDIR/output" \
--chunkSize=1
# Verify reports were generated
ls "$TMPDIR/output/run-report.scm" "$TMPDIR/output/run-report.json"
# Verify non-zero success count
SUCCEEDED=$(grep -oP 'Succeeded:\s+\K\d+' <<< "$(cat /dev/stdin)" || echo 0)
echo "Smoke test complete"
rm -rf "$TMPDIR"
# ═══════════════════════════════════════════════════════════════════════════
# Job 3: Idris2 ABI — Compile Proofs
# ═══════════════════════════════════════════════════════════════════════════
check-abi:
name: Idris2 ABI Proofs
runs-on: ubuntu-24.04
continue-on-error: true # Idris2 CI setup can be fragile
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install Idris2
run: |
# Install Idris2 via pack (the Idris2 package manager)
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
build-essential libgmp-dev chezscheme
# Clone and build Idris2 from source
git clone --depth 1 --branch v${IDRIS2_VERSION} \
https://github.com/idris-lang/Idris2.git /tmp/idris2-src
cd /tmp/idris2-src
make bootstrap SCHEME=chezscheme
sudo make install
echo "$HOME/.idris2/bin" >> "$GITHUB_PATH"
- name: Verify Idris2 installation
run: idris2 --version
- name: Compile ABI proofs
run: |
cd /home/runner/work/docudactyl/docudactyl
idris2 --build docudactyl.ipkg
- name: Verify no banned patterns
run: |
echo "Checking for banned patterns in Idris2 files..."
BANNED="believe_me|assert_total|assert_smaller|unsafePerformIO"
if grep -rE "$BANNED" src/Docudactyl/ABI/; then
echo "FAIL: Banned patterns found in Idris2 ABI files"
exit 1
fi
echo "PASS: No banned patterns"
# ═══════════════════════════════════════════════════════════════════════════
# Job 4: C ABI Header — Static Assert Verification
# ═══════════════════════════════════════════════════════════════════════════
verify-header:
name: C ABI Header Verification
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Compile header (static assertions)
run: |
cat > /tmp/verify_abi.c << 'CEOF'
#include "generated/abi/docudactyl_ffi.h"
int main(void) { return 0; }
CEOF
gcc -I. -fsyntax-only -c /tmp/verify_abi.c -o /dev/null
echo "PASS: C ABI header compiles, static assertions hold"