Skip to content

Translations update from Hosted Weblate #2776

Translations update from Hosted Weblate

Translations update from Hosted Weblate #2776

Workflow file for this run

name: CI
on:
push:
paths-ignore:
- '**/README.md'
pull_request:
branches: [master]
env:
cache_path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
ouisync/target/
jobs:
build_and_test:
name: build and/or test on ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
name: [android, linux-test, linux-build, windows]
include:
- name: android
os: ubuntu-24.04
env:
OUISYNC_LIB: ouisync/target/debug/libouisync_service.so
target: aarch64-linux-android armv7-linux-androideabi x86_64-linux-android
ndk:
abi: arm64-v8a
build-args: --apk
artifact-files: ouisync*.apk
test: true
build: true
- name: linux-test
os: ubuntu-24.04
env:
OUISYNC_LIB: ouisync/target/debug/libouisync_service.so
# TODO: enable analysis
# analyze: true
build-args: --deb-gui --deb-cli
artifact-files: ouisync*.deb
test: true
build: false
# For GLIBC and GLIBCXX compatibility we build on not-the-most-recent Ubuntu version
- name: linux-build
os: ubuntu-22.04
env:
OUISYNC_LIB: ouisync/target/debug/libouisync_service.so
# TODO: enable analysis
# analyze: true
build-args: --deb-gui --deb-cli
artifact-files: ouisync*.deb
test: false
build: true
- 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_service.dll
build-args: --exe
# FIXME: The mount test fails on windows CI with a panic somewhere in the dokan-rust
# crate. Disabling for now but it needs to be looked into.
test-args: --exclude-tags mount
artifact-files: ouisync*.exe
test: true
build: true
env: ${{ matrix.env }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Restore cache
id: cache-restore
uses: actions/cache/restore@v4
with:
path: ${{ env.cache_path }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- 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 dependencies (linux)
run: |
# https://github.com/orgs/community/discussions/109146
sudo apt update -y
sudo apt-get install libappindicator3-dev \
libcurl4-openssl-dev \
libfuse-dev \
libgtk-3-dev \
libsecret-1-dev \
ninja-build \
imagemagick
if: matrix.name == 'linux-test' || matrix.name == 'linux-build'
- name: Install 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 imagemagick
if: matrix.name == 'android'
# FIXME: when dokan is installed some tests fail with weird panic from the dokan-rust library.
# Disabling for now. See also the comment for the `test-args` variable in the `windows`
# strategy.
# - name: Install dependencies (windows)
# run: choco install dokany2
# if: matrix.name == 'windows'
- 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.29.3
cache: true
- 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 tool/bindgen.dart
- name: Analyze
run: |
pushd lib
flutter analyze
popd
pushd test
flutter analyze
popd
pushd util
flutter analyze
popd
if: matrix.analyze
- name: Test util
run: |
dart util/test.dart
if: matrix.name == 'linux-test'
# HACK: dokan-sys puts Dokan2.dll to C:\Windows\System but not if it's cached (the crate
# doesn't rebuild itself when the dll is missing likely due to missing
# `cargo:rerun-if-changed` directive in its build.rs). Clean the cached version to force
# rebuild.
# TODO: We should patch dokan-sys to rebuild itself when the dll is missing.
- name: "[HACK] Force dokan-sys to build"
run: cargo clean --package dokan-sys
working-directory: ouisync
if: matrix.name == 'windows'
- name: Build Ouisync service library for tests
working-directory: ouisync
run: cargo build --package ouisync-service --lib
if: matrix.test
- name: Run tests
run:
flutter test ${{ matrix.test-args }}
if: matrix.test
- name: Setup Sentry DSN for artifact build (different from the production releases)
run: |
mkdir -p secrets/
echo $NIGHTLY_SENTRY_DSN > secrets/sentry_dsn
shell: bash
env:
NIGHTLY_SENTRY_DSN : ${{ secrets.NIGHTLY_SENTRY_DSN }}
if: matrix.build && env.NIGHTLY_SENTRY_DSN != null
- name: Setup secrets for artifact signing (different from the production releases)
run: |
dir=secrets/android
mkdir -p $dir
echo $NIGHTLY_KEYSTORE_JKS_HEX > $dir/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 $dir/keystore.jks.hex $dir/keystore.jks
echo "storePassword=$NIGHTLY_KEYSTORE_PASSWORD" > $dir/key.properties
echo "keyPassword=$NIGHTLY_KEYSTORE_PASSWORD" >> $dir/key.properties
echo "keyAlias=nightly" >> $dir/key.properties
echo "storeFile=../../$dir/keystore.jks" >> $dir/key.properties
shell: bash
env:
NIGHTLY_KEYSTORE_JKS_HEX : ${{ secrets.NIGHTLY_KEYSTORE_JKS_HEX }}
NIGHTLY_KEYSTORE_PASSWORD : ${{ secrets.NIGHTLY_KEYSTORE_PASSWORD }}
if: matrix.build && env.NIGHTLY_KEYSTORE_JKS_HEX != null && env.NIGHTLY_KEYSTORE_PASSWORD != null
- name: Build artifacts
run: |
key_properties_path=secrets/android/key.properties
sentry_dsn_path=secrets/sentry_dsn
flavor=$([ -f $key_properties_path ] && echo 'nightly' || echo 'unofficial' )
keystore=$([ "$flavor" = 'nightly' ] && echo "--android-key-properties=$key_properties_path" || true)
sentry=$([ -f $sentry_dsn_path ] && echo "--sentry=$sentry_dsn_path" || true)
dart run util/release.dart --flavor=$flavor $keystore $sentry ${{ matrix.build-args }}
shell: bash
if: matrix.build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
# Name of the produced zip file
name: ${{ matrix.name }}
path: releases/release_*/${{ matrix.artifact-files }}
if: matrix.build
- name: Save cache
id: cache-save
if: always() && steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
path: ${{ env.cache_path }}