Compare commits

...

4 commits

Author SHA1 Message Date
Arun Babu Neelicattu
e47abe60b4 ci/android: fix stages 2021-04-19 15:53:58 +02:00
Arun Babu Neelicattu
ee91e0acc5 ci/android: publish package (wip) 2021-04-19 15:32:00 +02:00
Arun Babu Neelicattu
e6d4729123 ci: add initial build pipeline 2021-04-19 14:13:01 +02:00
Arun Babu Neelicattu
eca8c2436b python: remove tox basepython configuration 2021-04-19 14:13:01 +02:00
6 changed files with 225 additions and 11 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

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

@ -0,0 +1,50 @@
# TODO: consider replacing this with a smaller image
image: docker.io/inovex/gitlab-ci-android
stages:
- build
- test
- publish
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
- pushd android
cache:
key: ${CI_PROJECT_ID}
paths:
- android/.gradle/
build:android:aar:
stage: build
script:
- ./gradlew clean assembleRelease
artifacts:
expire_in: 1 weeks
paths:
- android/olm-sdk/build/outputs/aar/*.aar
- android/local.properties
test:android:aar:
stage: test
script:
- echo "TODO fix this?"
# - ./gradlew test
needs:
- build:android:aar
publish:android:aar:
stage: publish
script:
- ./gradlew publish
needs:
- build:android:aar
- test:android:aar

View file

@ -13,6 +13,11 @@ buildscript {
}
}
plugins {
id 'java'
id 'maven-publish'
}
allprojects {
repositories {
mavenCentral()
@ -20,6 +25,22 @@ allprojects {
}
}
task clean(type: Delete) {
delete rootProject.buildDir
publishing {
publications {
library(MavenPublication) {
from components.java
}
}
repositories {
maven {
url "https://gitlab.matrix.org/api/v4/projects/27/packages/maven"
credentials(HttpHeaderCredentials) {
name = 'Job-Token'
value = System.getenv("CI_JOB_TOKEN")
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}

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

View file

@ -1,14 +1,8 @@
# content of: tox.ini , put in same dir as setup.py
[tox]
envlist = py27,py36,pypy,{py2,py3}-cov,coverage
[testenv]
basepython =
py27: python2.7
py36: python3.6
pypy: pypy
py2: python2.7
py3: python3.6
[testenv]
deps = -rrequirements.txt
-rtest-requirements.txt
@ -22,14 +16,13 @@ commands =
setenv =
COVERAGE_FILE=.coverage.py2
[testenv:py3-cov]
[testenv:{py,py3}-cov]
commands =
py.test --cov=olm --cov-report term-missing --benchmark-disable --cov-branch
setenv =
COVERAGE_FILE=.coverage.py3
[testenv:coverage]
basepython = python3.6
commands =
coverage erase
coverage combine