1
- name : Base
1
+ name : CI & CD
2
2
3
3
on :
4
4
workflow_dispatch :
5
-
5
+
6
6
push :
7
7
branches : [main]
8
8
tags :
9
- - ' [0-9]+.[0-9]+.[0-9]+*'
9
+ - " [0-9]+.[0-9]+.[0-9]+*"
10
10
11
11
pull_request :
12
12
branches : [main]
@@ -18,10 +18,14 @@ concurrency:
18
18
19
19
jobs :
20
20
build :
21
+ name : Build package & run tests
21
22
runs-on : ubuntu-latest
22
23
23
24
steps :
24
- - uses : actions/checkout@v4
25
+ - name : Checkout repository
26
+ uses : actions/checkout@v4
27
+ with :
28
+ fetch-depth : 1 # Use shallow clone for faster checkout
25
29
26
30
- name : Check broken links
27
31
uses : JustinBeckwith/linkinator-action@v1
@@ -32,13 +36,15 @@ jobs:
32
36
uses : kuhnroyal/flutter-fvm-config-action@v2
33
37
id : fvm-config-action
34
38
with :
35
- path : ' .fvmrc'
36
- flavor : ' stable'
39
+ path : " .fvmrc"
40
+ flavor : " stable"
37
41
38
- - uses : subosito/flutter-action@v2
42
+ - name : Set up Flutter
43
+ uses : subosito/flutter-action@v2
39
44
with :
40
45
flutter-version : ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
41
46
channel : ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
47
+ architecture : x64
42
48
cache : true
43
49
44
50
- name : Install dependencies
48
54
run : flutter gen-l10n
49
55
50
56
- name : Run l10n on example
51
- run : |
52
- cd example
53
- flutter gen-l10n
57
+ run : flutter gen-l10n
58
+ working-directory : example
54
59
55
60
- name : Format code
56
61
run : dart format --set-exit-if-changed $(find . -name "*.dart" ! \( -wholename "./lib/localization/intl/*" -or -wholename "./example/lib/localization/intl/*" \))
@@ -59,16 +64,11 @@ jobs:
59
64
run : dart analyze
60
65
61
66
- name : Run tests
62
- run : flutter test --coverage
67
+ run : flutter test --no-pub -- coverage
63
68
64
69
- name : Check publish warnings
65
70
run : dart pub publish --dry-run
66
71
67
- - name : Build example
68
- run : |
69
- cd example
70
- flutter build appbundle --debug
71
-
72
72
- name : Upload coverage to Codecov
73
73
uses : codecov/codecov-action@v4
74
74
env :
@@ -78,23 +78,74 @@ jobs:
78
78
flags : unittests
79
79
name : form_builder_validators
80
80
81
+ example :
82
+ name : Build example app
83
+ runs-on : ubuntu-latest
84
+
85
+ steps :
86
+ - name : Checkout repository
87
+ uses : actions/checkout@v4
88
+ with :
89
+ fetch-depth : 1 # Use shallow clone for faster checkout
90
+
91
+ - name : Get Flutter version by FVM
92
+ uses : kuhnroyal/flutter-fvm-config-action@v2
93
+ id : fvm-config-action
94
+ with :
95
+ path : " .fvmrc"
96
+ flavor : " stable"
97
+
98
+ - name : Set up Flutter
99
+ uses : subosito/flutter-action@v2
100
+ with :
101
+ flutter-version : ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
102
+ channel : ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
103
+ architecture : x64
104
+ cache : true
105
+
106
+ - name : Install dependencies
107
+ run : dart pub get
108
+
109
+ - name : Run l10n
110
+ run : flutter gen-l10n
111
+
112
+ - name : Run l10n on example
113
+ run : flutter gen-l10n
114
+ working-directory : example
115
+
116
+ - name : Build example
117
+ run : flutter build appbundle --debug
118
+ working-directory : example
119
+
81
120
deployment :
82
121
if : ${{ github.ref_type == 'tag' }}
83
- needs : build
122
+ needs : [ build, example]
84
123
name : Deploy package
85
124
permissions :
86
125
id-token : write
87
126
runs-on : ubuntu-latest
88
127
steps :
89
- - uses : actions/checkout@v4
128
+ - name : Checkout repository
129
+ uses : actions/checkout@v4
130
+ with :
131
+ fetch-depth : 1 # Use shallow clone for faster checkout
132
+
133
+ - name : Set up Dart
134
+ uses : dart-lang/setup-dart@v1
90
135
91
- - uses : dart-lang/setup-dart@v1
136
+ - name : Get Flutter version by FVM
137
+ uses : kuhnroyal/flutter-fvm-config-action@v2
138
+ id : fvm-config-action
139
+ with :
140
+ path : " .fvmrc"
141
+ flavor : " stable"
92
142
93
- - name : Flutter action
143
+ - name : Set up Flutter
94
144
uses : subosito/flutter-action@v2
95
145
with :
96
- channel : ' stable'
97
- # use the build-in cache from Subosito
146
+ flutter-version : ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
147
+ channel : ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
148
+ architecture : x64
98
149
cache : true
99
150
100
151
- name : Install dependencies
@@ -105,4 +156,3 @@ jobs:
105
156
106
157
- name : Publish package
107
158
run : dart pub publish -v -f
108
-
0 commit comments