refactor: Pub workspace with Melos #1338
Workflow file for this run
This file contains 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: Flutter app code check | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
types: [opened, synchronize, reopened] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
outputs: | |
flutter: ${{ steps.filter.outputs.flutter }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Filter by paths | |
uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
flutter: | |
- '**/android/**' | |
- '**/assets/**' | |
- '**/dart_defines/**' | |
- '**/golden_test/**' | |
- '**/ios/**' | |
- '**/lib/**' | |
- '**/test/**' | |
- '**/web/**' | |
- '**/analysis_options.yaml' | |
- '**/melos.yaml' | |
- '**/pubspec.yaml' | |
- '.fvmrc' | |
analyze: | |
needs: check | |
if: ${{ needs.check.outputs.flutter == 'true' && github.event_name != 'push' }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Flutter with FVM | |
id: setup-flutter | |
uses: kuhnroyal/flutter-fvm-config-action/setup@v3 | |
- name: Prepare Melos | |
run: echo "MELOS_SDK_PATH=${{ env.FLUTTER_ROOT }}" >> "$GITHUB_ENV" | |
- name: Install Melos | |
uses: bluefireteam/melos-action@v3 | |
with: | |
run-bootstrap: false | |
- name: Install Dependencies | |
run: dart pub get --enforce-lockfile | |
- name: Analyze packages | |
run: melos analyze --fatal-infos | |
- name: Run custom lint | |
run: melos run custom_lint | |
- name: Check for the existence of unformatted files | |
# Cannot use `melos format` as it requires excluding files generated from the target file | |
run: melos run format:ci --no-select | |
test: | |
needs: check | |
if: needs.check.outputs.flutter == 'true' | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Flutter with FVM | |
id: setup-flutter | |
uses: kuhnroyal/flutter-fvm-config-action/setup@v3 | |
- name: Prepare Melos | |
run: echo "MELOS_SDK_PATH=${{ env.FLUTTER_ROOT }}" >> "$GITHUB_ENV" | |
- name: Install Melos | |
uses: bluefireteam/melos-action@v3 | |
with: | |
run-bootstrap: false | |
- name: Install Dependencies | |
run: dart pub get --enforce-lockfile | |
- name: Run package tests | |
run: melos run test:ci --no-select | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: coverage/lcov.info |