blob: f066c5684b41a03e8a27f1995872521ae147f95a [file] [edit]
name: Test dashboard
permissions:
contents: read
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@1a449444c387b1966244ae4d4f8c696479add0b2
with:
channel: stable
architecture: x64 # only needed for running locally (mac)
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
persist-credentials: false
- 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 .
- 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
# 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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: golden-failures
path: 'dashboard/**/failures/*.png'