Skip to content

Bump to v0.10.2

Bump to v0.10.2 #366

Workflow file for this run

name: Code Check
on:
push:
branches: main
pull_request:
env:
FLUTTER_TEST_REPORT: ${{github.workspace}}/flutter-test-report.json
PATTERN_CHECKER: ${{github.workspace}}/scripts/pattern_checker.sh
jobs:
setup:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
flutter-file-changed: ${{ steps.filter.outputs.flutter-file-changed }}
flutter-lower-bound: ${{ steps.flutter-version-constraint.outputs.lower-bound }}
flutter-upper-bound: ${{ steps.flutter-version-constraint.outputs.upper-bound }}
steps:
- uses: actions/checkout@v4
- name: Filter changed files
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
flutter-file-changed:
- '**.dart'
- 'pubspec.yaml'
- 'pubspec.lock'
- name: Get Flutter SDK version constraint
id: flutter-version-constraint
# Extract the lower bound from pubspec.yaml and the upper bound from .fvmrc
run: |
sdk_constraint=$(cat pubspec.yaml | yq .environment.flutter)
lower_bound=$(echo "$sdk_constraint" | grep -oP '(?<=\>=)[0-9]+\.[0-9]+\.[0-9]+' | head -1)
upper_bound=$(cat .fvmrc | jq -r .flutter)
echo "lower-bound=$lower_bound" >> "$GITHUB_OUTPUT"
echo "upper-bound=$upper_bound" >> "$GITHUB_OUTPUT"
- name: Print output values
run: |
echo "flutter-file-changed=${{ steps.filter.outputs.flutter-file-changed }}"
echo "flutter-lower-bound=${{ steps.flutter-version-constraint.outputs.lower-bound }}"
echo "flutter-upper-bound=${{ steps.flutter-version-constraint.outputs.upper-bound }}"
analysis:
needs: setup
if: ${{ needs.setup.outputs.flutter-file-changed == 'true' }}
runs-on: ubuntu-latest
strategy:
matrix:
flutter-version:
- ${{ needs.setup.outputs.flutter-lower-bound }}
- ${{ needs.setup.outputs.flutter-upper-bound }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Flutter
uses: ./.github/actions/setup_flutter
with:
version: ${{ matrix.flutter-version }}
- name: Format
run: dart format . -o none --set-exit-if-changed
- name: Analyze
run: dart analyze
- name: Disallowed patterns check
run: bash ${{ env.PATTERN_CHECKER }} "*.dart" "--" "debugPrint"
testing:
needs: setup
if: ${{ needs.setup.outputs.flutter-file-changed == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
checks: write
strategy:
matrix:
flutter-version:
- ${{ needs.setup.outputs.flutter-lower-bound }}
- ${{ needs.setup.outputs.flutter-upper-bound }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Flutter
uses: ./.github/actions/setup_flutter
with:
version: ${{ matrix.flutter-version }}
- name: Run unit tests
run: flutter test --file-reporter="json:${{ env.FLUTTER_TEST_REPORT }}"
- name: Write test report
uses: dorny/test-reporter@v1
# PRs from forks have no write permissions.
if: github.event.pull_request.head.repo.fork == false && (success() || failure())
with:
name: Test Report (with Flutter ${{ matrix.flutter-version }})
path: ${{ env.FLUTTER_TEST_REPORT }}
reporter: flutter-json
# Final results (Used for status checks)
code-check:
if: ${{ always() }}
runs-on: ubuntu-latest
needs: [analysis, testing]
steps:
# Fails if any of the previous jobs failed.
- run: exit 1
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
}}