| name: Test dashboard |
| |
| on: |
| workflow_dispatch: |
| inputs: |
| update_goldens: |
| description: 'Update Golden files' |
| required: false |
| type: boolean |
| default: false |
| pull_request: |
| branches: [main] |
| paths: |
| - "dashboard/**" |
| - "packages/cocoon_common/**" |
| - ".github/workflows/dashboard_tests.yaml" |
| push: |
| branches: [main] |
| |
| jobs: |
| test-dashboard: |
| runs-on: ubuntu-latest |
| defaults: |
| run: |
| working-directory: dashboard |
| env: |
| UPDATE_GOLDENS: ${{ inputs.update_goldens || 'false' }} |
| |
| steps: |
| - name: Set up Flutter |
| uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e |
| with: |
| channel: stable |
| architecture: x64 # only needed for running locally (mac) |
| |
| - name: Checkout code |
| uses: actions/checkout@v6 |
| |
| - name: Get packages |
| run: | |
| flutter packages get |
| |
| - name: Flutter Analyze |
| run: | |
| flutter analyze --no-fatal-infos |
| |
| - name: Dart Format |
| run: | |
| dart format --set-exit-if-changed . |
| |
| # Failures on github will upload the artifacts as annotations. |
| # Review them and if you accept them, either download them or run: |
| # gh act -b --env UPDATE_GOLDENS=true --container-architecture linux/amd64 --container-options="--tty" --workflows ".github/workflows/dashboard_tests.yaml" |
| # The `--update-goldens` flag will not work on GitHub because we do not |
| # have write access to the repository. |
| - name: Upload Golden Failures |
| if: failure() |
| uses: actions/upload-artifact@v6 |
| with: |
| name: golden-failures |
| path: 'dashboard/**/failures/*.png' |
| |
| - name: Flutter Test |
| run: | |
| EXTRA_ARGS="" |
| if [ "$UPDATE_GOLDENS" = "true" ]; then |
| EXTRA_ARGS="--update-goldens" |
| fi |
| flutter test --test-randomize-ordering-seed=random --reporter expanded $EXTRA_ARGS |
| |