88
99jobs :
1010 test :
11- runs-on : ubuntu-latest
11+ runs-on : ${{ matrix.os == 'alpine' && 'ubuntu-latest' || 'ubuntu-latest' }}
12+ container : ${{ matrix.os == 'alpine' && 'alpine:latest' || null }}
13+
14+ strategy :
15+ fail-fast : false
16+ matrix :
17+ include :
18+ # Ubuntu tests
19+ - name : " Ubuntu with PCRE2 + Coverage"
20+ os : ubuntu
21+ pcre2 : true
22+ coverage : true
23+ configure_flags : " --with-pcre2"
24+
25+ - name : " Ubuntu without PCRE2"
26+ os : ubuntu
27+ pcre2 : false
28+ coverage : false
29+ configure_flags : " --without-pcre2"
30+
31+ - name : " Ubuntu Scanner-based lsdiff + Coverage"
32+ os : ubuntu
33+ pcre2 : true
34+ coverage : true
35+ scanner_lsdiff : true
36+ configure_flags : " --with-pcre2 --enable-scanner-lsdiff"
37+
38+ # Alpine (musl) tests
39+ - name : " Alpine with PCRE2"
40+ os : alpine
41+ pcre2 : true
42+ coverage : false
43+ configure_flags : " --with-pcre2"
44+
45+ - name : " Alpine without PCRE2"
46+ os : alpine
47+ pcre2 : false
48+ coverage : false
49+ configure_flags : " --without-pcre2"
50+
51+ name : ${{ matrix.name }}
1252
1353 steps :
1454 - uses : actions/checkout@v4
1555
16- - name : Install dependencies
56+ # Install dependencies - Ubuntu
57+ - name : Install dependencies (Ubuntu)
58+ if : matrix.os == 'ubuntu'
1759 run : |
1860 sudo apt-get update
1961 sudo apt-get install -y \
@@ -28,23 +70,87 @@ jobs:
2870 gnulib \
2971 lcov
3072
73+ # Install dependencies - Alpine with PCRE2
74+ - name : Install dependencies (Alpine with PCRE2)
75+ if : matrix.os == 'alpine' && matrix.pcre2
76+ run : |
77+ apk add --no-cache \
78+ build-base \
79+ autoconf \
80+ automake \
81+ perl \
82+ patch \
83+ diffutils \
84+ xmlto \
85+ pcre2-dev \
86+ bash \
87+ git \
88+ coreutils \
89+ python3
90+
91+ # Install dependencies - Alpine without PCRE2
92+ - name : Install dependencies (Alpine without PCRE2)
93+ if : matrix.os == 'alpine' && !matrix.pcre2
94+ run : |
95+ apk add --no-cache \
96+ build-base \
97+ autoconf \
98+ automake \
99+ perl \
100+ patch \
101+ diffutils \
102+ xmlto \
103+ bash \
104+ git \
105+ coreutils \
106+ python3
107+
108+ # Bootstrap - Ubuntu
31109 - name : Bootstrap
110+ if : matrix.os == 'ubuntu'
32111 run : ./bootstrap
33112
113+ # Bootstrap - Alpine
114+ - name : Bootstrap (Alpine)
115+ if : matrix.os == 'alpine'
116+ run : |
117+ ./gnulib-update.sh
118+ export PATH="/tmp/gnulib:$PATH"
119+ ./bootstrap
120+
121+ # Configure
34122 - name : Configure
35123 run : |
36- ./configure \
37- --with-pcre2 \
38- CFLAGS="--coverage -g -O0" \
39- LDFLAGS="--coverage"
124+ CFLAGS_EXTRA=""
125+ LDFLAGS_EXTRA=""
126+
127+ if [ "${{ matrix.coverage }}" = "true" ]; then
128+ CFLAGS_EXTRA="--coverage -g -O0"
129+ LDFLAGS_EXTRA="--coverage"
130+ fi
131+
132+ ./configure ${{ matrix.configure_flags }} \
133+ ${CFLAGS_EXTRA:+CFLAGS="$CFLAGS_EXTRA"} \
134+ ${LDFLAGS_EXTRA:+LDFLAGS="$LDFLAGS_EXTRA"}
40135
136+ # Build
41137 - name : Build
42138 run : make -j$(nproc)
43139
140+ # Test
44141 - name : Run tests
45142 run : make check
46143
144+ # Scanner-specific tests (only for scanner-lsdiff job)
145+ - name : Run scanner-specific tests
146+ if : matrix.scanner_lsdiff
147+ run : |
148+ echo "=== Running Scanner Unit Tests ==="
149+ make -C tests/scanner check
150+
151+ # Coverage reporting (only for coverage builds)
47152 - name : Generate coverage report
153+ if : matrix.coverage
48154 run : |
49155 # Create coverage directory
50156 mkdir -p coverage
73179 echo "FUNCTIONS_COVERED=$FUNCTIONS_COVERED" >> $GITHUB_ENV
74180
75181 - name : Upload coverage to Codecov
182+ if : matrix.coverage
76183 uses : codecov/codecov-action@v4
77184 with :
78185 file : ./coverage/coverage_filtered.info
81188 fail_ci_if_error : false
82189 token : ${{ secrets.CODECOV_TOKEN }}
83190
191+ # Show failures
84192 - name : Show test results on failure
85193 if : failure()
86194 run : |
@@ -92,38 +200,10 @@ jobs:
92200 cat "$f" 2>/dev/null || echo "Cannot read file"
93201 done
94202
95- test-without-pcre2 :
203+ # Separate distcheck job (doesn't fit well in matrix)
204+ distcheck :
96205 runs-on : ubuntu-latest
97- steps :
98- - uses : actions/checkout@v4
99-
100- - name : Install dependencies (without PCRE2)
101- run : |
102- sudo apt-get update
103- sudo apt-get install -y \
104- autoconf \
105- automake \
106- build-essential \
107- perl \
108- patch \
109- diffutils \
110- xmlto \
111- gnulib
112-
113- - name : Bootstrap
114- run : ./bootstrap
115206
116- - name : Configure without PCRE2
117- run : ./configure --without-pcre2
118-
119- - name : Build
120- run : make -j$(nproc)
121-
122- - name : Run tests
123- run : make check
124-
125- test-distcheck :
126- runs-on : ubuntu-latest
127207 steps :
128208 - uses : actions/checkout@v4
129209
@@ -150,96 +230,6 @@ jobs:
150230 - name : Build and test distribution
151231 run : make distcheck
152232
153- test-musl :
154- runs-on : ubuntu-latest
155- container : alpine:latest
156- steps :
157- - uses : actions/checkout@v4
158-
159- - name : Install dependencies
160- run : |
161- apk add --no-cache \
162- build-base \
163- autoconf \
164- automake \
165- perl \
166- patch \
167- diffutils \
168- xmlto \
169- pcre2-dev \
170- bash \
171- git \
172- coreutils \
173- python3
174-
175- - name : Clone gnulib for bootstrap
176- run : |
177- ./gnulib-update.sh
178-
179- - name : Bootstrap
180- run : |
181- export PATH="/tmp/gnulib:$PATH"
182- ./bootstrap
183-
184- - name : Configure
185- run : ./configure --with-pcre2
186-
187- - name : Build
188- run : make -j$(nproc)
189-
190- - name : Run tests
191- run : make check
192-
193- - name : Show test results on failure
194- if : failure()
195- run : |
196- echo "=== Test logs ==="
197- find . -name "*.log" -type f -exec echo "=== {} ===" \; -exec cat {} \;
198- echo "=== Test arena contents ==="
199- find test-arena -type f 2>/dev/null | head -20 | while read f; do
200- echo "=== $f ==="
201- cat "$f" 2>/dev/null || echo "Cannot read file"
202- done
203-
204- test-musl-without-pcre2 :
205- runs-on : ubuntu-latest
206- container : alpine:latest
207- steps :
208- - uses : actions/checkout@v4
209-
210- - name : Install dependencies (without PCRE2)
211- run : |
212- apk add --no-cache \
213- build-base \
214- autoconf \
215- automake \
216- perl \
217- patch \
218- diffutils \
219- xmlto \
220- bash \
221- git \
222- coreutils \
223- python3
224-
225- - name : Clone gnulib for bootstrap
226- run : |
227- ./gnulib-update.sh
228-
229- - name : Bootstrap
230- run : |
231- export PATH="/tmp/gnulib:$PATH"
232- ./bootstrap
233-
234- - name : Configure without PCRE2
235- run : ./configure --without-pcre2
236-
237- - name : Build
238- run : make -j$(nproc)
239-
240- - name : Run tests
241- run : make check
242-
243233 - name : Show test results on failure
244234 if : failure()
245235 run : |
@@ -249,6 +239,4 @@ jobs:
249239 find test-arena -type f 2>/dev/null | head -20 | while read f; do
250240 echo "=== $f ==="
251241 cat "$f" 2>/dev/null || echo "Cannot read file"
252- done
253-
254-
242+ done
0 commit comments