@@ -2,11 +2,7 @@ name: CI
2
2
3
3
on :
4
4
pull_request :
5
- paths-ignore :
6
- - ' **.md'
7
- push :
8
- branches :
9
- - master
5
+ types : [opened, synchronize, reopened]
10
6
paths-ignore :
11
7
- ' **.md'
12
8
workflow_dispatch :
@@ -15,24 +11,56 @@ concurrency:
15
11
group : ${{ github.workflow }}-${{ github.ref }}
16
12
cancel-in-progress : true
17
13
14
+ env :
15
+ # Define global environment variables for the workflow
16
+ # The version of Flutter to use should use the minimum Dart SDK version supported by the package,
17
+ # refer to https://docs.flutter.dev/development/tools/sdk/releases.
18
+ # Note: The version below should be manually updated to the latest second most recent version
19
+ # after a new stable version comes out.
20
+ # Current minimum is set to Flutter 3.29. Make this the new minimum once the next
21
+ # stable version is released
22
+ FLUTTER_VERSION_MINIMUM_DEFAULT : " 3.29.3"
23
+ FLUTTER_VERSION_LATEST_STABLE_CHANNEL_DEFAULT : " 3.x"
24
+
18
25
jobs :
26
+ setup_matrix :
27
+ name : Determine Flutter Test Versions # Name for the setup_matrix job
28
+ runs-on : ubuntu-latest
29
+ outputs :
30
+ flutter_versions_json : ${{ steps.set_versions.outputs.versions_json }}
31
+ flutter_version_minimum : ${{ steps.set_versions.outputs.version_min }}
32
+ steps :
33
+ - name : Determine Flutter versions
34
+ id : set_versions
35
+ run : |
36
+ MIN_VERSION_VALUE="${{ env.FLUTTER_VERSION_MINIMUM_DEFAULT }}"
37
+ LATEST_VERSION_VALUE="${{ env.FLUTTER_VERSION_LATEST_STABLE_CHANNEL_DEFAULT }}"
38
+
39
+ echo "version_min=$MIN_VERSION_VALUE" >> $GITHUB_OUTPUT
40
+ echo "version_latest=$LATEST_VERSION_VALUE" >> $GITHUB_OUTPUT
41
+
42
+ VERSIONS_JSON=$(jq -c --null-input '$ARGS.positional' --args "$MIN_VERSION_VALUE" "$LATEST_VERSION_VALUE")
43
+ echo "versions_json=$VERSIONS_JSON" >> $GITHUB_OUTPUT
44
+
45
+ echo "Determined Min Version: $MIN_VERSION_VALUE"
46
+ echo "Determined Latest Version: $LATEST_VERSION_VALUE"
47
+ echo "Determined JSON: $VERSIONS_JSON"
48
+
19
49
# Does a sanity check that packages at least pass analysis on the N-1
20
50
# versions of Flutter stable if the package claims to support that version.
21
51
# This is to minimize accidentally making changes that break old versions
22
52
# (which we don't commit to supporting, but don't want to actively break)
23
53
# without updating the constraints.
24
54
lint_and_build :
25
55
name : Flutter Version ${{ matrix.flutter-version }} Lint and Build.
56
+ needs : setup_matrix # Ensures this job runs after setup_matrix completes
26
57
runs-on : ubuntu-latest
58
+ env :
59
+ SSH_PRIVATE_KEY : ${{ secrets.SSH_PRIVATE_KEY }}
60
+ FLUTTER_VERSION_MINIMUM : ${{ needs.setup_matrix.outputs.flutter_version_minimum }}
27
61
strategy :
28
62
matrix :
29
- flutter-version :
30
- # The version of Flutter to use should use the minimum Dart SDK version supported by the package,
31
- # refer to https://docs.flutter.dev/development/tools/sdk/releases.
32
- # Note: The version below should be manually updated to the latest second most recent version
33
- # after a new stable version comes out.
34
- - " 3.29.3"
35
- - " 3.x"
63
+ flutter-version : ${{ fromJSON(needs.setup_matrix.outputs.flutter_versions_json) }}
36
64
fail-fast : false
37
65
steps :
38
66
- name : 📚 Git Checkout
51
79
52
80
- name : ✨ Check Formatting
53
81
run : dart format --set-exit-if-changed lib
82
+ # Only continue on error if this is the job for the MINIMUM Flutter version
83
+ # This allows formatting issues to be warnings on older supported versions
84
+ # but enforces them on the latest stable or primary development version.
85
+ continue-on-error : ${{ matrix.flutter-version == env.FLUTTER_VERSION_MINIMUM }}
54
86
55
87
- name : 🕵️ Analyze
56
88
run : flutter analyze lib
0 commit comments