Skip to content

Commit 996ee4d

Browse files
committed
Improve CI workflow and speed
1 parent da39169 commit 996ee4d

File tree

1 file changed

+56
-30
lines changed

1 file changed

+56
-30
lines changed

.github/workflows/base.yaml

Lines changed: 56 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: Base
1+
name: CI & CD
22

33
on:
44
workflow_dispatch:
5-
5+
66
push:
77
branches: [main]
88
tags:
9-
- '[0-9]+.[0-9]+.[0-9]+*'
9+
- "[0-9]+.[0-9]+.[0-9]+*"
1010

1111
pull_request:
1212
branches: [main]
@@ -18,27 +18,25 @@ concurrency:
1818

1919
jobs:
2020
build:
21+
name: Build package & run tests
2122
runs-on: ubuntu-latest
2223

2324
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
2529

2630
- name: Check broken links
2731
uses: JustinBeckwith/linkinator-action@v1
2832
with:
2933
paths: "**/*.md"
3034

31-
- name: Get Flutter version by FVM
32-
uses: kuhnroyal/flutter-fvm-config-action@v2
33-
id: fvm-config-action
34-
with:
35-
path: '.fvmrc'
36-
flavor: 'stable'
37-
38-
- uses: subosito/flutter-action@v2
35+
- name: Set up Flutter
36+
uses: subosito/flutter-action@v2
3937
with:
40-
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
41-
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
38+
channel: "stable"
39+
architecture: x64
4240
cache: true
4341

4442
- name: Install dependencies
@@ -48,9 +46,8 @@ jobs:
4846
run: flutter gen-l10n
4947

5048
- name: Run l10n on example
51-
run: |
52-
cd example
53-
flutter gen-l10n
49+
run: flutter gen-l10n
50+
working-directory: example
5451

5552
- name: Format code
5653
run: dart format --set-exit-if-changed $(find . -name "*.dart" ! \( -wholename "./lib/localization/intl/*" -or -wholename "./example/lib/localization/intl/*" \))
@@ -59,16 +56,11 @@ jobs:
5956
run: dart analyze
6057

6158
- name: Run tests
62-
run: flutter test --coverage
59+
run: flutter test --no-pub --coverage
6360

6461
- name: Check publish warnings
6562
run: dart pub publish --dry-run
6663

67-
- name: Build example
68-
run: |
69-
cd example
70-
flutter build appbundle --debug
71-
7264
- name: Upload coverage to Codecov
7365
uses: codecov/codecov-action@v4
7466
env:
@@ -78,23 +70,58 @@ jobs:
7870
flags: unittests
7971
name: form_builder_validators
8072

73+
example:
74+
name: Build example app
75+
runs-on: ubuntu-latest
76+
77+
steps:
78+
- name: Checkout repository
79+
uses: actions/checkout@v4
80+
with:
81+
fetch-depth: 1 # Use shallow clone for faster checkout
82+
83+
- name: Set up Flutter
84+
uses: subosito/flutter-action@v2
85+
with:
86+
channel: "stable"
87+
architecture: x64
88+
cache: true
89+
90+
- name: Install dependencies
91+
run: dart pub get
92+
93+
- name: Run l10n
94+
run: flutter gen-l10n
95+
96+
- name: Run l10n on example
97+
run: flutter gen-l10n
98+
working-directory: example
99+
100+
- name: Build example
101+
run: flutter build appbundle --debug
102+
working-directory: example
103+
81104
deployment:
82105
if: ${{ github.ref_type == 'tag' }}
83-
needs: build
106+
needs: [build, example]
84107
name: Deploy package
85108
permissions:
86109
id-token: write
87110
runs-on: ubuntu-latest
88111
steps:
89-
- uses: actions/checkout@v4
112+
- name: Checkout repository
113+
uses: actions/checkout@v4
114+
with:
115+
fetch-depth: 1 # Use shallow clone for faster checkout
90116

91-
- uses: dart-lang/setup-dart@v1
117+
- name: Set up Dart
118+
uses: dart-lang/setup-dart@v1
92119

93-
- name: Flutter action
120+
- name: Set up Flutter
94121
uses: subosito/flutter-action@v2
95122
with:
96-
channel: 'stable'
97-
# use the build-in cache from Subosito
123+
channel: "stable"
124+
architecture: x64
98125
cache: true
99126

100127
- name: Install dependencies
@@ -105,4 +132,3 @@ jobs:
105132

106133
- name: Publish package
107134
run: dart pub publish -v -f
108-

0 commit comments

Comments
 (0)