Skip to content

Build & Test

Build & Test #168

Workflow file for this run

name: Build & Test
on:
pull_request:
push:
branches:
- main
schedule:
- cron: "0 10 * * *" # run everyday at 10 AM
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
# Setup
- uses: actions/checkout@v5
- uses: cachix/install-nix-action@v31
- uses: subosito/flutter-action@v2 # TODO remove this once flutter is in flake
with:
channel: master
- name: Install direnv
run: |
curl -sfL https://direnv.net/install.sh | bash
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Load environment variables
run: |
direnv allow .
direnv export gha > "$GITHUB_ENV"
# Rust
- name: Rust lint
run: cargo clippy -- -D warnings
- name: Rust format
run: cargo fmt --all --check
- name: Rust tests
run: cargo test
# Dart/Flutter
- name: Dart lint
run: flutter analyze --fatal-infos --fatal-warnings
- name: Dart format
run: dart format --set-exit-if-changed .
- name: Dart tests
run: melos run test
macos_integration_test:
runs-on: macos-latest
steps:
- uses: actions/checkout@v5
- uses: subosito/flutter-action@v2
- uses: bluefireteam/melos-action@v3
- run: melos run init-integration-test-boilerplate
- run: melos run integration-test -- -d macos
windows_integration_test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
- uses: subosito/flutter-action@v2
- uses: bluefireteam/melos-action@v3
- run: melos run init-integration-test-boilerplate
- run: melos run integration-test -- -d windows
linux_integration_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: subosito/flutter-action@v2
- uses: bluefireteam/melos-action@v3
- uses: pyvista/setup-headless-display-action@v3
- name: Install dependencies for flutter integration test
run: sudo apt update && sudo apt-get install -y libglu1-mesa ninja-build clang cmake pkg-config libgtk-3-dev liblzma-dev
- run: melos run init-integration-test-boilerplate
- run: melos run integration-test -- -d linux
ios_integration_test:
runs-on: macos-latest
steps:
- uses: actions/checkout@v5
- uses: subosito/flutter-action@v2
- uses: bluefireteam/melos-action@v3
- name: Start iOS Simulator
uses: futureware-tech/simulator-action@v4
id: start_simulator
with:
wait_for_boot: true
- run: melos run init-integration-test-boilerplate
# NOTE: we often get timeouts without a couple retries due to flakey macOS runners
- name: Run Flutter integration tests
uses: Wandalen/wretry.action@v3
with:
attempt_limit: 5
command: melos run integration-test -- -d ${{ steps.start_simulator.outputs.udid }}
android_integration_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: subosito/flutter-action@v2
- uses: bluefireteam/melos-action@v3
- name: Enable KVM for Android emulator
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- run: melos run init-integration-test-boilerplate
- name: Run Flutter integration tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 35
target: default
arch: x86_64
ram-size: 1024M
disk-size: 2048M
script: melos run integration-test -- -d `flutter devices | grep android | tr ' ' '\n' | grep emulator-`