ci: add initial build pipeline

This commit is contained in:
Arun Babu Neelicattu 2021-03-24 15:21:26 +01:00
parent eca8c2436b
commit e6d4729123
4 changed files with 196 additions and 0 deletions

48
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,48 @@
default:
image: registry.fedoraproject.org/fedora-minimal:latest
stages:
- build
- test
- trigger
build:lib:
stage: build
tags:
- docker
script:
- microdnf --nodocs install cmake gcc gcc-c++
- cmake . -Bbuild
- cmake --build build
artifacts:
paths:
- build/
test:lib:
stage: test
tags:
- docker
needs:
- build:lib
script:
- microdnf --nodocs install cmake
- pushd build/tests
- ctest .
trigger:android:
stage: trigger
trigger:
strategy: depend
include: android/.gitlab-ci.yml
trigger:javascript:
stage: trigger
trigger:
strategy: depend
include: javascript/.gitlab-ci.yml
trigger:python:
stage: trigger
trigger:
strategy: depend
include: python/.gitlab-ci.yml

46
android/.gitlab-ci.yml Normal file
View file

@ -0,0 +1,46 @@
# TODO: consider replacing this with a smaller image
image: docker.io/inovex/gitlab-ci-android
stages:
- build
- test
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- export ANDROID_HOME=${ANDORID_SDK_HOME}
- echo "sdk.dir=${ANDROID_SDK_HOME}" > ./android/local.properties
- echo "ndk.dir=${ANDROID_NDK_HOME}" >> ./android/local.properties
- cp -R $ANDROID_SDK_ROOT/licenses ./android/.
- chmod +x ./android/gradlew
cache:
key: ${CI_PROJECT_ID}
paths:
- android/.gradle/
build:android:aar:
stage: build
tags:
- docker
script:
- pushd android
- ./gradlew clean assembleRelease
artifacts:
expire_in: 1 weeks
paths:
- android/olm-sdk/build/outputs/aar/*.aar
- android/local.properties
test:android:aar:
stage: test
tags:
- docker
script:
- pushd android
# TODO: fix this?
# - ./gradlew test
needs:
- build:android:aar

27
javascript/.gitlab-ci.yml Normal file
View file

@ -0,0 +1,27 @@
default:
image: docker.io/emscripten/emsdk:latest
stages:
- build
- test
build:js:
stage: build
script:
- ln -sf $(which python3) /usr/local/bin/python
- make js
artifacts:
paths:
- build/javascript
- javascript/olm.js
- javascript/olm.wasm
- javascript/exported_functions.json
test:js:
stage: test
needs:
- build:js
script:
- pushd javascript
- npm i
- npm run test

75
python/.gitlab-ci.yml Normal file
View file

@ -0,0 +1,75 @@
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
LD_LIBRARY_PATH: "$CI_PROJECT_DIR/build"
DEFAULT_PYTHON: "3.9"
cache:
paths:
- .cache/pip
stages:
- build
- test
- dist
before_script:
- pushd python
- pip --disable-pip-version-check install --upgrade pip
build:python:
stage: build
image: docker.io/python:$DEFAULT_PYTHON
cache: { }
before_script: [ ]
script:
- apt-get -y update && apt-get -y install cmake
- cmake . -Bbuild
- cmake --build build
artifacts:
paths:
- build
test:python:
stage: test
image: docker.io/python:$PYTHON_VERSIONS
parallel:
matrix:
- PYTHON_VERSIONS: [ "3.6", "3.7", "3.8", "3.9" ]
script:
- pip install tox
- make headers
- tox -e py
dependencies:
- build:python
artifacts:
paths:
- python/.coverage
- python/coverage.xml
dist:python:sdist:
stage: dist
image: docker.io/python:$DEFAULT_PYTHON
script:
- pip install build
- python -m build --sdist
dependencies: [ ]
artifacts:
paths:
- python/build/**
- python/dist/*.tar.gz
dist:python:wheel:
stage: dist
image: docker.io/python:$PYTHON_VERSIONS
parallel:
matrix:
- PYTHON_VERSIONS: [ "3.6", "3.7", "3.8", "3.9" ]
script:
- pip install build
- python -m build --wheel
dependencies:
- build:python
artifacts:
paths:
- python/build/**
- python/dist/*.whl