Merge branch 'master' into develop #2473
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
paths-ignore: | |
- '**/README.md' | |
pull_request: | |
branches: [master] | |
jobs: | |
build_and_test: | |
name: build and test on ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
name: [android, linux, windows] | |
include: | |
- name: android | |
os: ubuntu-latest | |
env: | |
OUISYNC_LIB: ouisync/target/debug/libouisync_ffi.so | |
target: aarch64-linux-android armv7-linux-androideabi x86_64-linux-android | |
ndk: | |
version: r27 | |
abi: arm64-v8a | |
build-args: --apk | |
artifact-files: ouisync*.apk | |
- name: linux | |
os: ubuntu-latest | |
env: | |
OUISYNC_LIB: ouisync/target/debug/libouisync_ffi.so | |
# TODO: enable analysis | |
# analyze: true | |
build-args: --deb-gui --deb-cli | |
artifact-files: ouisync*.deb | |
- name: windows | |
os: windows-latest | |
env: | |
# Install Dokan2.dll to where `flutter test` can find it | |
DOKAN_DLL_OUTPUT_PATH: C:\Windows\System32 | |
OUISYNC_LIB: ouisync\target\debug\ouisync_ffi.dll | |
build-args: --exe | |
artifact-files: ouisync*.exe | |
env: ${{ matrix.env }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Add rust target | |
run: rustup target add ${{ matrix.target }} | |
if: matrix.target != '' | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
if: matrix.name == 'android' | |
- name: Install build dependencies (linux) | |
run: | | |
# https://github.com/orgs/community/discussions/109146 | |
sudo apt update -y | |
sudo apt-get install libappindicator3-dev \ | |
libfuse-dev \ | |
libgtk-3-dev \ | |
ninja-build | |
if: matrix.name == 'linux' | |
- name: Install build dependencies (android) | |
# Note that libfuse-dev is not required to build the Android app, but | |
# later in this CI script we also run tests on Linux which do require | |
# it. | |
run: sudo apt-get install libfuse-dev | |
if: matrix.name == 'android' | |
- name: Install Android NDK | |
uses: nttld/setup-ndk@v1 | |
with: | |
ndk-version: ${{ matrix.ndk.version }} | |
link-to-sdk: true | |
if: matrix.ndk.version != '' | |
- name: Set NDK ABI filter | |
run: echo "ndk.abiFilters=${{ matrix.ndk.abi }}" >> android/local.properties | |
if: matrix.ndk.abi != '' | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
flutter-version: 3.24.1 | |
- name: Run Flutter doctor | |
run: flutter doctor -v | |
- name: Get Flutter packages | |
run: dart pub get | |
- name: Generate the Dart bindings for the Ouisync library | |
working-directory: ouisync/bindings/dart | |
run: dart util/bindgen.dart | |
- name: Analyze | |
run: | | |
pushd lib | |
flutter analyze | |
popd | |
pushd test | |
flutter analyze | |
popd | |
pushd util | |
flutter analyze | |
popd | |
if: matrix.analyze | |
- name: Build Ouisync library for tests | |
working-directory: ouisync | |
run: cargo build --package ouisync-ffi --lib | |
- name: Run tests | |
run: | |
flutter test | |
- name: Setup Sentry DSN for artifact build (different from the production releases) | |
run: | | |
mkdir -p secrets/android | |
echo $NIGHTLY_SENTRY_DSN > secrets/sentry_dsn | |
shell: bash | |
env: | |
NIGHTLY_SENTRY_DSN : ${{ secrets.NIGHTLY_SENTRY_DSN }} | |
if: env.NIGHTLY_SENTRY_DSN != null | |
- name: Setup secrets for artifact signing (different from the production releases) | |
run: | | |
mkdir -p secrets/android | |
echo $NIGHTLY_KEYSTORE_JKS_HEX > secrets/android/keystore.jks.hex | |
# Use `keytool` to generate the `keystore.jks` keystore. | |
# The keystore.jks.hex file can then be generated by | |
# | |
# $ xxd -p keystore.jks keystore.jks.hex | |
# | |
xxd -r -p secrets/android/keystore.jks.hex secrets/android/keystore.jks | |
echo "storePassword=$NIGHTLY_KEYSTORE_PASSWORD" > secrets/android/key.properties | |
echo "keyPassword=$NIGHTLY_KEYSTORE_PASSWORD" >> secrets/android/key.properties | |
echo "keyAlias=nightly" >> secrets/android/key.properties | |
echo "storeFile=../../secrets/android/keystore.jks" >> secrets/android/key.properties | |
shell: bash | |
env: | |
NIGHTLY_KEYSTORE_JKS_HEX : ${{ secrets.NIGHTLY_KEYSTORE_JKS_HEX }} | |
NIGHTLY_KEYSTORE_PASSWORD : ${{ secrets.NIGHTLY_KEYSTORE_PASSWORD }} | |
if: env.NIGHTLY_KEYSTORE_JKS_HEX != null && env.NIGHTLY_KEYSTORE_PASSWORD != null | |
- name: Build artifacts | |
run: | | |
flavor=$([ -f secrets/android/key.properties ] && echo 'nightly' || echo 'unofficial' ) | |
dart run util/release.dart --flavor=$flavor ${{ matrix.build-args }} | |
shell: bash | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
# Name of the produced zip file | |
name: ${{ matrix.name }} | |
path: releases/release_*/${{ matrix.artifact-files }} |