name: CI on: push: branches: [main] pull_request: jobs: analyze-and-test: name: Analyze & unit test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2 with: flutter-version: "3.41.6" channel: stable cache: true - name: Install dependencies run: flutter pub get - name: Generate Drift code run: flutter pub run build_runner build --delete-conflicting-outputs - name: Check formatting run: dart format --set-exit-if-changed . - name: Analyze run: flutter analyze --fatal-infos - name: Unit + widget tests with coverage run: flutter test test/unit/ test/widget/ --coverage - name: Coverage gate run: dart run scripts/check_coverage.dart integration: name: Integration tests (Stalwart) runs-on: ubuntu-latest # Run integration tests only on push to main, not on every PR. if: github.event_name == 'push' && github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v4 - uses: DeterminateSystems/nix-installer-action@v14 - uses: DeterminateSystems/magic-nix-cache-action@v8 - name: Cache FVM Flutter SDK uses: actions/cache@v4 with: path: ~/.fvm key: fvm-${{ hashFiles('.fvm/fvm_config.json') }} - name: Cache pub packages uses: actions/cache@v4 with: path: ~/.pub-cache key: pub-${{ hashFiles('pubspec.lock') }} restore-keys: pub- - name: Run integration tests run: | nix develop --command bash -c " fvm install --skip-pub-get && fvm flutter pub get && fvm flutter pub run build_runner build --delete-conflicting-outputs && stalwart-dev/test.sh " integration-ui: name: UI Integration tests (Stalwart + Xvfb) runs-on: ubuntu-latest if: github.event_name == 'push' && github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v4 - uses: DeterminateSystems/nix-installer-action@v14 - uses: DeterminateSystems/magic-nix-cache-action@v8 - name: Install Flutter Linux build dependencies run: | sudo apt-get update -q sudo apt-get install -y --no-install-recommends \ libgtk-3-dev pkg-config cmake ninja-build clang \ libsecret-1-dev - name: Cache FVM Flutter SDK uses: actions/cache@v4 with: path: ~/.fvm key: fvm-${{ hashFiles('.fvm/fvm_config.json') }} - name: Cache pub packages uses: actions/cache@v4 with: path: ~/.pub-cache key: pub-${{ hashFiles('pubspec.lock') }} restore-keys: pub- - name: Cache Linux debug build uses: actions/cache@v4 with: path: | build/linux .dart_tool/flutter_build key: linux-debug-${{ hashFiles('pubspec.lock', 'lib/**/*.dart', 'integration_test/**/*.dart') }} restore-keys: linux-debug- - name: Run UI integration tests run: | nix develop --command bash -c " fvm install --skip-pub-get && fvm flutter pub get && fvm flutter pub run build_runner build --delete-conflicting-outputs && stalwart-dev/integration_ui_test.sh " build-linux: name: Build Linux desktop runs-on: ubuntu-latest needs: analyze-and-test steps: - uses: actions/checkout@v4 - name: Install GTK3, build tools and libsecret run: | sudo apt-get update -q sudo apt-get install -y --no-install-recommends \ libgtk-3-dev pkg-config cmake ninja-build clang \ libsecret-1-dev - uses: subosito/flutter-action@v2 with: flutter-version: "3.41.6" channel: stable cache: true - name: Install dependencies run: flutter pub get - name: Generate Drift code run: flutter pub run build_runner build --delete-conflicting-outputs - name: Build Linux release run: flutter build linux --release