Merge pull request #425 from openzim/fix_no_writer_test #870
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-12 | |
- macos-13 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install packages | |
run: | | |
brew update | |
brew unlink python3 | |
# upgrade from [email protected] to [email protected] fails to overwrite those | |
rm -f /usr/local/bin/2to3 /usr/local/bin/2to3-3.12 /usr/local/bin/idle3 /usr/local/bin/idle3.12 /usr/local/bin/pydoc3 /usr/local/bin/pydoc3.12 /usr/local/bin/python3 /usr/local/bin/python3-config /usr/local/bin/python3.12 /usr/local/bin/python3.12-config | |
brew install gcovr ninja libmagic | |
env: | |
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 | |
- name: Install python modules | |
run: pip3 install meson==0.49.2 pytest | |
- name: Install dependencies | |
uses: kiwix/kiwix-build/actions/dl_deps_archive@main | |
with: | |
target_platform: macos-x86_64-dyn | |
- name: Compile | |
shell: bash | |
run: | | |
export PKG_CONFIG_PATH=$HOME/BUILD_x86_64-apple-darwin/INSTALL/lib/pkgconfig | |
export CPPFLAGS="-I$HOME/BUILD_x86_64-apple-darwin/INSTALL/include" | |
meson . build | |
cd build | |
ninja | |
Windows: | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install packages | |
run: | |
choco install pkgconfiglite ninja | |
- name: Install python modules | |
run: pip3 install meson | |
- name: Setup MSVC compiler | |
uses: bus1/cabuild/action/msdevshell@v1 | |
with: | |
architecture: x64 | |
- name: Install dependencies | |
uses: kiwix/kiwix-build/actions/dl_deps_archive@main | |
with: | |
target_platform: win-x86_64-static | |
- name: Compile | |
shell: cmd | |
run: | | |
set PKG_CONFIG_PATH=%cd%\BUILD_win-amd64\INSTALL\lib\pkgconfig | |
set CPPFLAGS=-I%cd%\BUILD_win-amd64\INSTALL\include | |
meson.exe setup . build -Dstatic-linkage=true --buildtype=debug | |
cd build | |
ninja.exe | |
- name: Test | |
shell: cmd | |
run: | | |
cd build | |
meson.exe test --verbose | |
env: | |
WAIT_TIME_FACTOR_TEST: 10 | |
Linux: | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- linux-x86_64-static | |
- linux-x86_64-dyn | |
- win32-static | |
- win32-dyn | |
include: | |
- target: linux-x86_64-static | |
image_variant: focal | |
lib_postfix: '/x86_64-linux-gnu' | |
arch_name: linux-x86_64 | |
run_test: true | |
coverage: true | |
- target: linux-x86_64-dyn | |
image_variant: focal | |
lib_postfix: '/x86_64-linux-gnu' | |
arch_name: linux-x86_64 | |
run_test: true | |
coverage: true | |
- target: win32-static | |
image_variant: f35 | |
lib_postfix: '64' | |
arch_name: i686-w64-mingw32 | |
run_test: false | |
coverage: false | |
- target: win32-dyn | |
image_variant: f35 | |
lib_postfix: '64' | |
arch_name: i686-w64-mingw32 | |
run_test: false | |
coverage: false | |
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: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
uses: kiwix/kiwix-build/actions/dl_deps_archive@main | |
with: | |
target_platform: ${{ matrix.target }} | |
- name: Compile | |
shell: bash | |
run: | | |
if [[ "${{matrix.target}}" =~ .*-static ]]; then | |
MESON_OPTION="-Dstatic-linkage=true" | |
fi | |
if [ -e "$HOME/BUILD_${{matrix.arch_name}}/meson_cross_file.txt" ]; then | |
MESON_OPTION="$MESON_OPTION --cross-file $HOME/BUILD_${{matrix.arch_name}}/meson_cross_file.txt" | |
fi | |
meson . build ${MESON_OPTION} -Db_coverage=true | |
cd build | |
ninja | |
env: | |
PKG_CONFIG_PATH: "${{env.HOME}}/BUILD_${{matrix.arch_name}}/INSTALL/lib/pkgconfig:${{env.HOME}}/BUILD_${{matrix.arch_name}}/INSTALL/lib${{matrix.lib_postfix}}/pkgconfig" | |
CPPFLAGS: "-I${{env.HOME}}/BUILD_${{matrix.arch_name}}/INSTALL/include" | |
- name: Test | |
if: matrix.run_test | |
shell: bash | |
run: | | |
cd build | |
meson test --verbose | |
if [[ "${{matrix.coverage}}" = "true" ]]; then | |
ninja coverage | |
fi | |
env: | |
LD_LIBRARY_PATH: "${{env.HOME}}/BUILD_${{matrix.arch_name}}/INSTALL/lib${{matrix.lib_postfix}}" | |
- name: Publish coverage | |
if: matrix.coverage | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} |