-
Notifications
You must be signed in to change notification settings - Fork 43
86 lines (75 loc) · 2.5 KB
/
ci.yml
File metadata and controls
86 lines (75 loc) · 2.5 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
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: x86_64
cmake_extra: ""
- os: macos-latest
arch: arm64
cmake_extra: ""
- os: windows-latest
arch: x64
cmake_extra: ""
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} (${{ matrix.arch }})
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install dependencies (Ubuntu)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y cmake
- name: Configure CMake
run: >
cmake -B build
-DCMAKE_BUILD_TYPE=Release
-DTQ_BUILD_TESTS=ON
-DTQ_BUILD_BENCH=ON
-DTQ_BUILD_SERVER=ON
${{ matrix.cmake_extra }}
- name: Build (Unix)
if: runner.os != 'Windows'
run: cmake --build build --config Release -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)
- name: Build (Windows)
if: runner.os == 'Windows'
run: cmake --build build --config Release -j $env:NUMBER_OF_PROCESSORS
- name: Run tests
run: ctest --test-dir build --output-on-failure --timeout 120 -C Release
# 10-year position guard: fail CI if structural moats erode.
# Runs on Linux only (POSIX shell). Checks single-header LOC/size,
# zero-deps, papers count, honest correction track, PyPI presence.
- name: 10-year position guard
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
chmod +x score.sh
bash score.sh --position 2>&1 | tee /tmp/position.log
# Extract dimension percentage; require >= 75%.
pct=$(grep -E '^\s*position\s' /tmp/position.log | awk '{print $2}' | tr -d '%')
echo "position dimension: ${pct}%"
if [ -z "$pct" ]; then
echo "could not parse position score"
exit 1
fi
# bash arithmetic: integer compare
if [ "${pct%.*}" -lt 75 ]; then
echo "::error::Position dimension regressed below 75% (${pct}%)"
exit 1
fi
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}-${{ matrix.arch }}
path: build/Testing/
retention-days: 7