Translations update from Hosted Weblate #200
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: 'PR checks' | |
| on: | |
| pull_request: | |
| types: | |
| - synchronize | |
| - labeled | |
| - opened | |
| - reopened | |
| paths: | |
| - "app/**" | |
| - "health_data_store/**" | |
| - "pr.yml" | |
| jobs: | |
| validate-localizations: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout PR code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| sparse-checkout: "app/lib/l10n" | |
| - name: Validate localizations | |
| # check for [^'"]'[^'"] in .arb files | |
| run: "grep \"[^'\\\"]'[^'\\\"]\" app/lib/l10n/*.arb && exit 1 || exit 0" | |
| update-goldens: | |
| if: github.event.pull_request.draft == false | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout PR code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| - name: Cache generated health data store | |
| id: cache-generated | |
| uses: actions/cache@v4 | |
| with: | |
| path: health_data_store/lib | |
| key: builder-${{ hashFiles('health_data_store/pubspec.yaml', 'health_data_store/lib/*', 'health_data_store/lib/**/*dart') }} | |
| - name: Setup dart | |
| if: steps.cache-generated.outputs.cache-hit != 'true' | |
| uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: stable | |
| - name: Generate code | |
| if: steps.cache-generated.outputs.cache-hit != 'true' | |
| run: dart run build_runner build | |
| working-directory: health_data_store | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| cache: true | |
| - name: Disable analytics | |
| run: | |
| flutter config --no-analytics --suppress-analytics | |
| - name: Update app dependencies | |
| run: flutter pub get | |
| working-directory: app | |
| # TODO: cache using non-generated dart files in the test dir as key | |
| - name: Generate app mock code | |
| run: flutter pub run build_runner build | |
| working-directory: app | |
| - name: Update goldens | |
| id: gold-upd | |
| run: flutter test --update-goldens --fail-fast --name="\[gold\].*" | |
| working-directory: app | |
| - name: Push golden changes | |
| # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions#example-of-failure-with-conditions | |
| if: ${{ steps.gold-upd.conclusion == 'success' }} | |
| run: | | |
| if [[ $(git status -s | grep png) ]]; then | |
| git config user.name "GitHub Action (update goldens)" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add app/test/ | |
| git commit -m "Update goldens" | |
| git push | |
| else | |
| echo "no changes to commit" | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}% | |
| test: | |
| if: contains(github.event.pull_request.labels.*.name, 'auto-test') | |
| runs-on: ubuntu-latest | |
| needs: update-goldens # this is guaranteed to fail if goldens need to be updated | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| # ensures there are no unexpected directories needed | |
| sparse-checkout: | | |
| app | |
| health_data_store | |
| - name: Cache generated health data store | |
| id: cache-generated | |
| uses: actions/cache@v4 | |
| with: | |
| path: health_data_store/lib | |
| key: builder-${{ hashFiles('health_data_store/pubspec.yaml', 'health_data_store/lib/*', 'health_data_store/lib/**/*dart') }} | |
| - name: Setup dart | |
| if: steps.cache-generated.outputs.cache-hit != 'true' | |
| uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: stable | |
| - name: Generate code | |
| if: steps.cache-generated.outputs.cache-hit != 'true' | |
| run: dart run build_runner build | |
| working-directory: health_data_store | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| cache: true | |
| - name: Disable analytics | |
| run: | |
| flutter config --no-analytics --suppress-analytics | |
| - name: Update app dependencies | |
| run: flutter pub get | |
| working-directory: app | |
| # TODO: cache using non-generated dart files in the test dir as key | |
| - name: Generate app mock code | |
| run: flutter pub run build_runner build | |
| working-directory: app | |
| - name: Run tests | |
| run: flutter test --coverage | |
| working-directory: app | |
| build: | |
| if: contains(github.event.pull_request.labels.*.name, 'auto-build') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| # ensures there are no unexpected directories needed | |
| sparse-checkout: | | |
| app | |
| health_data_store | |
| - name: Cache generated health data store | |
| id: cache-generated | |
| uses: actions/cache@v4 | |
| with: | |
| path: health_data_store/lib | |
| key: builder-${{ hashFiles('health_data_store/pubspec.yaml', 'health_data_store/lib/*', 'health_data_store/lib/**/*dart') }} | |
| - name: Setup dart | |
| if: steps.cache-generated.outputs.cache-hit != 'true' | |
| uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: stable | |
| - name: Generate code | |
| if: steps.cache-generated.outputs.cache-hit != 'true' | |
| run: dart run build_runner build | |
| working-directory: health_data_store | |
| - name: Set Up Java | |
| uses: actions/[email protected] | |
| with: | |
| distribution: 'oracle' | |
| java-version: '17' | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| cache: true | |
| - name: Disable analytics | |
| run: flutter config --no-analytics --suppress-analytics | |
| - name: Update app dependencies | |
| run: flutter pub get | |
| working-directory: app | |
| - name: Build | |
| run: flutter build apk --debug --flavor=github | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-results | |
| path: app/build/app/outputs/flutter-apk |