Skip to content

service: Fix accept cancel safety + improve concurrency #476

service: Fix accept cancel safety + improve concurrency

service: Fix accept cancel safety + improve concurrency #476

Workflow file for this run

name: CI
on: [push]
env:
PROPTEST_CASES: 32
jobs:
check_rust_crates:
name: check rust crates on ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
name: [android, linux, windows]
include:
- name: android
os: ubuntu-24.04
cargo-command: cross
cargo-dir: ~/.cargo
target: aarch64-linux-android
- name: linux
os: ubuntu-24.04
cargo-command: cargo
cargo-dir: ~/.cargo
- name: windows
os: windows-latest
cargo-command: cargo
cargo-dir: ~\cargo
steps:
- uses: actions/checkout@v4
- name: Show rustc version
run: rustc --version
- name: Add rust target
if: matrix.target != ''
run: rustup target add ${{ matrix.target }}
- uses: actions/cache@v3
with:
path: |
${{ matrix.cargo-dir }}/bin/
${{ matrix.cargo-dir }}/registry/index/
${{ matrix.cargo-dir }}/registry/cache/
${{ matrix.cargo-dir }}/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Install system dependencies
if: matrix.name == 'linux'
# NOTE: libfuse-dev is required only to build and run the ouisync
# application. It is not required for building and using the ouisync
# library.
run: sudo apt-get install libfuse-dev
- name: Install cross
if: matrix.cargo-command == 'cross'
run: cargo install cross --force --git https://github.com/cross-rs/cross
- name: Run clippy
run: >
${{ matrix.cargo-command }} clippy
--package ouisync --package ouisync-bridge --package ouisync-service
${{ matrix.target != '' && format('--target {0}', matrix.target) || '' }}
--all-targets
--no-deps
-- -Dwarnings
- name: Run unit tests
if: matrix.name == 'linux'
run: ${{ matrix.cargo-command }} test --lib
- name: Run lib integration tests
if: matrix.name == 'linux'
run: ${{ matrix.cargo-command }} test --package ouisync --test gc --test network --test sync
env:
RUST_LOG: ouisync=debug,gc=debug,network=debug,sync=debug
- name: Run cli integration tests
if: matrix.name == 'linux'
run: ${{ matrix.cargo-command }} test --package ouisync-cli --test cli
# TODO: The kotlin bindings need to be updated to the new service architecture, disabled for now
# check_kotlin_bindings:
# name: check kotlin bindings
# runs-on: ubuntu-24.04
# steps:
# - uses: actions/checkout@v4
# - name: Add rust targets
# run: rustup target add x86_64-linux-android armv7-linux-androideabi aarch64-linux-android
# - name: Setup java
# uses: actions/setup-java@v3
# with:
# distribution: 'temurin'
# java-version: '17'
# - name: Setup gradle
# uses: gradle/[email protected]
# - name: Install system dependencies
# # NOTE: fuse isn't used by the bindings themselves but it's required for the unit tests
# # because they use the linux version of the ouisync_service library, not the android one
# # and the linux version does currently unconditionally depend on fuse.
# run: sudo apt-get install libfuse-dev
# # - name: Install NDK
# # uses: nttld/setup-ndk@v1
# # with:
# # ndk-version: r27c
# # link-to-sdk: true
# # local-cache: true
# - name: Cache cargo artifacts
# uses: actions/cache@v3
# with:
# path: |
# ~/.cargo/bin/
# ~/.cargo/registry/index/
# ~/.cargo/registry/cache/
# ~/.cargo/git/db/
# target/
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
# restore-keys: |
# ${{ runner.os }}-cargo-
# - name: Cache gradle artifacts
# uses: actions/cache@v3
# with:
# path: |
# ~/.gradle/caches
# ~/.gradle/wrapper
# key: ${{ runner.os }}-gradle-${{ hashFiles('bindings/kotlin/**/*.gradle*', 'bindings/kotlin/**/gradle-wrapper.properties') }}
# restore-keys: |
# ${{ runner.os }}-gradle-
# - name: Create local.properties
# working-directory: bindings/kotlin
# run: echo "useLocalLib=true" > local.properties
# - name: Run spotless
# working-directory: bindings/kotlin
# run: ./gradlew --stacktrace spotlessCheck
# - name: Run lint
# working-directory: bindings/kotlin
# run: ./gradlew --stacktrace lint
# - name: Run unit tests
# working-directory: bindings/kotlin
# run: ./gradlew --stacktrace lib:testDebugUnitTest
# - name: Build the example app
# working-directory: bindings/kotlin
# run: ./gradlew --stacktrace example:assembleDebug
check_dart_bindings:
name: check dart bindings on ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
name: [linux, windows]
include:
- name: linux
os: ubuntu-24.04
env:
OUISYNC_LIB: ../../target/debug/libouisync_service.so
cargo-dir: ~/.cargo
- name: windows
os: windows-latest
env:
OUISYNC_LIB: ..\..\target\debug\ouisync_service.dll
DOKAN_DLL_OUTPUT_PATH: C:\Windows\System32
cargo-dir: ~\cargo
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
# Cache rust artifacts
- uses: actions/cache@v3
with:
path: |
${{ matrix.cargo-dir }}/bin/
${{ matrix.cargo-dir }}/registry/index/
${{ matrix.cargo-dir }}/registry/cache/
${{ matrix.cargo-dir }}/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Install system dependencies
if: matrix.name == 'linux'
run: sudo apt-get install libfuse-dev
- name: Get dart dependencies
working-directory: bindings/dart
run: flutter pub get
- name: Generate bindings
working-directory: bindings/dart
run: dart run util/bindgen.dart
- name: Analyze
# analyze should be the same on all platforms so run it on just one to save time
if: matrix.name == 'linux'
working-directory: bindings/dart
run: |
dart analyze lib
dart analyze test
dart analyze example
- name: Build the ouisync service library for tests
run: cargo build -p ouisync-service --lib
- name: DEBUG
run: Get-Location
if: matrix.name == 'windows'
- name: Run tests
working-directory: bindings/dart
env:
RUST_LOG: ouisync=debug,sqlx=warn
run: flutter test