-
Notifications
You must be signed in to change notification settings - Fork 125
217 lines (211 loc) · 7.7 KB
/
dart.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
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: Dart
on: pull_request
jobs:
packages:
strategy:
fail-fast: false
matrix:
package:
- gql
- gql_exec
- gql_code_builder_serializers
- gql_build
- gql_code_builder
- gql_link
- gql_dedupe_link
- gql_dio_link
- gql_error_link
- gql_http_link
- gql_websocket_link
- gql_transform_link
- gql_tristate_value
runs-on: ubuntu-latest
container:
image: dart:latest
name: Check ${{ matrix.package }}
env:
PACKAGE: ${{ matrix.package }}
steps:
- name: Workaround for "detected dubious ownership in repository at", see https://github.com/actions/checkout/issues/1169
run: |
git config --system --add safe.directory /__w/gql/gql
- name: Clone repository
uses: actions/checkout@v3
- name: Activate multipack
run: |
echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
dart pub global activate multipack
- name: Check pubspec
run: |
multipack --only $PACKAGE pubspec clean
multipack --only $PACKAGE exec git diff --exit-code pubspec.yaml
- name: Override local dependencies
run: |
multipack pubspec override
- name: Get dependencies
run: |
multipack --only $PACKAGE pub get
- name: Check formatting
run: |
echo ""
echo "A list of incorrectly formatted files may follow:"
echo ""
multipack --only $PACKAGE exec dart format . --set-exit-if-changed
echo ""
- name: Run build_runner if necessary
run: |
multipack --only $PACKAGE pub run \
build_runner build --delete-conflicting-outputs || true
- name: Analyze package
run: |
multipack --only $PACKAGE exec dart analyze --version
multipack --only $PACKAGE exec dart analyze --fatal-warnings .
- name: Run tests
run: |
multipack --only $PACKAGE exec [ -d ./test ] || exit 0
multipack --only $PACKAGE pub run test
examples:
strategy:
fail-fast: false
matrix:
package:
- gql_example_cli
- gql_example_cli_github
- gql_example_build
- gql_example_http_auth_link
- gql_example_dio_link
# gql_example_flutter would require flutter
runs-on: ubuntu-latest
container:
image: dart
name: Check ${{ matrix.package }}
env:
PACKAGE: ${{ matrix.package }}
steps:
- name: Workaround for "detected dubious ownership in repository at", see https://github.com/actions/checkout/issues/1169
run: |
git config --system --add safe.directory /__w/gql/
git config --system --add safe.directory /__w/gql/gql
- name: Clone repository
uses: actions/checkout@v3
- name: Activate multipack
run: |
echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
dart pub global activate multipack
- name: Check pubspec
run: |
git status
multipack --only $PACKAGE pubspec clean
multipack --only $PACKAGE exec git diff --exit-code pubspec.yaml
- name: Override local dependencies
run: |
multipack pubspec override
- name: Get dependencies
run: |
multipack --only $PACKAGE pub get
- name: Run builders
run: |
multipack --only $PACKAGE pub run \
build_runner build --delete-conflicting-outputs || true
- name: Check build diff
run: |
multipack --only $PACKAGE exec git diff --exit-code **/*.gql.dart
- name: Check formatting
run: |
echo ""
echo "A list of incorrectly formatted files may follow:"
echo ""
multipack --only $PACKAGE exec dart format . --set-exit-if-changed
echo ""
- name: Analyze package
run: |
multipack --only $PACKAGE exec dart analyze --version
multipack --only $PACKAGE exec dart analyze --fatal-warnings .
builder_tests:
strategy:
matrix:
package:
- end_to_end_test
- end_to_end_test_tristate
runs-on: ubuntu-latest
container:
image: dart
name: Check ${{ matrix.package }}
env:
PACKAGE: ${{ matrix.package }}
steps:
- name: Workaround for "detected dubious ownership in repository at", see https://github.com/actions/checkout/issues/1169
run: |
git config --system --add safe.directory /__w/gql/
git config --system --add safe.directory /__w/gql/gql
- name: Clone repository
uses: actions/checkout@v3
- name: Activate multipack
run: |
echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
dart pub global activate multipack
- name: Check pubspec
run: |
multipack --only $PACKAGE pubspec clean
multipack --only $PACKAGE exec git diff --exit-code pubspec.yaml
- name: Override local dependencies
run: |
multipack pubspec override
- name: Get dependencies
run: |
multipack --only $PACKAGE pub get
- name: Run builders
run: |
multipack --only $PACKAGE pub run build_runner build --delete-conflicting-outputs
- name: Check build diff
run: |
multipack --only $PACKAGE exec git diff --exit-code **/*.gql.dart
- name: Check formatting
run: |
echo ""
echo "A list of incorrectly formatted files may follow:"
echo ""
multipack --only $PACKAGE exec dart format . --set-exit-if-changed
echo ""
- name: Analyze package
run: |
multipack --only $PACKAGE exec dart analyze --version
multipack --only $PACKAGE exec dart analyze --fatal-warnings .
- name: Run tests
run: |
multipack --only $PACKAGE exec [ -d ./test ] || exit 0
multipack --only $PACKAGE pub run test
publish_dry_run:
runs-on: ubuntu-latest
container:
image: dart
env:
PACKAGES: 'gql,gql_build,gql_code_builder,gql_dedupe_link,gql_dio_link,gql_exec,gql_http_link,gql_link,gql_pedantic,gql_transform_link,gql_error_link,gql_websocket_link'
PUB_ACCESS_TOKEN: ${{ secrets.PUB_ACCESS_TOKEN }}
PUB_REFRESH_TOKEN: ${{ secrets.PUB_REFRESH_TOKEN }}
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Activate multipack
run: |
echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
dart pub global activate multipack
- name: Bump to alpha version
run: |
multipack --only $PACKAGES pubspec bump-alpha
- name: Sync package versions
run: |
multipack --only $PACKAGES pubspec sync-versions
- name: Publish packages
shell: bash
continue-on-error: true
run: |
echo "{\"accessToken\":\"$PUB_ACCESS_TOKEN\",\"refreshToken\":\"$PUB_REFRESH_TOKEN\",\"idToken\":null,\"tokenEndpoint\":\"https://accounts.google.com/o/oauth2/token\",\"scopes\":[\"openid\",\"https://www.googleapis.com/auth/userinfo.email\"],\"expiration\":1588334512218}" > $HOME/.pub-cache/credentials.json
## BEGIN TEMPORARY WORKAROUND FOR https://github.com/google/built_value.dart/issues/1032
## See dry_run_workaround_helpers.sh for more details
source .github/workflows/dry_run_workaround_helpers.sh
multipack --only $PACKAGES exec 'dart pub publish --dry-run 2>&1' | cap
ignore_err_when_stdout_contains \
'Publishing gql_build' \
'Package has 1 warning' \
'package:built_value_generator/built_value_generator.dart is opting out of null safety' \