-
-
Notifications
You must be signed in to change notification settings - Fork 52
239 lines (214 loc) · 7.03 KB
/
ci.yml
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
name: CI
on:
pull_request:
push:
branches:
- main
jobs:
macOS:
strategy:
fail-fast: false
matrix:
os:
- macos-13
target:
- native_dyn
- iOS_arm64
- iOS_x86_64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install packages
run: |
brew update
brew install gcovr pkg-config ninja || brew link --overwrite python
- name: Install python modules
run: pip3 install meson pytest
- name: Install dependences
uses: kiwix/kiwix-build/actions/dl_deps_archive@download_deps_action
with:
os_name: macos
target_platform: ${{ matrix.target }}
- name: Compile
shell: bash
run: |
MESON_OPTION="--default-library=shared"
MESON_CROSSFILE="$HOME/BUILD_${{matrix.target}}/meson_cross_file.txt"
if [[ ! "${{matrix.target}}" =~ native_.* ]]; then
MESON_OPTION="$MESON_OPTION --cross-file $MESON_CROSSFILE -Dstatic-linkage=true"
cat $MESON_CROSSFILE
fi
export PKG_CONFIG_PATH=$HOME/BUILD_${{matrix.target}}/INSTALL/lib/pkgconfig
meson . build ${MESON_OPTION}
cd build
ninja
- name: Test
if: startsWith(matrix.target, 'native_')
shell: bash
run: |
export LD_LIBRARY_PATH=$HOME/BUILD_${{matrix.target}}/INSTALL/lib:$HOME/BUILD_${{matrix.target}}/INSTALL/lib64
cd build
ninja download_test_data
meson test --verbose
env:
SKIP_BIG_MEMORY_TEST: 1
WAIT_TIME_FACTOR_TEST: 10
Windows:
runs-on: windows-2019
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install packages
run:
choco install ninja
- name: Install python modules
run: pip3 install meson pykg-config
- name: Setup MSVC compiler
uses: bus1/cabuild/action/msdevshell@v1
with:
architecture: x64
- name: Install dependences
uses: kiwix/kiwix-build/actions/dl_deps_archive@download_deps_action
with:
os_name: windows
target_platform: native_mixed
- name: debgu
shell: bash
run: |
which meson.exe
chmod +x /c/hostedtoolcache/windows/Python/3.10.11/x64/Scripts/pkg-config.bat
ls -l /c/hostedtoolcache/windows/Python/3.10.11/x64/Scripts/
echo $PATH
cat /c/hostedtoolcache/windows/Python/3.10.11/x64/Scripts/pkg-config.bat
- name: Compile
env:
PKG_CONFIG_PATH: BUILD_native_mixed\INSTALL\lib\pkgconfig;BUILD_native_static\INSTALL\lib\pkgconfig
CC: cl.exe
CXX: cl.exe
run: |
meson.exe setup build . -Ddefault_library=static
type build/meson-logs/meson-log.txt
meson.exe compile -C build --verbose
- name: Test
shell: cmd
run: |
cd build
ninja download_test_data
meson test --verbose
env:
WAIT_TIME_FACTOR_TEST: 10
Linux:
strategy:
fail-fast: false
matrix:
target:
- native_static
- native_dyn
- alpine_dyn
- aarch64_dyn
- android_arm
- android_arm64
- win32_static
- win32_dyn
- wasm
with_xapian:
- true
- false
include:
- target: native_static
image_variant: focal
lib_postfix: '/x86_64-linux-gnu'
- target: native_dyn
image_variant: focal
lib_postfix: '/x86_64-linux-gnu'
- target: alpine_dyn
image_variant: alpine
lib_postfix: '/x86_64-linux-musl'
- target: aarch64_dyn
image_variant: focal
lib_postfix: '/aarch64-linux-gnu'
- target: android_arm
image_variant: focal
lib_postfix: '/arm-linux-androideabi'
- target: android_arm64
image_variant: focal
lib_postfix: '/aarch64-linux-android'
- target: win32_static
image_variant: f35
lib_postfix: '64'
- target: win32_dyn
image_variant: f35
lib_postfix: '64'
- target: wasm
image_variant: focal
lib_postfix: '/x86_64-linux-gnu'
env:
HOME: /home/runner
runs-on: ubuntu-22.04
container:
image: "ghcr.io/kiwix/kiwix-build_ci_${{matrix.image_variant}}:2023-10-30"
steps:
- name: Install dependences
if: false == startsWith(matrix.target, 'alpine_')
uses: kiwix/kiwix-build/actions/dl_deps_archive@download_deps_action
with:
target_platform: ${{ matrix.target }}
- name: Retrieve source code
uses: actions/checkout@v3
- name: Compile source code
shell: bash
env:
PKG_CONFIG_PATH: ${{env.HOME}}/BUILD_${{matrix.target}}/INSTALL/lib/pkgconfig:${{env.HOME}}/BUILD_${{matrix.target}}/INSTALL/lib${{matrix.lib_postfix}}/pkgconfig
run: |
if [[ "${{matrix.target}}" =~ .*_dyn ]]
then
MESON_OPTION="--default-library=shared"
else
MESON_OPTION="--default-library=static"
fi
if [[ "${{matrix.target}}" =~ native_.* ]]
then
MESON_OPTION="$MESON_OPTION -Db_coverage=true"
elif [[ "${{matrix.target}}" != alpine_* ]]
then
MESON_OPTION="$MESON_OPTION --cross-file ${{ env.HOME }}/BUILD_${{ matrix.target }}/meson_cross_file.txt"
fi
if [[ "${{matrix.target}}" =~ android_.* ]]
then
MESON_OPTION="$MESON_OPTION -Dstatic-linkage=true -DUSE_BUFFER_HEADER=false"
fi
if [[ "${{matrix.target}}" == wasm ]]
then
MESON_OPTION="$MESON_OPTION -Dexamples=false"
fi
meson setup . build ${MESON_OPTION} -Dwith_xapian=${{matrix.with_xapian}}
cd build
ninja
- name: Run automated tests
shell: bash
if: startsWith(matrix.target, 'native_') || startsWith(matrix.target, 'alpine_')
env:
LD_LIBRARY_PATH: "${{env.HOME}}/BUILD_${{matrix.target}}/INSTALL/lib:${{env.HOME}}/BUILD_${{matrix.target}}/INSTALL/lib${{matrix.lib_postfix}}"
SKIP_BIG_MEMORY_TEST: 1
WAIT_TIME_FACTOR_TEST: 10
run: |
cd build
ninja download_test_data
meson test --verbose
if [[ "${{matrix.target}}" =~ native_.* ]]; then
ninja coverage
fi
- name: Upload code coverage
uses: codecov/codecov-action@v3
if: startsWith(matrix.target, 'native_')
with:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}