Prepare v1.2.0 #1137
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Flutter app for an environment | |
| on: [push] | |
| permissions: | |
| contents: read | |
| jobs: | |
| deployAndroid: | |
| permissions: write-all | |
| name: Build Android apk | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: ⬇️ Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: ⚙️ Setup Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: "17.x" | |
| distribution: 'adopt' | |
| id: java | |
| - name: 📦 Cache Gradle dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: gradle-${{ runner.os }}-${{ hashFiles('app/**/*.gradle*', 'app/**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| gradle-${{ runner.os }}- | |
| - name: Set Flutter version | |
| run: | | |
| cd app | |
| export FLUTTER_VERSION="$(sed -E -n -e 's/^.*flutter:\ ">=([0-9.]+)"/\1/p' pubspec.yaml)" | |
| echo "FLUTTER_VERSION=$FLUTTER_VERSION" >> $GITHUB_ENV | |
| - name: ⚙️ Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: "${{ env.FLUTTER_VERSION }}" | |
| channel: 'stable' | |
| id: flutter | |
| - name: 📦 Cache Flutter SDK | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.FLUTTER_ROOT }} | |
| key: flutter-sdk-${{ runner.os }}-${{ env.FLUTTER_VERSION }} | |
| restore-keys: | | |
| flutter-sdk-${{ runner.os }}- | |
| - name: 📦 Cache Pub dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.pub-cache | |
| app/.dart_tool | |
| key: pub-${{ runner.os }}-${{ hashFiles('app/pubspec.lock') }} | |
| restore-keys: | | |
| pub-${{ runner.os }}- | |
| - name: 🔐 Retrieve base64 keystore and decode it to a file | |
| id: write_file | |
| uses: timheuer/base64-to-file@v1.2 | |
| with: | |
| fileName: "android-keystore.jks" | |
| fileDir: "${{ github.workspace }}/" | |
| encodedString: ${{ secrets.KEYSTORE_FILE_BASE64 }} | |
| - name: 📝🔐 Create keystore.properties file | |
| env: | |
| KEYSTORE_PROPERTIES_PATH: ${{ github.workspace }}/app/android/key.properties | |
| run: | | |
| echo "storeFile=${{ github.workspace }}/android-keystore.jks" > $KEYSTORE_PROPERTIES_PATH | |
| echo "keyAlias=${{ secrets.KEYSTORE_KEY_ALIAS }}" >> $KEYSTORE_PROPERTIES_PATH | |
| echo "storePassword=${{ secrets.KEYSTORE_PASSWORD }}" >> $KEYSTORE_PROPERTIES_PATH | |
| echo "keyPassword=${{ secrets.KEYSTORE_KEY_PASSWORD }}" >> $KEYSTORE_PROPERTIES_PATH | |
| - name: Pub Get Packages | |
| run: | | |
| cd app | |
| flutter --disable-analytics | |
| flutter pub get --enforce-lockfile | |
| - name: Check formatting | |
| run: | | |
| cd app | |
| dart format --set-exit-if-changed . | |
| - name: Lint dart code | |
| run: | | |
| cd app | |
| dart analyze --no-fatal-warnings lib/ | |
| - name: Check dependencies | |
| run: | | |
| cd app | |
| dart run dependency_validator | |
| - name: Check changelog is up-to-date | |
| run: | | |
| cd app | |
| dart run quantumphysique:generate_changelog --check | |
| - name: 🧪 Run tests | |
| run: | | |
| cd app | |
| flutter test | |
| - name: 🤖📦 Create Android release | |
| run: | | |
| cd app | |
| make build | |
| - name: Create Artifact Name | |
| run: | | |
| BRANCH_NAME="apks_${{ github.head_ref || github.ref_name }}" | |
| export ARTIFACT_NAME="${BRANCH_NAME////\_}" | |
| echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV | |
| - name: ⬆️ 📦 Upload apks | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: "${{ env.ARTIFACT_NAME }}" | |
| path: "app/build/app/outputs/flutter-apk/*.apk" | |
| retention-days: 30 | |
| overwrite: true | |
| integrationTest: | |
| name: 🤖 Integration tests (Android emulator) | |
| runs-on: ubuntu-latest | |
| # Only run on the main branch and on PRs targeting main to save CI time. | |
| if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request' | |
| steps: | |
| - name: ⬇️ Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: ⚙️ Setup Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: "17.x" | |
| distribution: 'adopt' | |
| - name: Set Flutter version | |
| run: | | |
| cd app | |
| export FLUTTER_VERSION="$(sed -E -n -e 's/^.*flutter:\ ">=([0-9.]+)"/\1/p' pubspec.yaml)" | |
| echo "FLUTTER_VERSION=$FLUTTER_VERSION" >> $GITHUB_ENV | |
| - name: ⚙️ Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: "${{ env.FLUTTER_VERSION }}" | |
| channel: 'stable' | |
| - name: 📦 Cache Pub dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.pub-cache | |
| app/.dart_tool | |
| key: pub-${{ runner.os }}-${{ hashFiles('app/pubspec.lock') }} | |
| restore-keys: | | |
| pub-${{ runner.os }}- | |
| - name: 📦 Cache AVD | |
| uses: actions/cache@v4 | |
| id: avd-cache | |
| with: | |
| path: | | |
| ~/.android/avd/* | |
| ~/.android/adb* | |
| key: avd-35 | |
| - name: Pub Get Packages | |
| run: | | |
| cd app | |
| flutter pub get --enforce-lockfile | |
| - name: Generate code-gen | |
| run: | | |
| cd app | |
| make generate | |
| - name: Enable KVM | |
| 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 | |
| - name: 🧪 Run integration tests on emulator | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: 35 | |
| arch: x86_64 | |
| profile: pixel_6 | |
| emulator-options: -no-window -no-audio -no-boot-anim -gpu swiftshader_indirect | |
| disable-animations: true | |
| script: cd app && flutter drive --driver=test_driver/integration_test.dart --target=integration_test/smoke_test.dart --device-id=emulator-5554 | |
| - name: ⬆️ Upload screenshots | |
| if: always() | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: integration-test-screenshots | |
| path: app/screenshots/*.png | |
| retention-days: 30 |