Skip to content

feat: Define MSRV

feat: Define MSRV #10

Workflow file for this run

name: CI
on:
push:
paths-ignore:
- "docs/**"
- "**/*.md"
pull_request:
paths-ignore:
- "docs/**"
- "**/*.md"
workflow_dispatch: {}
env:
CARGO_TERM_COLOR: always
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# -------------------------- test --------------------------
dart_test_valgrind:
name: Dart test with Valgrind
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.68.0
components: rustfmt
- uses: dart-lang/setup-dart@v1
with:
sdk: stable
architecture: x64
- uses: actions/setup-python@v2
with:
python-version: "3.x"
- uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: just ci_valgrind
# ref https://medium.com/flutter-community/run-flutter-driver-tests-on-github-actions-13c639c7e4ab
flutter_test_ios:
name: Flutter integration test on iOS
strategy:
matrix:
device:
- "iPad (9th generation) Simulator (16.2)"
- "iPhone 12 Pro Max Simulator (16.2)"
fail-fast: false
runs-on: macos-latest
steps:
- name: "List all simulators"
run: "xcrun xctrace list devices"
- name: "Start Simulator"
run: |
# the extra "(" is to avoid matching things like "iPhone 12 Pro Max Simulator (16.2) + Apple Watch Series 5 - 44mm (8.0)"
UDID=$(xcrun xctrace list devices | grep '${{ matrix.device }} (' | awk '{print $NF}' | tr -d '()')
echo UDID=$UDID
xcrun simctl boot "${UDID:?No Simulator with this name found}"
- uses: actions/checkout@v2
id: checkout
- uses: subosito/flutter-action@v2
with:
cache: true
channel: "stable"
flutter-version: 3.10.0
architecture: x64
- id: cache-deps
uses: ./.github/actions/setup
with:
cache-key: "$${{ steps.rust-toolchain.outputs.cachekey }}"
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.68.0
- name: Add Rust targets
run: rustup target add aarch64-apple-ios x86_64-apple-ios
- uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install `cargo-lipo`
run: just install_lipo
- name: Install Flutter dependencies
working-directory: ./frb_example/with_flutter
run: flutter pub get
- name: Build Rust lib
working-directory: ./frb_example/with_flutter/rust
# note the "-i '' -e" is a bug of sed specific to MacOS https://stackoverflow.com/questions/19456518
run: |
sed -i '' -e 's/"cdylib"/"staticlib"/g' Cargo.toml
cargo lipo
cp ../../../target/universal/debug/libflutter_rust_bridge_example.a ../ios/Runner
- name: Run Flutter integration tests
working-directory: ./frb_example/with_flutter
run: flutter test integration_test/main.dart --verbose
# ref https://betterprogramming.pub/test-flutter-apps-on-android-with-github-actions-abdba2137b4
flutter_test_android:
name: Flutter integration test on Android
runs-on: macos-latest
strategy:
matrix:
device:
- "pixel"
- "Nexus 6"
api-level: [29]
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2
with:
cache: true
channel: "stable"
flutter-version: 3.10.0
architecture: x64
- id: checkout
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.68.0
- uses: actions/setup-java@v1
with:
java-version: "11.x" # "betterprogramming.pub" says must be java "8"
- uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# #499, https://github.com/actions/virtual-environments/issues/5595
- name: Configure ndk
run: just configure_ndk
- id: cache-deps
uses: ./.github/actions/setup
with:
cache-key: "${{ steps.rust-toolchain.outputs.cachekey }}"
cache-platform: "${{ matrix.device }}"
- name: Add Rust targets
run: rustup target add x86_64-linux-android
- name: Install `cargo-ndk`
run: just install_ndk
- name: Install Flutter dependencies
working-directory: ./frb_example/with_flutter
run: flutter pub get
- name: Build Rust lib
working-directory: ./frb_example/with_flutter/rust
# NOTE since run on simulator, need -t to be x86_64. For real devices, of course arm-like ones.
run: cargo ndk --bindgen -t x86_64 -o ../android/app/src/main/jniLibs build
- name: Gradle cache
uses: gradle/[email protected]
- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-api-level-${{ matrix.api-level }}
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
# it would success if timeout...
- name: Run Flutter integration tests
continue-on-error: true
timeout-minutes: 20
uses: Wandalen/[email protected]
with:
action: reactivecircus/android-emulator-runner@v2
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim
with: |
api-level: ${{ matrix.api-level }}
arch: x86_64
profile: ${{ matrix.device }}
script: cd frb_example/with_flutter && flutter test integration_test/main.dart --verbose
flutter_test_windows:
name: Flutter integration test on Windows
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2
with:
cache: true
channel: "stable"
flutter-version: 3.10.0
architecture: x64
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.68.0
- uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "10.0"
directory: ${{ runner.temp }}/llvm
- run: just flutter_example_with_flutter_integration_test
- name: Install Corrosion
run: |
cd ..
git clone https://github.com/corrosion-rs/corrosion.git
cmake -Scorrosion -Bbuild -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
cmake --install build --config Release
echo "C:\Program Files (x86)\Corrosion" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Run Flutter integration tests explicitly requiring Corrosion
working-directory: ./frb_example/with_flutter
run: |
mv -Force windows/rust.require.cmake windows/rust.cmake
just flutter_example_with_flutter_integration_test
flutter_test_macos:
name: Flutter integration test on MacOS
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
# TODO should be 3.7.3 but has a weird bug currently
# https://github.com/fzyzcjy/flutter_rust_bridge/pull/1023#issuecomment-1415852845
flutter-version: 3.10.0
architecture: x64
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.68.0
- uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: just flutter_example_with_flutter_integration_test
flutter_test_linux:
name: Flutter integration test on Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2
with:
cache: true
channel: "stable"
flutter-version: 3.10.0
architecture: x64
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.68.0
- name: Setup headless display
uses: pyvista/setup-headless-display-action@v1
- uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: just install_prerequisite_for_integration_test_linux
- run: just flutter_example_with_flutter_integration_test
- run: just install_corrosion_linux
- name: Run Flutter integration tests explicitly requiring Corrosion
working-directory: ./frb_example/with_flutter
run: |
set -euxo pipefail
mv linux/rust.require.cmake linux/rust.cmake
just flutter_example_with_flutter_integration_test
dart_test_web:
name: Dart test on Web
runs-on: ubuntu-latest
strategy:
matrix:
include:
- features: []
- features: [wasm-start]
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
with:
sdk: 3.0.0
architecture: x64
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
target: wasm32-unknown-unknown
components: rust-src,rustfmt
- uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: just install_ffigen
- name: Cache dependencies
id: test-cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
frb_codegen/target
frb_example/pure_dart/rust/target/
frb_example/pure_dart/dart/.local-chromium
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install crates
if: steps.test-cache.outputs.cache-hit != 'true'
run: |
sh -c "$(curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf)" '' -f
- name: Setup Dart dependencies
run: dart pub get
working-directory: frb_dart
- name: Run unit tests
run: just dart_test_web_unit
- name: Run integration tests
timeout-minutes: 20
uses: Wandalen/[email protected]
with:
command: just dart_test_web_integration "${{ join(matrix.features, ',') }}"
current_path: frb_example/pure_dart/dart
dart_test_vm_service:
name: Dart test with vm service
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.68.0
components: rustfmt
- uses: dart-lang/setup-dart@v1
with:
sdk: 3.0.0
architecture: x64
- uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: just install_ffigen_dependency
- run: just dart_test_vm_service
rust_build_and_test:
name: Rust build and test
runs-on: ${{ matrix.image }}
strategy:
fail-fast: false
matrix:
image:
- macos-11
- windows-2019
- ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: rust-toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.68.0
components: rustfmt
- uses: dart-lang/setup-dart@v1
with:
sdk: 3.0.0
architecture: x64
- uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: just install_ffigen_dependency
- run: just dart_pub_get dart_only
- run: just rust_build_and_test
# -------------------------- linter --------------------------
rust_linter:
name: Rust linter
runs-on: ubuntu-latest
strategy:
matrix:
cargo_toolchain_version:
- 1.68.0
steps:
- uses: actions/checkout@v2
- id: rust-toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.cargo_toolchain_version }}
components: rustfmt, clippy
- uses: dart-lang/setup-dart@v1
with:
sdk: 3.0.0
architecture: x64
- uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: just install_ffigen_dependency
- run: just rust_linter
dart_linter:
name: Dart linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
with:
sdk: 3.0.0
architecture: x64
- uses: subosito/flutter-action@v2
with:
cache: true
channel: "stable"
flutter-version: 3.10.0
- uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: just dart_linter
# -------------------------- codegen --------------------------
codegen:
name: Codegen
runs-on: ${{ matrix.image }}
strategy:
fail-fast: false
matrix:
image:
- macos-11
- windows-2019
- ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.68.0
components: rustfmt, clippy
- uses: subosito/flutter-action@v2
with:
cache: true
channel: "stable"
flutter-version: 3.10.0
architecture: x64
- uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: just ci_codegen
msrv:
name: test MSRV and specific problematic versions
runs-on: ubuntu-latest # as of now, there is no real reason to test on multiple OSs
strategy:
matrix:
rust_version:
- nightly # latest nightly
- nightly-2023-06-28 # pre https://github.com/rust-lang/rust/issues/113152
- nightly-2023-07-26 # post https://github.com/rust-lang/rust/issues/113152
#
# DO NOT EDIT BELOW THIS LINE
#
- nightly-2022-07-15 ### nightly MSRV (DO NOT EDIT THIS LINE):
- 1.64 ### stable MSRV (DO NOT EDIT THIS LINE):
#
# DO NOT EDIT ABOVE THIS LINE
#
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust_version }}
components: rustfmt, clippy
# cache cargo and rustup to reduce future build times as much as possible
- uses: actions/cache@v2
with:
path: |
~/.cargo
~/.rustup
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- uses: subosito/flutter-action@v2
with:
cache: true
channel: "stable"
flutter-version: 3.10.0
architecture: x64
- uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: just install_ffigen_dependency
- run: just dart_pub_get dart_only
- run: just rust_build_and_test