-
Notifications
You must be signed in to change notification settings - Fork 5
194 lines (160 loc) · 5.34 KB
/
ci.yaml
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: ci
on:
workflow_dispatch: # Allows to manually trigger the workflow
schedule:
- cron: "0 0 */14 * *" # Runs every 3 days at 00:00 UTC to ensure that the packages are compatible with the latest Dart SDK
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
- edited
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# The minimum Flutter version that is supported by the packages.
#
# Uses Dart SDK v3.0.6 because it is the minimum version that supports
MIN_FLUTTER_VERSION: 3.10.6
# The minimum Dart version that is supported by the packages.
#
# Is also used in the Dart SDK matrix (needs to be updated there too, can't
# use env var - see: https://stackoverflow.com/a/74073435/8358501)
MIN_DART_VERSION: 3.0.6
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dart-lang/[email protected]
with:
sdk: ${{ env.MIN_DART_VERSION }}
- name: Install Melos
run: dart pub global activate melos
- name: Melos Bootstrap
run: melos bootstrap --no-flutter
- name: Run tests
run: melos run test
test-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dart-lang/[email protected]
with:
sdk: ${{ env.MIN_DART_VERSION }}
- name: Install Melos
run: dart pub global activate melos
- name: Melos Bootstrap
run: melos bootstrap --no-flutter
- name: Run integration tests
env:
CODEMAGIC_TOKEN: ${{ secrets.CODEMAGIC_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
run: melos run test-e2e
test-installation:
runs-on: ${{ matrix.os }}
# Testing on all platforms, the minium Dart SDK, the lastest stable SDK and
# the latest beta SDK to ensure that the packages are compatible with all
# Dart SDKs.
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
sdk: [stable, beta, 3.0.6]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: dart-lang/[email protected]
with:
sdk: ${{ matrix.sdk }}
- name: Install Codemagic App Preview CLI
run: dart pub global activate --source path packages/codemagic_app_preview
- name: Verify Codemagic App Preview CLI Installation (macOS / Linux)
if: runner.os != 'Windows'
run: |
if [[ $(app_preview --help) =~ "A command line tool to post a comment to" ]]; then
echo '✅ Codemagic App Preview CLI is installed!'
else
echo '❌ Codemagic App Preview CLI is not installed.'
exit 1
fi
shell: bash
- name: Verify Codemagic App Preview CLI Installation (Windows)
if: runner.os == 'Windows'
run: |
$app_preview_help = app_preview --help
if ($app_preview_help -match "A command line tool to post a comment to") {
Write-Output "✅ Codemagic App Preview CLI is installed!"
} else {
Write-Output "❌ Codemagic App Preview CLI is not installed."
exit 1
}
shell: pwsh
# Should only execute the Flutter packages.
#
# However, because we are using a too old version of Dart SDK a Melos version
# is installed, that not supports the filter for only executing Flutter
# packages.
analyze-flutter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v1
with:
flutter-version: ${{ env.MIN_FLUTTER_VERSION }}
- name: Install Melos
run: dart pub global activate melos
- name: Melos Bootstrap
run: melos bootstrap
- name: Run analyze
run: melos run analyze:flutter
analyze-dart:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dart-lang/[email protected]
with:
# We need to use Dart SDK 2.18 to be able to get Melos v3 which is
# need to run "melos run analyze:dart --no-select".
sdk: 3.0.6
- name: Install Melos
run: dart pub global activate melos
- name: Melos Bootstrap
run: melos bootstrap --no-flutter
- name: Run analyze
run: melos run analyze:dart --no-select
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Prettier
run: npm install -g prettier
- name: Run Prettier
run: prettier . --check
- uses: dart-lang/[email protected]
with:
sdk: ${{ env.MIN_DART_VERSION }}
- name: Install Melos
run: dart pub global activate melos
- name: Melos Bootstrap
run: melos bootstrap --no-flutter
- name: Run format
run: melos run format
pana:
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/codemagic_app_preview
steps:
- uses: actions/checkout@v3
- uses: dart-lang/[email protected]
with:
sdk: ${{ env.MIN_DART_VERSION }}
- name: Install pana
run: dart pub global activate pana
- name: Install dependencies
run: dart pub get
- name: Verify Pub Score
run: pana --exit-code-threshold 0