-
Notifications
You must be signed in to change notification settings - Fork 7
146 lines (120 loc) · 5.73 KB
/
ci.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
name: ci
on: pull_request
jobs:
analyze:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- name: Set Flutter version from FVM config file to environment variables
id: fvm-config-action
uses: kuhnroyal/flutter-fvm-config-action@4155f8ca4c30a4f2f50df69caa0e4259f6cd1142
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
- name: Analyze
run: flutter analyze
# Since custom_lint can't run with "flutter analyze", we need to run it
# separately.
#
# See: https://pub.dev/packages/custom_lint#obtaining-the-list-of-lints-in-the-ci
custom-lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- name: Set Flutter version from FVM config file to environment variables
id: fvm-config-action
uses: kuhnroyal/flutter-fvm-config-action@4155f8ca4c30a4f2f50df69caa0e4259f6cd1142
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
- name: Custom Lint
run: dart run custom_lint
format:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- name: Install Dart
uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
with:
sdk: beta
- name: Install Prettier
run: npm install --global [email protected]
- name: Format (Dart)
run: dart format --set-exit-if-changed $(find lib -name "*.dart" -not \( -name "*.*freezed.dart" -o -name "*.*g.dart" \) )
- name: Format (Prettier)
run: prettier . --check
test:
# We need to use macOS because of the golden tests, see
# https://github.com/flutter/flutter/issues/36667#issuecomment-521335243.
runs-on: macos-14
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- name: Set Flutter version from FVM config file to environment variables
id: fvm-config-action
uses: kuhnroyal/flutter-fvm-config-action@4155f8ca4c30a4f2f50df69caa0e4259f6cd1142
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
- name: Test
run: flutter test
# Uploads the results of failed tests as .zip to GitHub.
#
# You can find the file under the "Summary" Tab on GitHub when all jobs of
# this workflows finished.
- name: Upload failed golden tests
if: failure()
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874
with:
name: failed-golden-tests
# When a golden test failed, are the results stored in the "failures"
# folder. The failures can be at several places, like in the app
# folder and in different packages.
path: "**/failures/*.png"
# We ignore it when no files could be found because the test command
# could also be failed because of an unit test. In this case there
# would be no failed golden test to upload.
if-no-files-found: ignore
app-preview:
if: "${{ github.event.pull_request.head.repo.full_name == github.repository }}"
runs-on: ubuntu-22.04
permissions:
pull-requests: write # for FirebaseExtended/action-hosting-deploy to comment on PRs
checks: write # for FirebaseExtended/action-hosting-deploy to comment on PRs
contents: "read" # for google-github-actions/auth
id-token: "write" # for google-github-actions/auth
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- name: Set Flutter version from FVM config file to environment variables
id: fvm-config-action
uses: kuhnroyal/flutter-fvm-config-action@4155f8ca4c30a4f2f50df69caa0e4259f6cd1142
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
- name: Build
run: |
flutter build web \
--web-renderer canvaskit \
--dart-define=RELEASE_DATE="$(date +"%B %e %Y")" \
--dart-define=FLAVOR="prod"
- id: "auth"
uses: "google-github-actions/auth@62cf5bd3e4211a0a0b51f2c6d6a37129d828611d"
env:
PROJECT_ID: ankigpt-prod
PROJECT_NUMBER: 41416187582
with:
workload_identity_provider: "projects/${{ env.PROJECT_NUMBER }}/locations/global/workloadIdentityPools/github/providers/github-provider"
service_account: "firebase-hosting-deployer@${{ env.PROJECT_ID }}.iam.gserviceaccount.com"
# From https://github.com/FirebaseExtended/action-hosting-deploy/issues/174#issuecomment-1312272238
- name: Set SERVICE_ACCOUNT_KEY to environment variables
run: |
echo "SERVICE_ACCOUNT_KEY=$(cat "${{ steps.auth.outputs.credentials_file_path }}" | tr -d '\n')" >> $GITHUB_ENV
- uses: FirebaseExtended/action-hosting-deploy@0cbcac4740c2bfb00d632f0b863b57713124eb5a
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ env.SERVICE_ACCOUNT_KEY }}"
projectId: ankigpt-prod
target: ankigpt-app