Skip to content

Commit

Permalink
Run CI for both lowest and highest support Flutter versions
Browse files Browse the repository at this point in the history
  • Loading branch information
fujidaiti committed Aug 31, 2024
1 parent 63cff8b commit 845ca28
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .github/actions/setup_flutter/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ inputs:
description: "The working directory where the Flutter project is located."
required: false
default: "."
version:
description: "The version of Flutter to install."
required: false
default: "3.x"

runs:
using: "composite"
Expand All @@ -14,7 +18,7 @@ runs:
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.x
flutter-version: ${{ inputs.version }}
cache: true

- name: Flutter version
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/code_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ env:
PATTERN_CHECKER: ${{github.workspace}}/scripts/pattern_checker.sh

jobs:
# Change detection
setup:
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -46,17 +45,23 @@ jobs:
echo "lowest-flutter-version=${{ steps.flutter-version-constraint.outputs.lowest }}"
echo "highest-flutter-version=${{ steps.flutter-version-constraint.outputs.highest }}"
# Static code analysis
analysis:
needs: setup
if: ${{ needs.setup.outputs.flutter-file-changed == 'true' }}
runs-on: ubuntu-latest
strategy:
matrix:
flutter-version:
- ${{ needs.setup.outputs.lowest-flutter-version }}
- ${{ needs.setup.outputs.highest-flutter-version }}
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
Expand All @@ -67,7 +72,6 @@ jobs:
- name: Disallowed patterns check
run: bash ${{ env.PATTERN_CHECKER }} "*.dart" "--" "debugPrint"

# Unit testing
testing:
needs: setup
if: ${{ needs.setup.outputs.flutter-file-changed == 'true' }}
Expand All @@ -76,12 +80,19 @@ jobs:
contents: read
actions: read
checks: write
strategy:
matrix:
flutter-version:
- ${{ needs.setup.outputs.lowest-flutter-version }}
- ${{ needs.setup.outputs.highest-flutter-version }}
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 }}"
Expand All @@ -91,7 +102,7 @@ jobs:
# PRs from forks have no write permissions.
if: github.event.pull_request.head.repo.fork == false && (success() || failure())
with:
name: Test Report
name: Test Report (with Flutter ${{ matrix.flutter-version }})
path: ${{ env.FLUTTER_TEST_REPORT }}
reporter: flutter-json

Expand Down

0 comments on commit 845ca28

Please sign in to comment.