mirror of https://github.com/kiwix/libkiwix.git
Merge pull request #309 from kiwix/github-action
Use github actions to run the CI.
This commit is contained in:
commit
fa091a19c6
|
@ -0,0 +1,139 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on: [pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Macos:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
- name: Setup python 3.5
|
||||||
|
uses: actions/setup-python@v1
|
||||||
|
with:
|
||||||
|
python-version: '3.5'
|
||||||
|
- name: Install packages
|
||||||
|
uses: mstksg/get-package@v1
|
||||||
|
with:
|
||||||
|
brew: gcovr pkg-config ninja
|
||||||
|
- name: Install python modules
|
||||||
|
run: pip3 install meson==0.49.2 pytest
|
||||||
|
- name: Install deps
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
ARCHIVE_NAME=deps2_osx_native_dyn_kiwix-lib.tar.xz
|
||||||
|
wget -O- http://tmp.kiwix.org/ci/${ARCHIVE_NAME} | tar -xJ -C $HOME
|
||||||
|
- name: Compile
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
export PKG_CONFIG_PATH=$HOME/BUILD_native_dyn/INSTALL/lib/pkgconfig
|
||||||
|
export CPPFLAGS="-I$HOME/BUILD_native_dyn/INSTALL/include"
|
||||||
|
meson . build --default-library=shared
|
||||||
|
cd build
|
||||||
|
ninja
|
||||||
|
- name: Test
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
export LD_LIBRARY_PATH=$HOME/BUILD_native_dyn/INSTALL/lib:$HOME/BUILD_native_dyn/INSTALL/lib64
|
||||||
|
cd build
|
||||||
|
meson test --verbose
|
||||||
|
env:
|
||||||
|
SKIP_BIG_MEMORY_TEST: 1
|
||||||
|
|
||||||
|
|
||||||
|
Linux:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
target:
|
||||||
|
- native_static
|
||||||
|
- native_dyn
|
||||||
|
- android_arm
|
||||||
|
- android_arm64
|
||||||
|
- win32_static
|
||||||
|
- win32_dyn
|
||||||
|
include:
|
||||||
|
- target: native_static
|
||||||
|
image_variant: xenial
|
||||||
|
lib_postfix: '/x86_64-linux-gnu'
|
||||||
|
- target: native_dyn
|
||||||
|
image_variant: xenial
|
||||||
|
lib_postfix: '/x86_64-linux-gnu'
|
||||||
|
- target: android_arm
|
||||||
|
image_variant: xenial
|
||||||
|
lib_postfix: '/x86_64-linux-gnu'
|
||||||
|
- target: android_arm64
|
||||||
|
image_variant: xenial
|
||||||
|
lib_postfix: '/x86_64-linux-gnu'
|
||||||
|
- target: win32_static
|
||||||
|
image_variant: f31
|
||||||
|
lib_postfix: '64'
|
||||||
|
- target: win32_dyn
|
||||||
|
image_variant: f31
|
||||||
|
lib_postfix: '64'
|
||||||
|
env:
|
||||||
|
HOME: /home/runner
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: "kiwix/kiwix-build_ci:${{matrix.image_variant}}-26"
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
shell: python
|
||||||
|
run: |
|
||||||
|
import json
|
||||||
|
from subprocess import check_call
|
||||||
|
from os import environ
|
||||||
|
with open(environ['GITHUB_EVENT_PATH'], 'r') as f:
|
||||||
|
content = f.read()
|
||||||
|
event_data = json.loads(content)
|
||||||
|
try:
|
||||||
|
branch_ref = event_data['ref'].split('/')[-1]
|
||||||
|
except KeyError:
|
||||||
|
branch_ref = event_data['pull_request']['head']['ref']
|
||||||
|
print("Cloning branch", branch_ref)
|
||||||
|
command = [
|
||||||
|
'git', 'clone',
|
||||||
|
'https://github.com/${{github.repository}}',
|
||||||
|
'--depth=1',
|
||||||
|
'--branch', branch_ref
|
||||||
|
]
|
||||||
|
check_call(command, cwd=environ['HOME'])
|
||||||
|
- name: Install deps
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
ARCHIVE_NAME=deps2_${OS_NAME}_${{matrix.target}}_kiwix-lib.tar.xz
|
||||||
|
wget -O- http://tmp.kiwix.org/ci/${ARCHIVE_NAME} | tar -xJ -C /home/runner
|
||||||
|
- name: Compile
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
meson --version
|
||||||
|
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"
|
||||||
|
else
|
||||||
|
MESON_OPTION="$MESON_OPTION --cross-file $HOME/BUILD_${{matrix.target}}/meson_cross_file.txt"
|
||||||
|
fi
|
||||||
|
if [[ "${{matrix.target}}" =~ android_.* ]]; then
|
||||||
|
MESON_OPTION="$MESON_OPTION -Dandroid=true"
|
||||||
|
fi
|
||||||
|
cd $HOME/kiwix-lib
|
||||||
|
meson . build ${MESON_OPTION}
|
||||||
|
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"
|
||||||
|
CPPFLAGS: "-I/home/runner/BUILD_${{matrix.target}}/INSTALL/include"
|
||||||
|
- name: Test
|
||||||
|
if: startsWith(matrix.target, 'native_')
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd $HOME/kiwix-lib/build
|
||||||
|
meson test --verbose
|
||||||
|
ninja coverage
|
||||||
|
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
|
43
.travis.yml
43
.travis.yml
|
@ -1,43 +0,0 @@
|
||||||
language: cpp
|
|
||||||
dist: xenial
|
|
||||||
sudo: true
|
|
||||||
cache: ccache
|
|
||||||
before_install:
|
|
||||||
- PATH=$PATH:$HOME/bin
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew unlink python@2; brew link --overwrite python@3; fi
|
|
||||||
install: travis/install_deps.sh
|
|
||||||
script: travis/compile.sh
|
|
||||||
env:
|
|
||||||
matrix:
|
|
||||||
- PLATFORM="native_static"
|
|
||||||
- PLATFORM="native_dyn"
|
|
||||||
- PLATFORM="win32_static"
|
|
||||||
- PLATFORM="win32_dyn"
|
|
||||||
- PLATFORM="android_arm"
|
|
||||||
- PLATFORM="android_arm64"
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- cmake
|
|
||||||
- python3.5
|
|
||||||
- python3-pip
|
|
||||||
- libbz2-dev
|
|
||||||
- ccache
|
|
||||||
- zlib1g-dev
|
|
||||||
- uuid-dev
|
|
||||||
- libctpp2-dev
|
|
||||||
- ctpp2-utils
|
|
||||||
- libmicrohttpd-dev
|
|
||||||
- g++-mingw-w64-i686
|
|
||||||
- gcc-mingw-w64-i686
|
|
||||||
- gcc-mingw-w64-base
|
|
||||||
- mingw-w64-tools
|
|
||||||
- gcovr
|
|
||||||
homebrew:
|
|
||||||
update: true
|
|
||||||
packages:
|
|
||||||
- gcovr
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- env: PLATFORM="native_dyn"
|
|
||||||
os: osx
|
|
|
@ -1,57 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
BUILD_DIR=${HOME}/BUILD_${PLATFORM}
|
|
||||||
INSTALL_DIR=${BUILD_DIR}/INSTALL
|
|
||||||
|
|
||||||
TEST=0
|
|
||||||
case ${PLATFORM} in
|
|
||||||
"native_static")
|
|
||||||
MESON_OPTION="--default-library=static"
|
|
||||||
TEST=1
|
|
||||||
;;
|
|
||||||
"native_dyn")
|
|
||||||
MESON_OPTION="--default-library=shared"
|
|
||||||
TEST=1
|
|
||||||
;;
|
|
||||||
"win32_static")
|
|
||||||
MESON_OPTION="--default-library=static --cross-file ${BUILD_DIR}/meson_cross_file.txt"
|
|
||||||
;;
|
|
||||||
"win32_dyn")
|
|
||||||
MESON_OPTION="--default-library=shared --cross-file ${BUILD_DIR}/meson_cross_file.txt"
|
|
||||||
;;
|
|
||||||
"android_arm")
|
|
||||||
MESON_OPTION="-Dandroid=true --default-library=shared --cross-file ${BUILD_DIR}/meson_cross_file.txt"
|
|
||||||
;;
|
|
||||||
"android_arm64")
|
|
||||||
MESON_OPTION="-Dandroid=true --default-library=shared --cross-file ${BUILD_DIR}/meson_cross_file.txt"
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
|
||||||
|
|
||||||
cd ${TRAVIS_BUILD_DIR}
|
|
||||||
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]
|
|
||||||
then
|
|
||||||
export PKG_CONFIG_PATH=${INSTALL_DIR}/lib/pkgconfig
|
|
||||||
else
|
|
||||||
export PKG_CONFIG_PATH=${INSTALL_DIR}/lib/x86_64-linux-gnu/pkgconfig
|
|
||||||
fi
|
|
||||||
export CPPFLAGS="-I${INSTALL_DIR}/include"
|
|
||||||
if [[ "$TEST" == "1" ]]
|
|
||||||
then
|
|
||||||
MESON_OPTION="${MESON_OPTION} -Db_coverage=true"
|
|
||||||
fi
|
|
||||||
meson . build ${MESON_OPTION}
|
|
||||||
cd build
|
|
||||||
ninja
|
|
||||||
if [[ "$TEST" == "1" ]]
|
|
||||||
then
|
|
||||||
echo "Running test"
|
|
||||||
export LD_LIBRARY_PATH=${INSTALL_DIR}/lib:${INSTALL_DIR}/lib64:${INSTALL_DIR}/lib/x86_64-linux-gnu
|
|
||||||
meson test --verbose
|
|
||||||
ninja coverage
|
|
||||||
cd ..
|
|
||||||
echo "*** Publish code coverage"
|
|
||||||
bash <(curl -s https://codecov.io/bash)
|
|
||||||
fi
|
|
|
@ -1,37 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
REPO_NAME=${TRAVIS_REPO_SLUG#*/}
|
|
||||||
|
|
||||||
# Ninja
|
|
||||||
cd $HOME
|
|
||||||
if [[ "$TRAVIS_OS_NAME" == "osx" ]]
|
|
||||||
then
|
|
||||||
# upgrade wget as openssl is updated by travis
|
|
||||||
brew upgrade wget
|
|
||||||
pip3 install meson==0.49.2
|
|
||||||
|
|
||||||
wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip
|
|
||||||
unzip ninja-mac.zip ninja
|
|
||||||
ARCHIVE_NAME=deps_osx_${PLATFORM}_${REPO_NAME}.tar.xz
|
|
||||||
else
|
|
||||||
wget https://bootstrap.pypa.io/get-pip.py
|
|
||||||
python3.5 get-pip.py --user
|
|
||||||
|
|
||||||
python3.5 -m pip install --user --upgrade pip
|
|
||||||
python3.5 -m pip install --user meson==0.49.2
|
|
||||||
|
|
||||||
wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip
|
|
||||||
unzip ninja-linux.zip ninja
|
|
||||||
ARCHIVE_NAME=deps_linux_xenial_${PLATFORM}_${REPO_NAME}.tar.xz
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p $HOME/bin
|
|
||||||
cp ninja $HOME/bin
|
|
||||||
|
|
||||||
# Dependencies comming from kiwix-build.
|
|
||||||
cd ${HOME}
|
|
||||||
wget http://tmp.kiwix.org/ci/${ARCHIVE_NAME}
|
|
||||||
tar xf ${HOME}/${ARCHIVE_NAME}
|
|
||||||
sudo ln -s travis ../ci_builder
|
|
Loading…
Reference in New Issue