Skip to content

build

build #401

Workflow file for this run

name: build
on:
# build on manual trigger from web interface
workflow_dispatch:
# build on automatic trigger from roc-toolkit
repository_dispatch:
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main
schedule:
- cron: '0 0 * * 1'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# build natively on desktop
desktop:
strategy:
fail-fast: false
matrix:
include:
# latest tested JDK
- os: linux
image: ubuntu-latest
jdk: 21
jacoco: yes
- os: osx
image: macos-latest
jdk: 21
jacoco: no
# oldest supported JDK
- os: linux
image: ubuntu-latest
jdk: 17
jacoco: no
- os: osx
image: macos-latest
jdk: 17
jacoco: no
name: desktop/${{ matrix.os }}-jdk${{ matrix.jdk }}
runs-on: ${{ matrix.image }}
env:
# TODO: set to master
ROC_REVISION: v0.2.6
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install JDK
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.jdk }}
distribution: temurin
- name: Install system dependencies
run: scripts/${{ matrix.os }}/install_dependencies.sh
- name: Install Roc
run: scripts/${{ matrix.os }}/build_roc.sh
- name: Build and test bindings
run: scripts/${{ matrix.os }}/build_bindings.sh
- name: Upload test coverage
if: ${{ github.repository_owner == 'roc-streaming' && matrix.jacoco == 'yes' }}
id: jacoco
uses: codecov/codecov-action@v3
with:
files: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml
# build for Android on Linux (with Docker)
android-linux:
strategy:
fail-fast: false
matrix:
include:
# latest tested JDK, SDK, and NDK
- jdk: 21
sdk: 34
api: 29
ndk_r: 26d
ndk: 26.3.11579264
# oldest supported JDK, SDK, and NDK
- jdk: 17
sdk: 31
api: 29
ndk_r: 21e
ndk: 21.4.7075529
name: android/linux-jdk${{ matrix.jdk }}-sdk${{ matrix.sdk }}-ndk${{ matrix.ndk_r }}
runs-on: ubuntu-24.04
env:
# TODO: set to master
ROC_REVISION: v0.2.6
JAVA_VERSION: ${{ matrix.jdk }}
SDK_LEVEL: ${{ matrix.sdk }}
API_LEVEL: ${{ matrix.api }}
NDK_VERSION: ${{ matrix.ndk }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build
run: scripts/android_docker.sh build
# build for Android on macOS
android-osx:
strategy:
fail-fast: false
matrix:
include:
# latest tested JDK, SDK, and NDK
- jdk: 21
sdk: 34
api: 29
ndk_r: 26d
ndk: 26.3.11579264
cmdline_tools: 10406996
build_tools: 35.0.0
cmake: 3.18.1
avd_image: default
avd_arch: x86_64
# oldest tested JDK, SDK, and NDK
- jdk: 17
sdk: 31
api: 29
ndk_r: 21e
ndk: 21.4.7075529
cmdline_tools: 10406996
build_tools: 28.0.3
cmake: 3.10.2.4988404
avd_image: default
avd_arch: x86_64
name: android/osx-jdk${{ matrix.jdk }}-sdk${{ matrix.sdk }}-ndk${{ matrix.ndk_r }}
runs-on: macos-13
env:
# TODO: set to master
ROC_REVISION: v0.2.6
SDK_LEVEL: ${{ matrix.sdk }}
API_LEVEL: ${{ matrix.api }}
NDK_VERSION: ${{ matrix.ndk }}
BUILD_TOOLS_VERSION: ${{ matrix.build_tools }}
CMAKE_VERSION: ${{ matrix.cmake }}
AVD_IMAGE: ${{ matrix.avd_image }}
AVD_ARCH: ${{ matrix.avd_arch }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install JDK
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.jdk }}
distribution: temurin
- name: Install Android SDK
uses: android-actions/setup-android@v3
with:
cmdline-tools-version: ${{ matrix.cmdline_tools }}
- name: Install Android packages
run: |
sdkmanager \
"platforms;android-${{ matrix.sdk }}" \
"build-tools;${{ matrix.build_tools }}" \
"ndk;${{ matrix.ndk }}" \
"cmake;${{ matrix.cmake }}" \
"system-images;android-${{ matrix.sdk }};${{ matrix.avd_image }};${{ matrix.avd_arch }}" \
"emulator"
- name: Install system dependencies
run: scripts/android/install_dependencies.sh
- name: Build Roc
run: scripts/android/build_roc.sh
- name: Build bindings
run: scripts/android/build_bindings.sh
- name: Run Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api }}
arch: ${{ matrix.avd_arch }}
target: ${{ matrix.avd_image }}
avd-name: roc_device
ndk: ${{ matrix.ndk }}
cmake: ${{ matrix.cmake }}
script: ./scripts/android/run_instrumented_tests.sh
release:
needs: [desktop, android-linux, android-osx]
if: startsWith(github.ref, 'refs/tags/v')
name: publish
runs-on: ubuntu-24.04
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Choose roc-toolkit revision
run: echo ROC_REVISION=$(scripts/roc_revision.py) >> $GITHUB_ENV
- name: Publish
run: scripts/android_docker.sh publish