-
-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (127 loc) · 5.3 KB
/
check.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
name: Check
run-name: Check ${{ (vars.RUNS_ON_SELF_HOSTED == null && '(on GitHub-hosted)') || '(on self-hosted)' }}
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
workflow_call:
permissions:
contents: read
pull-requests: write
checks: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -euo pipefail {0}
jobs:
format:
runs-on: ${{ (vars.RUNS_ON_SELF_HOSTED == null && 'ubuntu-latest') || 'self-hosted' }}
timeout-minutes: 30
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # v2.16.0
with:
flutter-version: ${{ (vars.FLUTTER_VERSION != null && vars.FLUTTER_VERSION) || '' }}
channel: stable
cache: ${{ (vars.RUNS_ON_SELF_HOSTED == null && true) || false }}
- run: flutter pub get
- run: dart format -l 80 --set-exit-if-changed .
- name: Check for changes
if: failure()
run: git diff --exit-code
analyze:
runs-on: ${{ (vars.RUNS_ON_SELF_HOSTED == null && 'ubuntu-latest') || 'self-hosted' }}
timeout-minutes: 30
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Run pre-process script
shell: bash
env:
PREPROCESS_SCRIPT_BASE64: ${{ secrets.PREPROCESS_SCRIPT_BASE64 }}
run: |
if [ -n "$PREPROCESS_SCRIPT_BASE64" ]; then
echo "$PREPROCESS_SCRIPT_BASE64" | base64 --decode > ${{ runner.temp }}/pre-process.sh && bash ${{ runner.temp }}/pre-process.sh
fi
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # v2.16.0
with:
flutter-version: ${{ (vars.FLUTTER_VERSION != null && vars.FLUTTER_VERSION) || '' }}
channel: stable
cache: ${{ (vars.RUNS_ON_SELF_HOSTED == null && true) || false }}
- run: flutter pub get
- name: flutterfire configure
env:
FIREBASE_ADMIN_SERVICE_ACCOUNT_JSON_BASE64: ${{ secrets.FIREBASE_ADMIN_SERVICE_ACCOUNT_JSON_BASE64 }}
run: |
which firebase || curl -sL https://firebase.tools | analytics=false bash
dart pub global activate flutterfire_cli 1.0.1-dev.4
echo -n "$FIREBASE_ADMIN_SERVICE_ACCOUNT_JSON_BASE64" | base64 --decode > ${{ runner.temp }}/firebase_admin_service_account.json
GOOGLE_APPLICATION_CREDENTIALS=${{ runner.temp }}/firebase_admin_service_account.json make flutterfire-configure-dev
- run: flutter analyze --write=flutter_analyze.log
- if: ${{ !cancelled() }}
run: dart run custom_lint --format=json | tee custom_lint.log
- if: ${{ !cancelled() }}
uses: yorifuji/flutter-analyze-commenter@b852004b1f3ca8783b010f4ea098946029cbb2cd # v1.2.0
with:
analyze-log: flutter_analyze.log
custom-lint-log: custom_lint.log
verbose: true
# diff:
# runs-on: ${{ (vars.RUNS_ON_SELF_HOSTED == null && 'ubuntu-latest') || 'self-hosted' }}
# timeout-minutes: 30
# steps:
# - uses: actions/checkout@v4
# - uses: subosito/flutter-action@v2
# with:
# flutter-version: ${{ (vars.FLUTTER_VERSION != null && vars.FLUTTER_VERSION) || '' }}
# channel: stable
# cache: ${{ (vars.RUNS_ON_SELF_HOSTED == null && true) || false }}
# - run: flutter pub get
# - run: make build-runner
# - name: Check for changes
# run: |
# if [[ -n $(git status --porcelain) ]]; then
# echo "There are changes in the working tree, please commit them before running this action."
# git status
# exit 1
# fi
test:
runs-on: ${{ (vars.RUNS_ON_SELF_HOSTED == null && 'ubuntu-latest') || 'self-hosted' }}
timeout-minutes: 30
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Run pre-process script
shell: bash
env:
PREPROCESS_SCRIPT_BASE64: ${{ secrets.PREPROCESS_SCRIPT_BASE64 }}
run: |
if [ -n "$PREPROCESS_SCRIPT_BASE64" ]; then
echo "$PREPROCESS_SCRIPT_BASE64" | base64 --decode > ${{ runner.temp }}/pre-process.sh && bash ${{ runner.temp }}/pre-process.sh
fi
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # v2.16.0
with:
flutter-version: ${{ (vars.FLUTTER_VERSION != null && vars.FLUTTER_VERSION) || '' }}
channel: stable
cache: ${{ (vars.RUNS_ON_SELF_HOSTED == null && true) || false }}
- run: flutter pub get
- run: flutter test -x golden --reporter json > test_report.json
- uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5
if: success() || failure() # ignore cancelled
with:
name: flutter test report
path: test_report.json
reporter: flutter-json
action-timeline:
needs: [format, analyze, test]
if: ${{ !cancelled() && github.event.workflow == '.github/workflows/check.yml' }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1