Compile Windows CI with dependencies build by kiwix-build #1764
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-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 }} |