ci(android): generate unique Play version codes #1587
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
| on: | |
| push: | |
| branches: [ 'main' ] | |
| pull_request: | |
| name: Code checks workflow | |
| concurrency: | |
| group: qa-${{ github.ref }} | |
| cancel-in-progress: true | |
| # Add this permissions section | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| jobs: | |
| check-changes: | |
| name: Check changed files | |
| runs-on: ubuntu-latest | |
| outputs: | |
| changed_files: ${{ steps.added-and-modified-files.outputs.all }} | |
| changed_dart_files: ${{ steps.added-and-modified-files.outputs.dart }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - id: changed-files | |
| name: Get changed files | |
| uses: tj-actions/changed-files@v45 | |
| with: | |
| files: | | |
| **/*.dart | |
| **/pubspec.yaml | |
| files_ignore: | | |
| **/*.g.dart | |
| **/*.freezed.dart | |
| - id: added-and-modified-files | |
| name: Get all added and modified files | |
| run: | | |
| changed_files=$(echo "${{ steps.changed-files.outputs.added_files }} ${{ steps.changed-files.outputs.modified_files }}" | xargs) | |
| changed_dart_files=$(echo "$changed_files" | tr ' ' '\n' | grep -E '\.dart$' | xargs) | |
| echo "all=$changed_files" >> $GITHUB_OUTPUT | |
| echo "dart=$changed_dart_files" >> $GITHUB_OUTPUT | |
| lint: | |
| name: Run lint on affected files | |
| runs-on: ubuntu-latest | |
| needs: check-changes | |
| if: ${{ needs.check-changes.outputs.changed_files }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Retrieve Flutter version from FVM config | |
| uses: kuhnroyal/flutter-fvm-config-action@v1 | |
| - name: Setup Flutter SDK | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: ${{ env.FLUTTER_VERSION }} | |
| channel: ${{ env.FLUTTER_CHANNEL }} | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Setup Firebase Options | |
| run: | | |
| tee lib/firebase_options.dart <<EOF | |
| class DefaultFirebaseOptions { | |
| static const currentPlatform = null; | |
| } | |
| EOF | |
| - name: Analyze code | |
| if: ${{ needs.check-changes.outputs.changed_files }} | |
| run: | | |
| dart analyze --fatal-warnings \ | |
| ${{ needs.check-changes.outputs.changed_files }} | |
| - name: Check code formatting | |
| if: ${{ always() && needs.check-changes.outputs.changed_dart_files }} | |
| run: | | |
| dart format --output=none --set-exit-if-changed \ | |
| ${{ needs.check-changes.outputs.changed_dart_files }} | |
| unit-tests: | |
| name: Run unit tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Retrieve Flutter version from FVM config | |
| uses: kuhnroyal/flutter-fvm-config-action@v1 | |
| - name: Setup Flutter SDK | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: ${{ env.FLUTTER_VERSION }} | |
| channel: ${{ env.FLUTTER_CHANNEL }} | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Setup Firebase Options | |
| run: | | |
| tee lib/firebase_options.dart <<EOF | |
| class DefaultFirebaseOptions { | |
| static const currentPlatform = null; | |
| } | |
| EOF | |
| - uses: stelynx/dart-full-coverage@v1.1.1 | |
| with: | |
| package: penhas | |
| ignore: "*.freezed.dart,*.g.dart" | |
| - name: Run unit tests | |
| run: flutter test --timeout=1h --dart-define=isCI=true --coverage | |
| - name: Codecov | |
| uses: codecov/codecov-action@v4 |