-
Notifications
You must be signed in to change notification settings - Fork 42
103 lines (99 loc) · 3.86 KB
/
Copy pathpull-request.yml
File metadata and controls
103 lines (99 loc) · 3.86 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
name: pull request
on:
pull_request:
paths:
- "CMakeLists.txt"
- "CMakePresets.json"
- "bindings/node/**"
- "cmake/**"
- "contracts/**"
- "corpus/**"
- "include/**"
- "models/**"
- "oracle/**"
- "src/**"
- "tests/unit/**"
- "tests/integration/**"
- "tests/fixtures/**"
- "tools/apple/**"
- "tools/webgpu/**"
- "tools/bootstrap_dependencies.py"
- "tools/bootstrap_models.py"
- "tools/generate_release_metadata.py"
- "tools/package_model_bundle.py"
- "tools/run_offline_check.py"
permissions:
contents: read
concurrency:
group: pull-request-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
linux-x64:
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
with:
python-version: "3.11"
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: "22"
- name: Restore locked build inputs
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
with:
path: |
.cache/dependencies
.cache/models
key: pr-inputs-${{ runner.os }}-${{ hashFiles('models/deps.lock.json', 'models/bundles.lock.json') }}
- name: Validate repository and release tooling contracts
run: python -m unittest discover -s tests/python -p 'test_*.py'
- name: Bootstrap locked build inputs
shell: bash
run: |
python tools/bootstrap_dependencies.py \
--cache-dir .cache/dependencies \
--platform-id linux-x64-gnu
python tools/bootstrap_models.py --cache-dir .cache/models
- name: Install verified Node development files
shell: bash
run: |
npm install --ignore-scripts --no-audit --no-fund
node_version="$(node -p process.versions.node)"
node_dev="$PWD/.cache/node-gyp/$node_version"
npx --yes node-gyp@11.4.2 install "$node_version" --devdir "$PWD/.cache/node-gyp"
test -f "$node_dev/include/node/node_api.h"
echo "NODE_INCLUDE_DIR=$node_dev/include/node" >> "$GITHUB_ENV"
- name: Configure the representative release build
shell: bash
run: >-
cmake -S . -B build-pr -G Ninja
-DCMAKE_BUILD_TYPE=Release
-DLIGHT_OCR_DEPENDENCY_CACHE_DIR="$PWD/.cache/dependencies"
-DLIGHT_OCR_BUILD_NODE=ON
-DLIGHT_OCR_BUILD_TESTS=ON
-DLIGHT_OCR_BUILD_TOOLS=ON
-DLIGHT_OCR_PARITY_LIVE_ORACLE=OFF
-DLIGHT_OCR_NODE_INCLUDE_DIR="$NODE_INCLUDE_DIR"
-DLIGHT_OCR_NODE_EXECUTABLE="$(command -v node)"
- name: Build and test Core and Node contracts
run: |
cmake --build build-pr --parallel
ctest --test-dir build-pr --output-on-failure \
-LE "acceptance|canonical-oracle|webgpu-contract"
- name: Run the complete Node adapter and CLI suite
working-directory: bindings/node
env:
LIGHT_OCR_NODE_BINARY: ${{ github.workspace }}/build-pr/node-runtime/native/light_ocr_node.node
LIGHT_OCR_RUNTIME_DESCRIPTOR: ${{ github.workspace }}/build-pr/node-runtime/native/runtime-descriptor.json
LIGHT_OCR_MODEL_BUNDLE: ${{ github.workspace }}/models/generated/ppocrv6-small-onnx-20260714.2
run: npm test
- name: Prove runtime operation without network access
shell: bash
run: >-
sudo unshare --net --
python tools/run_offline_check.py
--validate build-pr/bin/light_ocr_validate
--bundle models/generated/ppocrv6-small-onnx-20260714.2
--fixture corpus/fixtures/generated-hello-123/fixture.json
--require-network-disabled