-
Notifications
You must be signed in to change notification settings - Fork 369
256 lines (244 loc) · 8.11 KB
/
main.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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
name: CI
on: [push, pull_request]
env:
PUB_ENVIRONMENT: bot.github
jobs:
setup:
uses: ./.github/workflows/setup.yml
docs:
name: "Documentation"
needs: [setup]
runs-on: ubuntu-latest
defaults:
run:
working-directory: docs
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/prepare
with:
dart_version: ${{ needs.setup.outputs.dart_version }}
- run: melos bootstrap --scope drift_docs,drift
working-directory: .
- name: Run build
env:
IS_RELEASE: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/latest-release' }}
run: dart run tool/ci_build.dart
- name: Analyze Dart and Drift sources
run: |
dart format -o none --set-exit-if-changed .
dart analyze --fatal-infos --fatal-warnings
dart run drift_dev analyze
- run: dart test
- name: Deploy to netlify (Branch)
if: ${{ github.event_name == 'push' }}
uses: nwtgck/actions-netlify@v2
with:
production-branch: latest-release
publish-dir: docs/deploy
enable-pull-request-comment: true
enable-commit-comment: false
netlify-config-path: "./netlify.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
- name: Deploy to netlify (Pull Request)
if: ${{ github.event_name == 'pull_request' }}
uses: nwtgck/actions-netlify@v2
with:
production-branch: latest-release
publish-dir: docs/deploy
enable-pull-request-comment: true
enable-commit-comment: false
netlify-config-path: "./netlify.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
alias: deploy-preview-${{ github.event.number }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
drift:
name: "drift package"
needs: [setup]
runs-on: ubuntu-latest
defaults:
run:
working-directory: drift
steps:
# setup
- uses: actions/checkout@v3
- uses: ./.github/actions/prepare
with:
dart_version: ${{ needs.setup.outputs.dart_version }}
- run: melos bootstrap --scope drift
working-directory: .
- name: Get dependencies for plugin
run: |
echo "dependency_overrides:" >> pubspec_overrides.yaml
echo " drift: {path: ../../}" >> pubspec_overrides.yaml
echo " drift_dev: {path: ../../../drift_dev}" >> pubspec_overrides.yaml
echo " sqlparser: {path: ../../../sqlparser}" >> pubspec_overrides.yaml
dart pub get
working-directory: drift/tools/analyzer_plugin
# analysis
- run: dart format -o none --set-exit-if-changed .
name: dartfmt
- run: dart analyze --fatal-infos --fatal-warnings
# build, test and upload coverage
- run: dart run build_runner build --delete-conflicting-outputs
- run: dart test --preset ci_unit_tests #-x background_isolate --coverage=coverage
# - uses: actions/upload-artifact@v2
# with:
# name: moor-coverage-data
# path: |
# moor/coverage/
# moor/.dart_tool/package_config.json
# retention-days: 1
drift_dev:
runs-on: ubuntu-latest
needs: [setup]
timeout-minutes: 15
defaults:
run:
working-directory: drift_dev
steps:
# setup
- uses: actions/checkout@v3
- uses: ./.github/actions/prepare
with:
dart_version: ${{ needs.setup.outputs.dart_version }}
- run: melos bootstrap --scope drift_dev
working-directory: .
# analysis
- run: dart format -o none --set-exit-if-changed .
name: dartfmt
- run: dart analyze --fatal-infos --fatal-warnings
- run: dart test
name: test
sqlparser:
runs-on: ubuntu-latest
needs: [setup]
defaults:
run:
working-directory: sqlparser
steps:
# setup
- uses: actions/checkout@v3
- uses: ./.github/actions/prepare
with:
dart_version: ${{ needs.setup.outputs.dart_version }}
- run: dart pub upgrade
# analysis
- run: dart format -o none --set-exit-if-changed .
name: dartfmt
- run: dart analyze --fatal-infos --fatal-warnings
# tests and coverage
- run: dart test #--coverage=coverage
# - uses: actions/upload-artifact@v2
# with:
# name: sqlparser-coverage-data
# path: |
# sqlparser/coverage/
# sqlparser/.dart_tool/package_config.json
# retention-days: 1
misc_integration_tests:
name: "Integration tests"
needs: [setup]
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
mariadb:
image: mariadb
env:
MARIADB_ROOT_PASSWORD: password
MARIADB_DATABASE: database
ports:
- 3306:3306
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/prepare
with:
dart_version: ${{ needs.setup.outputs.dart_version }}
- run: melos bootstrap --no-flutter
working-directory: .
- name: Postgres integration tests
working-directory: extras/drift_postgres
run: |
dart pub upgrade
dart test
- name: MariaDB integration tests
working-directory: extras/drift_mariadb
continue-on-error: true
run: |
dart pub upgrade
dart test
- name: Integration test with built_value
working-directory: examples/with_built_value
run: |
dart pub upgrade
dart run build_runner build --delete-conflicting-outputs
- name: Integration test with modular generation
working-directory: examples/modular
run: |
dart pub upgrade
dart run build_runner build --delete-conflicting-outputs
dart run bin/example.dart
- name: Integration test for migrations example
working-directory: examples/migrations_example
run: |
dart pub upgrade
dart test
migration_integration_tests:
name: "Integration tests for migration tooling"
needs: [setup]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/prepare
with:
dart_version: ${{ needs.setup.outputs.dart_version }}
- run: melos bootstrap --scope migrations_example
working-directory: .
- name: Run build
working-directory: examples/migrations_example
run: |
dart run build_runner build --delete-conflicting-outputs
dart run drift_dev schema generate drift_migrations/ test/generated/ --data-classes --companions
dart run drift_dev schema generate drift_migrations/ lib/src/generated
- name: Test
working-directory: examples/migrations_example
run: dart test
- name: Check that extracting schema still works
working-directory: examples/migrations_example
run: dart run drift_dev schema dump lib/database.dart drift_migrations/
# upload_coverage:
# runs-on: ubuntu-20.04
# needs: [moor, sqlparser]
# steps:
# - uses: actions/checkout@v2
# - uses: dart-lang/setup-dart@v1
# - run: dart pub upgrade
# name: "Setup coverage processor"
# working-directory: extras/tooling
# - uses: actions/download-artifact@v2
# with:
# name: moor-coverage-data
# path: moor/
# - uses: actions/download-artifact@v2
# with:
# name: sqlparser-coverage-data
# path: sqlparser/
# - run: dart run extras/tooling/bin/coverage.dart
# name: "Format coverage from raw data"
# - uses: codecov/codecov-action@v1
# with:
# file: lcov.info