-
-
Notifications
You must be signed in to change notification settings - Fork 75
164 lines (138 loc) · 4.89 KB
/
github-actions.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: GitHub Actions
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Get project Flutter version 🏷️
id: fvm-config
uses: kuhnroyal/flutter-fvm-config-action@v1.2.0
- name: Setup Flutter 💻
uses: subosito/flutter-action@v2.10.0
id: setup-flutter
with:
flutter-version: ${{ steps.fvm-config.outputs.FLUTTER_VERSION }}
cache: true
cache-key: ${{ runner.os }}-flutter-${{ steps.fvm-config.outputs.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }}
- name: Cache Pub 💾
uses: actions/cache@v3
with:
path: |
${{ env.PUB_CACHE }}
**/.dart_tool
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Run tests 🧪
run: |
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
flutter test --coverage --concurrency=12
flutter pub run remove_from_coverage -f coverage/lcov.info -r '\.g\.dart$' -r 'extensions\.dart'
- name: Upload coverage report 📡
uses: codecov/codecov-action@v3.1.4
with:
files: ./coverage/lcov.info
flags: appainter
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Get project Flutter version 🏷️
id: fvm-config
uses: kuhnroyal/flutter-fvm-config-action@v1.2.0
- name: Setup Flutter 💻
uses: subosito/flutter-action@v2.10.0
with:
flutter-version: ${{ steps.fvm-config.outputs.FLUTTER_VERSION }}
cache: true
cache-key: ${{ runner.os }}-flutter-${{ steps.fvm-config.outputs.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }}
- name: Cache Pub 💾
uses: actions/cache@v3
with:
path: |
${{ env.PUB_CACHE }}
**/.dart_tool
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Run linting 🧪
run: |
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
dart format --output=none --set-exit-if-changed .
flutter analyze
build-deploy-web:
name: Build web app and deploy
runs-on: ubuntu-latest
concurrency:
group: deploy-web
cancel-in-progress: true
needs: [lint, test]
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main
token: ${{ secrets.PAT }}
- name: Get project Flutter version 🏷️
id: fvm-config
uses: kuhnroyal/flutter-fvm-config-action@v1.2.0
- name: Setup Flutter 💻
uses: subosito/flutter-action@v2.10.0
with:
flutter-version: ${{ steps.fvm-config.outputs.FLUTTER_VERSION }}
cache: true
cache-key: ${{ runner.os }}-flutter-${{ steps.fvm-config.outputs.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }}
- name: Cache Pub 💾
uses: actions/cache@v3
with:
path: |
${{ env.PUB_CACHE }}
**/.dart_tool
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Build web app 🏗
id: build-web
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
run: |
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
# Bump version build number
flutter pub run cider bump build
echo "version=v$(flutter pub run cider version)" >> $GITHUB_OUTPUT
# Build web app
flutter build web --source-maps --no-tree-shake-icons --dart-define=FLUTTER_WEB_USE_SKIA=true
# Upload source map to Sentry
flutter packages pub run sentry_dart_plugin
- name: Commit new version 🆕
uses: stefanzweifel/git-auto-commit-action@v4.16.0
env:
version: ${{ steps.build-web.outputs.version }}
with:
commit_message: "chore(release-web): ${{ env.version }} [skip ci]"
file_pattern: pubspec.yaml
push_options: --force
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.4.3
with:
branch: gh-pages
folder: build/web