Skip to content

Commit b6f0f4b

Browse files
committed
Add CI
Assisted-by: Cursor
1 parent b843719 commit b6f0f4b

1 file changed

Lines changed: 167 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
pull_request:
7+
branches: [ master, main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, ubuntu-20.04]
15+
include:
16+
- os: ubuntu-latest
17+
cc: gcc
18+
- os: ubuntu-20.04
19+
cc: gcc
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Install dependencies
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y \
28+
autoconf \
29+
automake \
30+
build-essential \
31+
perl \
32+
patch \
33+
diffutils \
34+
xmlto \
35+
libpcre2-dev
36+
37+
- name: Bootstrap
38+
run: ./bootstrap
39+
40+
- name: Configure
41+
run: |
42+
./configure \
43+
--with-pcre2 \
44+
CC=${{ matrix.cc }}
45+
46+
- name: Build
47+
run: make -j$(nproc)
48+
49+
- name: Run tests
50+
run: make check
51+
52+
- name: Show test results on failure
53+
if: failure()
54+
run: |
55+
echo "=== Test logs ==="
56+
find . -name "*.log" -type f -exec echo "=== {} ===" \; -exec cat {} \;
57+
echo "=== Test arena contents ==="
58+
find test-arena -type f 2>/dev/null | head -20 | while read f; do
59+
echo "=== $f ==="
60+
cat "$f" 2>/dev/null || echo "Cannot read file"
61+
done
62+
63+
test-without-pcre2:
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: actions/checkout@v4
67+
68+
- name: Install dependencies (without PCRE2)
69+
run: |
70+
sudo apt-get update
71+
sudo apt-get install -y \
72+
autoconf \
73+
automake \
74+
build-essential \
75+
perl \
76+
patch \
77+
diffutils \
78+
xmlto
79+
80+
- name: Bootstrap
81+
run: ./bootstrap
82+
83+
- name: Configure without PCRE2
84+
run: ./configure --without-pcre2
85+
86+
- name: Build
87+
run: make -j$(nproc)
88+
89+
- name: Run tests
90+
run: make check
91+
92+
test-distcheck:
93+
runs-on: ubuntu-latest
94+
steps:
95+
- uses: actions/checkout@v4
96+
97+
- name: Install dependencies
98+
run: |
99+
sudo apt-get update
100+
sudo apt-get install -y \
101+
autoconf \
102+
automake \
103+
build-essential \
104+
perl \
105+
patch \
106+
diffutils \
107+
xmlto \
108+
libpcre2-dev
109+
110+
- name: Bootstrap
111+
run: ./bootstrap
112+
113+
- name: Configure
114+
run: ./configure --with-pcre2
115+
116+
- name: Build and test distribution
117+
run: make distcheck
118+
119+
test-macos:
120+
runs-on: macos-latest
121+
steps:
122+
- uses: actions/checkout@v4
123+
124+
- name: Install dependencies
125+
run: |
126+
brew install autoconf automake pcre2
127+
128+
- name: Bootstrap
129+
run: ./bootstrap
130+
131+
- name: Configure with PCRE2 paths (skip docs)
132+
run: |
133+
# Get the pcre2 installation path from brew
134+
PCRE2_PREFIX=$(brew --prefix pcre2)
135+
export CPPFLAGS="-I${PCRE2_PREFIX}/include $CPPFLAGS"
136+
export LDFLAGS="-L${PCRE2_PREFIX}/lib $LDFLAGS"
137+
# Configure without xmlto to skip documentation generation
138+
./configure --with-pcre2 XMLTO=no
139+
140+
- name: Build
141+
run: make -j$(sysctl -n hw.ncpu)
142+
143+
- name: Run tests
144+
run: make check
145+
146+
test-macos-without-pcre2:
147+
runs-on: macos-latest
148+
steps:
149+
- uses: actions/checkout@v4
150+
151+
- name: Install dependencies (without PCRE2)
152+
run: |
153+
brew install autoconf automake
154+
155+
- name: Bootstrap
156+
run: ./bootstrap
157+
158+
- name: Configure without PCRE2 (skip docs)
159+
run: |
160+
# Configure without xmlto to skip documentation generation
161+
./configure --without-pcre2 XMLTO=no
162+
163+
- name: Build
164+
run: make -j$(sysctl -n hw.ncpu)
165+
166+
- name: Run tests
167+
run: make check

0 commit comments

Comments
 (0)