Skip to content

Check (on GitHub-hosted) #1194

Check (on GitHub-hosted)

Check (on GitHub-hosted) #1194

Workflow file for this run

name: Check
run-name: Check ${{ (vars.RUNS_ON_SELF_HOSTED == null && '(on GitHub-hosted)') || '(on self-hosted)' }}
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
workflow_call:
permissions:
contents: read
pull-requests: write
checks: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -euo pipefail {0}
jobs:
format:
runs-on: ${{ (vars.RUNS_ON_SELF_HOSTED == null && 'ubuntu-latest') || 'self-hosted' }}
timeout-minutes: 30
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # v2.16.0
with:
flutter-version: ${{ (vars.FLUTTER_VERSION != null && vars.FLUTTER_VERSION) || '' }}
channel: stable
cache: ${{ (vars.RUNS_ON_SELF_HOSTED == null && true) || false }}
- run: flutter pub get
- run: dart format -l 80 --set-exit-if-changed .
- name: Check for changes
if: failure()
run: git diff --exit-code
analyze:
runs-on: ${{ (vars.RUNS_ON_SELF_HOSTED == null && 'ubuntu-latest') || 'self-hosted' }}
timeout-minutes: 30
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Run pre-process script
shell: bash
env:
PREPROCESS_SCRIPT_BASE64: ${{ secrets.PREPROCESS_SCRIPT_BASE64 }}
run: |
if [ -n "$PREPROCESS_SCRIPT_BASE64" ]; then
echo "$PREPROCESS_SCRIPT_BASE64" | base64 --decode > ${{ runner.temp }}/pre-process.sh && bash ${{ runner.temp }}/pre-process.sh
fi
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # v2.16.0
with:
flutter-version: ${{ (vars.FLUTTER_VERSION != null && vars.FLUTTER_VERSION) || '' }}
channel: stable
cache: ${{ (vars.RUNS_ON_SELF_HOSTED == null && true) || false }}
- run: flutter pub get
- name: flutterfire configure
env:
FIREBASE_ADMIN_SERVICE_ACCOUNT_JSON_BASE64: ${{ secrets.FIREBASE_ADMIN_SERVICE_ACCOUNT_JSON_BASE64 }}
run: |
which firebase || curl -sL https://firebase.tools | analytics=false bash
dart pub global activate flutterfire_cli 1.0.1-dev.4
echo -n "$FIREBASE_ADMIN_SERVICE_ACCOUNT_JSON_BASE64" | base64 --decode > ${{ runner.temp }}/firebase_admin_service_account.json
GOOGLE_APPLICATION_CREDENTIALS=${{ runner.temp }}/firebase_admin_service_account.json make flutterfire-configure-dev
- run: flutter analyze --write=flutter_analyze.log
- if: ${{ !cancelled() }}
run: dart run custom_lint --format=json | tee custom_lint.log
- if: ${{ !cancelled() }}
uses: yorifuji/flutter-analyze-commenter@b852004b1f3ca8783b010f4ea098946029cbb2cd # v1.2.0
with:
analyze-log: flutter_analyze.log
custom-lint-log: custom_lint.log
verbose: true
# diff:
# runs-on: ${{ (vars.RUNS_ON_SELF_HOSTED == null && 'ubuntu-latest') || 'self-hosted' }}
# timeout-minutes: 30
# steps:
# - uses: actions/checkout@v4
# - uses: subosito/flutter-action@v2
# with:
# flutter-version: ${{ (vars.FLUTTER_VERSION != null && vars.FLUTTER_VERSION) || '' }}
# channel: stable
# cache: ${{ (vars.RUNS_ON_SELF_HOSTED == null && true) || false }}
# - run: flutter pub get
# - run: make build-runner
# - name: Check for changes
# run: |
# if [[ -n $(git status --porcelain) ]]; then
# echo "There are changes in the working tree, please commit them before running this action."
# git status
# exit 1
# fi
test:
runs-on: ${{ (vars.RUNS_ON_SELF_HOSTED == null && 'ubuntu-latest') || 'self-hosted' }}
timeout-minutes: 30
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Run pre-process script
shell: bash
env:
PREPROCESS_SCRIPT_BASE64: ${{ secrets.PREPROCESS_SCRIPT_BASE64 }}
run: |
if [ -n "$PREPROCESS_SCRIPT_BASE64" ]; then
echo "$PREPROCESS_SCRIPT_BASE64" | base64 --decode > ${{ runner.temp }}/pre-process.sh && bash ${{ runner.temp }}/pre-process.sh
fi
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # v2.16.0
with:
flutter-version: ${{ (vars.FLUTTER_VERSION != null && vars.FLUTTER_VERSION) || '' }}
channel: stable
cache: ${{ (vars.RUNS_ON_SELF_HOSTED == null && true) || false }}
- run: flutter pub get
- run: flutter test -x golden --reporter json > test_report.json
- uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
if: success() || failure() # ignore cancelled
with:
name: flutter test report
path: test_report.json
reporter: flutter-json
action-timeline:
needs: [format, analyze, test]
if: ${{ !cancelled() && github.event.workflow == '.github/workflows/check.yml' }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1