1+ name : Continuous Integration
2+
3+ on :
4+ push :
5+ branches : [ main, develop ]
6+ pull_request :
7+ branches : [ main ]
8+ schedule :
9+ - cron : ' 0 0 * * 0' # Weekly validation
10+
11+ jobs :
12+ build-and-test :
13+ runs-on : ${{ matrix.os }}
14+ strategy :
15+ fail-fast : false
16+ matrix :
17+ os : [ubuntu-latest, macos-latest]
18+ compiler : [gcc, clang]
19+ build_type : [Debug, Release]
20+ precision : [10, 30, 60]
21+
22+ name : ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.build_type }}-P${{ matrix.precision }}
23+
24+ steps :
25+ - uses : actions/checkout@v3
26+
27+ - name : Install Dependencies (Ubuntu)
28+ if : runner.os == 'Linux'
29+ run : |
30+ sudo apt-get update
31+ sudo apt-get install -y build-essential cmake libgmp-dev libmpfr-dev valgrind
32+
33+ - name : Install Dependencies (macOS)
34+ if : runner.os == 'macOS'
35+ run : |
36+ brew install cmake gmp mpfr
37+
38+ - name : Configure CMake
39+ run : |
40+ cmake -B build \
41+ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
42+ -DCMAKE_C_COMPILER=${{ matrix.compiler }} \
43+ -DCMAKE_CXX_COMPILER=${{ matrix.compiler == 'gcc' && 'g++' || 'clang++' }}
44+
45+ - name : Build
46+ run : cmake --build build --config ${{ matrix.build_type }} -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)
47+
48+ - name : Run Unit Tests
49+ run : |
50+ cd build
51+ ctest --output-on-failure --verbose
52+
53+ - name : Run Mathematical Validation Tests
54+ run : |
55+ cd build
56+ ./test_gmp_wrapper
57+ ./test_zp
58+ ./test_qp
59+ ./test_functions
60+
61+ - name : Run Reid-Li Criterion Tests
62+ run : |
63+ cd build
64+ ./milestone1_test 5 ${{ matrix.precision }}
65+ ./milestone1_test 7 ${{ matrix.precision }}
66+ ./milestone1_test 11 ${{ matrix.precision }}
67+
68+ - name : Memory Leak Check (Linux only)
69+ if : runner.os == 'Linux' && matrix.build_type == 'Debug'
70+ run : |
71+ cd build
72+ valgrind --leak-check=full --error-exitcode=1 ./test_gmp_wrapper
73+ valgrind --leak-check=full --error-exitcode=1 ./test_zp
74+ valgrind --leak-check=full --error-exitcode=1 ./test_qp
75+
76+ docker-validation :
77+ runs-on : ubuntu-latest
78+ name : Docker Build and Test
79+
80+ steps :
81+ - uses : actions/checkout@v3
82+
83+ - name : Build Docker Image
84+ run : docker build -t libadic:test .
85+
86+ - name : Run Tests in Container
87+ run : |
88+ docker run --rm libadic:test bash -c "cd /libadic/build && cmake .. && make -j && ctest --verbose"
89+
90+ - name : Validate Milestone Tests in Container
91+ run : |
92+ docker run --rm libadic:test bash -c "cd /libadic/build && cmake .. && make -j && ./milestone1_test 7 60"
93+
94+ mathematical-proof-validation :
95+ runs-on : ubuntu-latest
96+ name : Mathematical Proof Verification
97+
98+ steps :
99+ - uses : actions/checkout@v3
100+
101+ - name : Setup Environment
102+ run : |
103+ sudo apt-get update
104+ sudo apt-get install -y build-essential cmake libgmp-dev libmpfr-dev
105+
106+ - name : Build with Maximum Precision
107+ run : |
108+ cmake -B build -DCMAKE_BUILD_TYPE=Release
109+ cmake --build build -j$(nproc)
110+
111+ - name : Verify Core Identities
112+ run : |
113+ cd build
114+ echo "Testing Geometric Series Identity..."
115+ ./test_zp | grep -q "Geometric series: (1-p) \* (1 + p + p^2 + ...) = 1"
116+
117+ echo "Testing Fermat's Little Theorem..."
118+ ./test_zp | grep -q "Fermat's Little Theorem"
119+
120+ echo "Testing Wilson's Theorem..."
121+ ./test_functions | grep -q "Wilson's Theorem"
122+
123+ echo "Testing Gamma Reflection Formula..."
124+ ./test_functions | grep -q "Reflection formula"
125+
126+ echo "Testing Hensel's Lemma..."
127+ ./test_zp | grep -q "Hensel"
128+
129+ - name : Verify Convergence Properties
130+ run : |
131+ cd build
132+ echo "Testing p-adic logarithm convergence..."
133+ ./test_functions | grep -q "Convergence"
134+
135+ echo "Testing series convergence radius..."
136+ ./test_functions | grep -q "converges at minimal valuation"
137+
138+ coverage-report :
139+ runs-on : ubuntu-latest
140+ name : Test Coverage Analysis
141+
142+ steps :
143+ - uses : actions/checkout@v3
144+
145+ - name : Install Dependencies
146+ run : |
147+ sudo apt-get update
148+ sudo apt-get install -y build-essential cmake libgmp-dev libmpfr-dev gcovr
149+
150+ - name : Build with Coverage
151+ run : |
152+ cmake -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="--coverage"
153+ cmake --build build -j$(nproc)
154+
155+ - name : Run Tests for Coverage
156+ run : |
157+ cd build
158+ ctest --verbose
159+ ./milestone1_test 5 30
160+ ./milestone1_test 7 30
161+ ./milestone1_test 11 30
162+
163+ - name : Generate Coverage Report
164+ run : |
165+ gcovr --root . --html --html-details -o coverage.html
166+ gcovr --root . --print-summary
0 commit comments