diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..879bac7 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,48 @@ +default: + image: registry.fedoraproject.org/fedora-minimal:latest + +stages: + - build + - test + - trigger + +build:lib: + stage: build + tags: + - docker + script: + - microdnf --assumeyes --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 --assumeyes --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 diff --git a/android/.gitlab-ci.yml b/android/.gitlab-ci.yml new file mode 100644 index 0000000..bcf56e1 --- /dev/null +++ b/android/.gitlab-ci.yml @@ -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 + - ./gradlew assembleAndroidTest + # TODO: Add emulator to run tests + needs: + - build:android:aar diff --git a/javascript/.gitlab-ci.yml b/javascript/.gitlab-ci.yml new file mode 100644 index 0000000..4bfcbed --- /dev/null +++ b/javascript/.gitlab-ci.yml @@ -0,0 +1,29 @@ +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/olm_legacy.js + - javascript/index.d.ts + - javascript/exported_functions.json + +test:js: + stage: test + needs: + - build:js + script: + - pushd javascript + - npm i + - npm run test diff --git a/python/.gitlab-ci.yml b/python/.gitlab-ci.yml new file mode 100644 index 0000000..b1a8599 --- /dev/null +++ b/python/.gitlab-ci.yml @@ -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