Compile Windows CI with dependencies build by kiwix-build #1748
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
macOS: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-11 | |
- macos-12 | |
- macos-13 | |
- macos-13-xlarge | |
target: | |
- native_dyn | |
- iOS_arm64 | |
- iOS_x86_64 | |
exclude: | |
# iOS cross-compilation only on the 2 latest versions of macOS x86_64 | |
- os: macos-11 | |
target: iOS_arm64 | |
- os: macos-11 | |
target: iOS_x86_64 | |
- os: macos-13-xlarge | |
target: iOS_arm64 | |
- os: macos-13-xlarge | |
target: iOS_x86_64 | |
# TODO: iOS cross-compilation on macOS 13 compilation has to be fixed | |
# https://github.com/openzim/libzim/issues/834 | |
- os: macos-13 | |
target: iOS_arm64 | |
- os: macos-13 | |
target: iOS_x86_64 | |
# TODO: M1 runner is still in beta and not reliable | |
- os: macos-13-xlarge | |
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==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@v4 | |
with: | |
python-version: '3.10' | |
- name: Install packages | |
run: | |
choco install ninja | |
- name: Install python modules | |
run: pip3 install meson | |
- name: Install dependences | |
if: false == startsWith(matrix.target, 'alpine_') | |
run: | | |
ARCHIVE_NAME=deps2_windows_native_mixed_libzim.tar.xz | |
wget -O- http://tmp.kiwix.org/ci/dev_preview/winCI/${ARCHIVE_NAME} | tar -xJ -C ${{env.HOME}} | |
- 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 | |
- 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_') | |
run: | | |
ARCHIVE_NAME=deps2_${OS_NAME}_${{matrix.target}}_libzim.tar.xz | |
wget -O- http://tmp.kiwix.org/ci/${ARCHIVE_NAME} | tar -xJ -C ${{env.HOME}} | |
- 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 }} |