[ci] Add build with -D_FORTIFY_SOURCE=3
[xapian.git] / .github / workflows / ci.yml
blob1126323271468f659baf93a4953d3034169c4a8a
1 name: CI
3 on:
4   push:
5     paths-ignore:
6       - '.appveyor.yml'
7       - NEWS
8       - 'xapian-maintainer-tools/**'
9   pull_request:
10     branches: RELEASE/1.4
11     paths-ignore:
12       - '.appveyor.yml'
13       - NEWS
14       - 'xapian-maintainer-tools/**'
16   # Allows you to run this workflow manually from the Actions tab
17   workflow_dispatch:
19 jobs:
20   GLIBCXX_DEBUG:
21     runs-on: 'ubuntu-20.04'
22     steps:
23     - name: Check out repository code
24       uses: actions/checkout@v2
25     - name: Install CCache
26       uses: hendrikmuhs/ccache-action@v1
27       with:
28         key: GLIBCXX_DEBUG
29     - name: Install package dependencies
30       run: |
31         sudo apt-get update
32         sudo apt-get install \
33             doxygen \
34             graphviz \
35             help2man \
36             python3-docutils \
37             pngcrush \
38             python3-sphinx \
39             uuid-dev \
40             libpcre2-dev \
41             libmagic-dev \
42             lua5.3 \
43             liblua5.3-dev \
44             mono-devel \
45             python-dev \
46             python3-dev \
47             tcl \
48             tcl-dev
49     - name: bootstrap source tree
50       run: ./bootstrap xapian-core xapian-applications/omega swig xapian-bindings xapian-letor
51     - name: configure
52       run: ./configure CC='ccache gcc' CXX='ccache g++' CPPFLAGS='-D_GLIBCXX_DEBUG'
53     - name: make
54       run: make -j2
55     - name: Run tests
56       run: make -j2 check VERBOSE=1 AUTOMATED_TESTING=1
57     - name: Check generated files are in .gitignore
58       # grep '^' passes through all input while giving a non-zero exit status
59       # if that input is empty.
60       run: git status --porcelain|grep '^' && { echo "The generated files listed above are not in .gitignore" ; exit 1; }; true
62   FORTIFY_SOURCE_3:
63     # _FORTIFY_SOURCE level 3 requires GCC 12, so currently we need to use
64     # Ubuntu 22.04 and the gcc-12 and g++12 packages.
65     runs-on: 'ubuntu-22.04'
66     steps:
67     - name: Check out repository code
68       uses: actions/checkout@v2
69     - name: Install CCache
70       uses: hendrikmuhs/ccache-action@v1
71       with:
72         key: GLIBCXX_DEBUG
73     - name: Install package dependencies
74       run: |
75         sudo apt-get update
76         sudo apt-get install \
77             gcc-12 \
78             g++-12 \
79             doxygen \
80             graphviz \
81             help2man \
82             python3-docutils \
83             pngcrush \
84             python3-sphinx \
85             uuid-dev \
86             libpcre2-dev \
87             libmagic-dev \
88             lua5.3 \
89             liblua5.3-dev \
90             mono-devel \
91             python3-dev \
92             tcl \
93             tcl-dev
94     - name: bootstrap source tree
95       run: ./bootstrap xapian-core xapian-applications/omega swig xapian-bindings xapian-letor
96     - name: configure
97       run: ./configure CC='ccache gcc-12' CXX='ccache g++-12' CPPFLAGS='-D_FORTIFY_SOURCE=3'
98     - name: make
99       run: make -j2
100     - name: Run tests
101       run: make -j2 check VERBOSE=1 AUTOMATED_TESTING=1
102     - name: Check generated files are in .gitignore
103       # grep '^' passes through all input while giving a non-zero exit status
104       # if that input is empty.
105       run: git status --porcelain|grep '^' && { echo "The generated files listed above are not in .gitignore" ; exit 1; }; true
107   clang:
108     runs-on: 'ubuntu-20.04'
109     steps:
110     - name: Check out repository code
111       uses: actions/checkout@v2
112     - name: Install CCache
113       uses: hendrikmuhs/ccache-action@v1
114       with:
115         key: clang
116     - name: Install package dependencies
117       run: |
118         env
119         sudo apt-get update
120         sudo apt-get install \
121             clang \
122             libc++-dev
123         sudo apt-get install \
124             doxygen \
125             graphviz \
126             help2man \
127             python3-docutils \
128             pngcrush \
129             python3-sphinx \
130             uuid-dev \
131             libpcre2-dev \
132             libmagic-dev \
133             tcl \
134             tcl-dev
135     - name: bootstrap source tree
136       run: ./bootstrap xapian-core xapian-applications/omega swig xapian-bindings xapian-letor
137     - name: configure
138       # Build with the llvm c++ library to catch more portability issues.
139       run: ./configure CC='ccache clang' CXX='ccache clang++ -stdlib=libc++' --with-python3 --with-tcl
140     - name: make
141       run: make -j2
142     - name: Run tests
143       run: make -j2 check VERBOSE=1 AUTOMATED_TESTING=1
144     - name: Check generated files are in .gitignore
145       # grep '^' passes through all input while giving a non-zero exit status
146       # if that input is empty.
147       run: git status --porcelain|grep '^' && { echo "The generated files listed above are not in .gitignore" ; exit 1; }; true
149   # GCC 4.7 is the oldest GCC we aim to support for 1.4.x, but the oldest we can
150   # easily build with in github actions is 4.8.  There's no package of GCC 4.8
151   # in Ubuntu 20.04 so we have to run this on 18.04 (also useful to test
152   # there for portability).
153   GCC4-8:
154     name: 'GCC 4.8'
155     runs-on: 'ubuntu-18.04'
156     env:
157       LIBEXTRACTOR_PREFIX: '/usr/lib/x86_64-linux-gnu/libextractor'
158     steps:
159     - name: Check out repository code
160       uses: actions/checkout@v2
161     - name: Install CCache
162       uses: hendrikmuhs/ccache-action@v1
163       with:
164         key: GCC4-8
165     - name: Install package dependencies
166       run: |
167         sudo apt-get update
168         sudo apt-get install \
169             gcc-4.8 \
170             g++-4.8
171         sudo apt-get install \
172             doxygen \
173             graphviz \
174             help2man \
175             python3-docutils \
176             pngcrush \
177             python3-sphinx \
178             uuid-dev \
179             libpcre2-dev \
180             libmagic-dev \
181             lua5.3 \
182             liblua5.3-dev \
183             mono-devel \
184             python3-dev \
185             tcl \
186             tcl-dev
187     - name: bootstrap source tree
188       run: ./bootstrap xapian-core xapian-applications/omega swig xapian-bindings xapian-letor
189     - name: configure
190       run: ./configure CC='ccache gcc-4.8' CXX='ccache g++-4.8'
191     - name: make
192       run: make -j2
193     - name: Run tests
194       run: make -j2 check VERBOSE=1 AUTOMATED_TESTING=1
195     - name: Check generated files are in .gitignore
196       # grep '^' passes through all input while giving a non-zero exit status
197       # if that input is empty.
198       run: git status --porcelain|grep '^' && { echo "The generated files listed above are not in .gitignore" ; exit 1; }; true
200   macos:
201     runs-on: 'macos-latest'
202     steps:
203     - name: Check out repository code
204       uses: actions/checkout@v2
205     - name: Install CCache
206       uses: hendrikmuhs/ccache-action@v1
207       with:
208         key: macos
209     - name: Install package dependencies
210       run: |
211         brew update
212         brew install \
213             doxygen \
214             gmime \
215             graphviz \
216             help2man \
217             libiconv \
218             libmagic \
219             lua \
220             mono-mdk \
221             pcre2 \
222             pkgconfig \
223             pngcrush \
224             python
225         pip3 install sphinx docutils
226     - name: bootstrap source tree
227       run: ./bootstrap xapian-core xapian-applications/omega swig xapian-bindings xapian-letor
228     - name: configure
229       run: ./configure CC='ccache gcc' CXX='ccache g++' CPPFLAGS='-I${{ runner.temp }}/xapian-libsvm-fixed-include' PKG_CONFIG_PATH=/usr/local/opt/icu4c/lib/pkgconfig --prefix='${{ runner.temp }}/XapianInstall' --with-libiconv-prefix=/usr/local/opt/libiconv
230     - name: make
231       run: |
232         make -j3
233         make -C xapian-core install
234     - name: Run tests
235       run: make -j2 check VERBOSE=1 AUTOMATED_TESTING=1
236     - name: Check generated files are in .gitignore
237       # grep '^' passes through all input while giving a non-zero exit status
238       # if that input is empty.
239       run: |
240         find . \( -name 'config.guess~' -o -name 'config.sub~' -o -name 'install-sh~' \) -delete
241         git status --porcelain|grep '^' && { echo "The generated files listed above are not in .gitignore" ; exit 1; }; true
243   checkpatch:
244     name: 'Automated run of xapian-check-patch'
245     runs-on: 'ubuntu-latest'
246     steps:
247     - name: Check out repository code
248       uses: actions/checkout@v2
249       with:
250         fetch-depth: 0
251     - name: "Automated run of xapian-check-patch"
252       # Run the style checking script, checking changes between the common
253       # ancestor of the target branch of the PR (or master if this isn't a PR)
254       # and the revision being checked.
255       run: |
256         echo "GITHUB_BASE_REF='$GITHUB_BASE_REF'"
257         git diff ${GITHUB_BASE_REF:-origin/RELEASE/1.4}.. --|xapian-maintainer-tools/xapian-check-patch