-
-
Notifications
You must be signed in to change notification settings - Fork 52
202 lines (198 loc) · 6.41 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
name: CI
on: [push]
jobs:
Macos:
strategy:
fail-fast: false
matrix:
target:
- native_dyn
- iOS_arm64
- iOS_x86_64
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup python 3.9
uses: actions/setup-python@v1
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==0.52.1 pytest
- name: Install deps
shell: bash
run: |
ARCHIVE_NAME=deps2_osx_${{matrix.target}}_libzim.tar.xz
wget -O- http://tmp.kiwix.org/ci/${ARCHIVE_NAME} | tar -xJ -C $HOME
- 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 -Db_bitcode=true --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@v2
with:
python-version: '3.10'
- name: Install packages
run:
choco install ninja
- name: Install python modules
run: pip3 install meson
- name: Compile
shell: cmd
run: .github\script\build_libzim.cmd
- 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
- android_arm
- android_arm64
- win32_static
- win32_dyn
- wasm
with_xapian:
- true
- false
include:
- target: native_static
image_variant: bionic
lib_postfix: '/x86_64-linux-gnu'
- target: native_dyn
image_variant: bionic
lib_postfix: '/x86_64-linux-gnu'
- target: android_arm
image_variant: bionic
lib_postfix: '/arm-linux-androideabi'
- target: android_arm64
image_variant: bionic
lib_postfix: '/aarch64-linux-android'
- target: wasm
image_variant: bionic
lib_postfix: '/x86_64-linux-gnu'
- target: alpine_dyn
image_variant: alpine
lib_postfix: '/x86_64-linux-musl'
- target: win32_static
image_variant: f35
lib_postfix: '64'
- target: win32_dyn
image_variant: f35
lib_postfix: '64'
env:
HOME: /home/runner
runs-on: ubuntu-latest
container:
image: "kiwix/kiwix-build_ci:${{matrix.image_variant}}-32"
steps:
- name: Checkout code
shell: python
run: |
from subprocess import check_call
from os import environ
config_command = [
'git', 'config', '--global',
'http.postBuffer', '1048576000'
]
check_call(config_command, cwd=environ['HOME'])
clone_command = [
'git', 'clone',
'https://github.com/${{github.repository}}',
'--depth=1',
'--branch', '${{github.ref_name}}'
]
check_call(clone_command, cwd=environ['HOME'])
- name: Install deps
if: false == startsWith(matrix.target, 'alpine_')
shell: bash
run: |
ARCHIVE_NAME=deps2_${OS_NAME}_${{matrix.target}}_libzim.tar.xz
wget -O- http://tmp.kiwix.org/ci/${ARCHIVE_NAME} | tar -xJ -C /home/runner
- name: Compile
shell: bash
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 $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
cd $HOME/libzim
meson . build ${MESON_OPTION} -Dwith_xapian=${{matrix.with_xapian}}
cd build
ninja
env:
PKG_CONFIG_PATH: "/home/runner/BUILD_${{matrix.target}}/INSTALL/lib/pkgconfig:/home/runner/BUILD_${{matrix.target}}/INSTALL/lib${{matrix.lib_postfix}}/pkgconfig"
- name: Test
if: startsWith(matrix.target, 'native_') || startsWith(matrix.target, 'alpine_')
shell: bash
run: |
cd $HOME/libzim/build
ninja download_test_data
meson test --verbose
if [[ "${{matrix.target}}" =~ native_.* ]]; then
ninja coverage
fi
env:
LD_LIBRARY_PATH: "/home/runner/BUILD_${{matrix.target}}/INSTALL/lib:/home/runner/BUILD_${{matrix.target}}/INSTALL/lib${{matrix.lib_postfix}}"
SKIP_BIG_MEMORY_TEST: 1
WAIT_TIME_FACTOR_TEST: 10
- name: Publish coverage
shell: bash
run: |
cd $HOME/libzim
curl https://codecov.io/bash -o codecov.sh
bash codecov.sh -n "${OS_NAME}_${{matrix.target}}" -Z
rm codecov.sh
if: startsWith(matrix.target, 'native_')
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}