Skip to content

Commit fcba3ee

Browse files
committed
CI
1 parent 70ec280 commit fcba3ee

File tree

1 file changed

+50
-32
lines changed

1 file changed

+50
-32
lines changed

.github/workflows/base.yaml

Lines changed: 50 additions & 32 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]
@@ -21,24 +21,21 @@ jobs:
2121
runs-on: ubuntu-latest
2222

2323
steps:
24-
- uses: actions/checkout@v4
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 1 # Use shallow clone for faster checkout
2528

2629
- name: Check broken links
2730
uses: JustinBeckwith/linkinator-action@v1
2831
with:
2932
paths: "**/*.md"
3033

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
34+
- name: Set up Flutter
35+
uses: subosito/flutter-action@v2
3936
with:
40-
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
41-
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
37+
channel: "stable"
38+
architecture: x64
4239
cache: true
4340

4441
- name: Install dependencies
@@ -47,28 +44,18 @@ jobs:
4744
- name: Run l10n
4845
run: flutter gen-l10n
4946

50-
- name: Run l10n on example
51-
run: |
52-
cd example
53-
flutter gen-l10n
54-
5547
- name: Format code
5648
run: dart format --set-exit-if-changed $(find . -name "*.dart" ! \( -wholename "./lib/localization/intl/*" -or -wholename "./example/lib/localization/intl/*" \))
5749

5850
- name: Analyze static code
5951
run: dart analyze
6052

6153
- name: Run tests
62-
run: flutter test --coverage
54+
run: flutter test --no-pub --coverage
6355

6456
- name: Check publish warnings
6557
run: dart pub publish --dry-run
6658

67-
- name: Build example
68-
run: |
69-
cd example
70-
flutter build appbundle --debug
71-
7259
- name: Upload coverage to Codecov
7360
uses: codecov/codecov-action@v4
7461
env:
@@ -78,23 +65,55 @@ jobs:
7865
flags: unittests
7966
name: form_builder_validators
8067

68+
example:
69+
runs-on: ubuntu-latest
70+
71+
steps:
72+
- name: Checkout repository
73+
uses: actions/checkout@v4
74+
with:
75+
fetch-depth: 1 # Use shallow clone for faster checkout
76+
77+
- name: Set up Flutter
78+
uses: subosito/flutter-action@v2
79+
with:
80+
channel: "stable"
81+
architecture: x64
82+
cache: true
83+
84+
- name: Install dependencies
85+
run: dart pub get
86+
working-directory: example
87+
88+
- name: Run l10n on example
89+
run: flutter gen-l10n
90+
working-directory: example
91+
92+
- name: Build example
93+
run: flutter build appbundle --debug
94+
working-directory: example
95+
8196
deployment:
8297
if: ${{ github.ref_type == 'tag' }}
83-
needs: build
98+
needs: [build, example]
8499
name: Deploy package
85100
permissions:
86101
id-token: write
87102
runs-on: ubuntu-latest
88103
steps:
89-
- uses: actions/checkout@v4
104+
- name: Checkout repository
105+
uses: actions/checkout@v4
106+
with:
107+
fetch-depth: 1 # Use shallow clone for faster checkout
90108

91-
- uses: dart-lang/setup-dart@v1
109+
- name: Set up Dart
110+
uses: dart-lang/setup-dart@v1
92111

93-
- name: Flutter action
112+
- name: Set up Flutter
94113
uses: subosito/flutter-action@v2
95114
with:
96-
channel: 'stable'
97-
# use the build-in cache from Subosito
115+
channel: "stable"
116+
architecture: x64
98117
cache: true
99118

100119
- name: Install dependencies
@@ -105,4 +124,3 @@ jobs:
105124

106125
- name: Publish package
107126
run: dart pub publish -v -f
108-

0 commit comments

Comments
 (0)