|
| 1 | +name: CI |
| 2 | + |
| 3 | +# Build-and-test only. Producing distributable (signed/packaged) artifacts is |
| 4 | +# the job of release.yml, which runs on version tags. |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + pull_request: |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: ci-${{ github.ref }} |
| 18 | + cancel-in-progress: true |
| 19 | + |
| 20 | +env: |
| 21 | + FLUTTER_VERSION: "3.44.2" |
| 22 | + |
| 23 | +jobs: |
| 24 | + # Platform-independent checks run once here, not repeated per platform. |
| 25 | + checks: |
| 26 | + name: Format, analyze, test |
| 27 | + runs-on: ubuntu-latest |
| 28 | + timeout-minutes: 20 |
| 29 | + steps: |
| 30 | + - name: Checkout repository |
| 31 | + uses: actions/checkout@v6.0.3 |
| 32 | + |
| 33 | + - name: Set up Flutter |
| 34 | + uses: subosito/flutter-action@v2.23.0 |
| 35 | + with: |
| 36 | + channel: stable |
| 37 | + flutter-version: ${{ env.FLUTTER_VERSION }} |
| 38 | + cache: true |
| 39 | + pub-cache: true |
| 40 | + |
| 41 | + - name: Show Flutter version |
| 42 | + run: flutter --version |
| 43 | + |
| 44 | + - name: Install dependencies |
| 45 | + run: flutter pub get |
| 46 | + |
| 47 | + - name: Check formatting |
| 48 | + run: dart format --output=none --set-exit-if-changed lib test |
| 49 | + |
| 50 | + - name: Analyze |
| 51 | + run: flutter analyze |
| 52 | + |
| 53 | + - name: Run tests |
| 54 | + run: flutter test |
| 55 | + |
| 56 | + # Per-platform builds only verify that the native app compiles. They run only |
| 57 | + # after `checks` passes, so a formatting/analyze/test failure never spins up |
| 58 | + # the (slower, pricier) build runners. |
| 59 | + macos: |
| 60 | + name: Build macOS |
| 61 | + needs: checks |
| 62 | + runs-on: macos-latest |
| 63 | + timeout-minutes: 45 |
| 64 | + steps: |
| 65 | + - name: Checkout repository |
| 66 | + uses: actions/checkout@v6.0.3 |
| 67 | + |
| 68 | + - name: Set up Flutter |
| 69 | + uses: subosito/flutter-action@v2.23.0 |
| 70 | + with: |
| 71 | + channel: stable |
| 72 | + flutter-version: ${{ env.FLUTTER_VERSION }} |
| 73 | + cache: true |
| 74 | + pub-cache: true |
| 75 | + |
| 76 | + - name: Install dependencies |
| 77 | + run: flutter pub get |
| 78 | + |
| 79 | + - name: Build macOS app |
| 80 | + run: flutter build macos --release |
| 81 | + |
| 82 | + linux: |
| 83 | + name: Build Linux |
| 84 | + needs: checks |
| 85 | + runs-on: ubuntu-latest |
| 86 | + timeout-minutes: 45 |
| 87 | + steps: |
| 88 | + - name: Checkout repository |
| 89 | + uses: actions/checkout@v6.0.3 |
| 90 | + |
| 91 | + - name: Install Linux build dependencies |
| 92 | + run: | |
| 93 | + sudo apt-get update |
| 94 | + sudo apt-get install -y \ |
| 95 | + clang cmake ninja-build pkg-config \ |
| 96 | + libgtk-3-dev liblzma-dev libstdc++-12-dev \ |
| 97 | + libayatana-appindicator3-dev |
| 98 | +
|
| 99 | + - name: Set up Flutter |
| 100 | + uses: subosito/flutter-action@v2.23.0 |
| 101 | + with: |
| 102 | + channel: stable |
| 103 | + flutter-version: ${{ env.FLUTTER_VERSION }} |
| 104 | + cache: true |
| 105 | + pub-cache: true |
| 106 | + |
| 107 | + - name: Install dependencies |
| 108 | + run: flutter pub get |
| 109 | + |
| 110 | + - name: Build Linux bundle |
| 111 | + run: flutter build linux --release |
| 112 | + |
| 113 | + ios: |
| 114 | + name: Build iOS |
| 115 | + needs: checks |
| 116 | + runs-on: macos-latest |
| 117 | + timeout-minutes: 45 |
| 118 | + steps: |
| 119 | + - name: Checkout repository |
| 120 | + uses: actions/checkout@v6.0.3 |
| 121 | + |
| 122 | + - name: Set up Flutter |
| 123 | + uses: subosito/flutter-action@v2.23.0 |
| 124 | + with: |
| 125 | + channel: stable |
| 126 | + flutter-version: ${{ env.FLUTTER_VERSION }} |
| 127 | + cache: true |
| 128 | + pub-cache: true |
| 129 | + |
| 130 | + - name: Install dependencies |
| 131 | + run: flutter pub get |
| 132 | + |
| 133 | + # device_info_plus needs a recent iOS SDK; the runner's default Xcode can |
| 134 | + # be older, so select the newest installed. |
| 135 | + - name: Select latest Xcode |
| 136 | + run: | |
| 137 | + sudo xcode-select -s "$(ls -d /Applications/Xcode_*.app | sort -V | tail -1)/Contents/Developer" |
| 138 | + xcodebuild -version |
| 139 | +
|
| 140 | + # No codesigning on CI; just verify the iOS app + pure-SPM setup compile. |
| 141 | + - name: Build iOS app (no codesign) |
| 142 | + run: flutter build ios --release --no-codesign |
0 commit comments