Skip to content

Check (on GitHub-hosted) #939

Check (on GitHub-hosted)

Check (on GitHub-hosted) #939

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
jobs:
format:
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: 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@v4
- 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@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: flutter analyze --write=flutter_analyze.log
- if: ${{ !cancelled() }}
run: dart run custom_lint --format=json > custom_lint.log
- if: ${{ !cancelled() }}
uses: yorifuji/flutter-analyze-commenter@v1
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@v4
- 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@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: 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@v2