-
Notifications
You must be signed in to change notification settings - Fork 354
531 lines (467 loc) · 16.8 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
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
name: CI
defaults:
run: {shell: bash}
env:
# Note: when changing this, also change
# jobs.node_tests.strategy.matrix.node_version and the Node version for Dart
# dev tests.
DEFAULT_NODE_VERSION: 18
on:
push:
branches: [main, feature.*]
tags: ['[0-9]+.[0-9]+.*']
pull_request:
jobs:
sass_spec_language:
name: "Language Tests | Dart ${{ matrix.dart_channel }} | ${{ matrix.async_label }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dart_channel: [stable, dev]
async_label: [synchronous]
async_args: ['']
include:
- dart_channel: stable
async_label: asynchronous
async_args: '--cmd-args --async'
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with: {sdk: "${{ matrix.dart_channel }}"}
- run: dart pub get
- name: Check out sass-spec
uses: sass/clone-linked-repo@v1
with: {repo: sass/sass-spec}
- uses: actions/setup-node@v3
with: {node-version: "${{ env.DEFAULT_NODE_VERSION }}"}
- run: npm install
working-directory: sass-spec
- name: Run specs
run: npm run sass-spec -- --dart .. $extra_args
working-directory: sass-spec
env: {extra_args: "${{ matrix.async_args }}"}
# The versions should be kept up-to-date with the latest LTS Node releases.
# They next need to be rotated April 2021. See
# https://github.com/nodejs/Release.
sass_spec_js:
name: "JS API Tests | Dart ${{ matrix.dart_channel }} | Node ${{ matrix.node_version }} | ${{ matrix.os }}"
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
dart_channel: [stable]
node_version: [18]
include:
# Include LTS versions on Ubuntu
- os: ubuntu-latest
dart_channel: stable
node_version: 16
- os: ubuntu-latest
dart_channel: stable
node_version: 14
- os: ubuntu-latest
dart_channel: dev
node_version: 18
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with: {sdk: "${{ matrix.dart_channel }}"}
- run: dart pub get
- uses: actions/setup-node@v3
with: {node-version: "${{ matrix.node_version }}"}
- run: npm install
- name: Check out sass-spec
uses: sass/clone-linked-repo@v1
with: {repo: sass/sass-spec}
- name: Install sass-spec dependencies
run: npm install
working-directory: sass-spec
- name: Build JS
run: dart run grinder pkg-npm-dev
- name: Check out Sass specification
uses: sass/clone-linked-repo@v1
with:
repo: sass/sass
path: language
- name: Run tests
run: npm run js-api-spec -- --sassSassRepo ../language --sassPackage ../build/npm
working-directory: sass-spec
dart_tests:
name: "Dart tests | Dart ${{ matrix.dart_channel }} | ${{ matrix.os }}"
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
dart_channel: [stable]
include: [{os: ubuntu-latest, dart_channel: dev}]
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with: {sdk: "${{ matrix.dart_channel }}"}
- run: dart pub get
- run: dart run grinder pkg-standalone-dev
- name: Run tests
run: dart run test -p vm -x node -r expanded
# Unit tests that use Node.js, defined in test/.
#
# The versions should be kept up-to-date with the latest LTS Node releases.
# They next need to be rotated April 2021. See
# https://github.com/nodejs/Release.
node_tests:
name: "Node tests | Dart ${{ matrix.dart_channel }} | Node ${{ matrix.node_version }} | ${{ matrix.os }}"
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
dart_channel: [stable]
node_version: [18]
include:
# Temporarily adding back Node 12 here until we actually drop support
# in the package.json.
- os: ubuntu-latest
dart_channel: stable
node_version: 12
# Include LTS versions on Ubuntu
- os: ubuntu-latest
dart_channel: stable
node_version: 16
- os: ubuntu-latest
dart_channel: stable
node_version: 14
- os: ubuntu-latest
dart_channel: dev
node_version: 18
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with: {sdk: "${{ matrix.dart_channel }}"}
- run: dart pub get
- uses: actions/setup-node@v3
with: {node-version: "${{ matrix.node_version }}"}
- run: npm install
- run: dart run grinder before-test
- name: Run tests
run: dart run test -j 2 -t node -r expanded
static_analysis:
name: Static analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- name: Analyze Dart
run: dart analyze --fatal-warnings --fatal-infos .
dartdoc:
name: Dartdoc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- name: dartdoc sass
run: dart run dartdoc --quiet --no-generate-docs
--errors ambiguous-doc-reference,broken-link,deprecated
--errors unknown-directive,unknown-macro,unresolved-doc-reference
- name: dartdoc sass_api
run: cd pkg/sass_api && dart run dartdoc --quiet --no-generate-docs
--errors ambiguous-doc-reference,broken-link,deprecated
--errors unknown-directive,unknown-macro,unresolved-doc-reference
double_check:
name: Double-check
runs-on: ubuntu-latest
needs:
- sass_spec_language
- sass_spec_js
- dart_tests
- node_tests
- static_analysis
- dartdoc
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- name: Run checks
run: dart run grinder double-check-before-release
bootstrap:
name: "Bootstrap ${{ matrix.bootstrap_version }}"
runs-on: ubuntu-latest
needs: [double_check]
strategy:
fail-fast: false
matrix:
bootstrap_version: [4, 5]
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- run: dart run grinder fetch-bootstrap${{matrix.bootstrap_version}}
env: {GITHUB_BEARER_TOKEN: "${{ secrets.GITHUB_TOKEN }}"}
- name: Build
run: dart bin/sass.dart --quiet build/bootstrap/scss:build/bootstrap-output
bourbon:
name: Bourbon
runs-on: ubuntu-latest
needs: [double_check]
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- run: dart run grinder fetch-bourbon
env: {GITHUB_BEARER_TOKEN: "${{ secrets.GITHUB_TOKEN }}"}
- name: Test
run: |
dart bin/sass.dart --quiet -I build/bourbon -I build/bourbon/spec/fixtures \
build/bourbon/spec/fixtures:build/bourbon-output
foundation:
name: Foundation
runs-on: ubuntu-latest
needs: [double_check]
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- run: dart run grinder fetch-foundation
env: {GITHUB_BEARER_TOKEN: "${{ secrets.GITHUB_TOKEN }}"}
# TODO(nweiz): Foundation has proper Sass tests, but they're currently not
# compatible with Dart Sass. Once they are, we should run those rather
# than just building the CSS output.
- name: Build
run: dart bin/sass.dart --quiet build/foundation-sites/assets:build/foundation-output
bulma:
name: Bulma
runs-on: ubuntu-latest
needs: [double_check]
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- run: dart run grinder fetch-bulma
env: {GITHUB_BEARER_TOKEN: "${{ secrets.GITHUB_TOKEN }}"}
- name: Build
run: dart bin/sass.dart --quiet build/bulma/bulma.sass build/bulma-output.css
deploy_github_linux:
name: "Deploy Github: linux-ia32, linux-x64"
runs-on: ubuntu-latest
needs: [bootstrap, bourbon, foundation, bulma]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- name: Deploy
run: dart run grinder pkg-github-release pkg-github-linux-ia32 pkg-github-linux-x64
env:
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot
deploy_github_linux_qemu:
name: "Deploy Github: linux-${{ matrix.arch }}"
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: arm
platform: linux/arm/v7
- arch: arm64
platform: linux/arm64
needs: [deploy_github_linux]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- name: Deploy
run: |
docker run --rm \
--env "GH_TOKEN=$GH_TOKEN" \
--env "GH_USER=$GH_USER" \
--platform ${{ matrix.platform }} \
--volume "$PWD:$PWD" \
--workdir "$PWD" \
docker.io/library/dart:latest \
/bin/sh -c "dart pub get && dart run grinder pkg-github-linux-${{ matrix.arch }}"
env:
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot
deploy_github:
name: "Deploy Github: ${{ matrix.platform }}"
runs-on: ${{ matrix.runner }}
needs: [deploy_github_linux]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
strategy:
matrix:
include:
- runner: macos-latest
platform: macos-x64
architecture: x64
- runner: self-hosted
platform: macos-arm64
architecture: arm64
- runner: windows-latest
platform: windows
architecture: x64
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
# Workaround for dart-lang/setup-dart#59
with:
architecture: ${{ matrix.architecture }}
- run: dart pub get
- name: Deploy
run: dart run grinder pkg-github-${{ matrix.platform }}
env:
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot
deploy_npm:
name: Deploy npm
runs-on: ubuntu-latest
needs: [bootstrap, bourbon, foundation, bulma]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- uses: actions/setup-node@v3
with: {node-version: "${{ env.DEFAULT_NODE_VERSION }}"}
- name: Deploy
run: dart run grinder pkg-npm-deploy
env:
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
deploy_bazel:
name: Deploy Bazel
runs-on: ubuntu-latest
needs: [deploy_npm]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- uses: actions/setup-node@v3
with: {node-version: "${{ env.DEFAULT_NODE_VERSION }}"}
- name: Deploy
run: dart run grinder update-bazel
env:
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot
deploy_pub:
name: "Deploy Pub"
runs-on: ubuntu-latest
needs: [bootstrap, bourbon, foundation, bulma]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- uses: actions/setup-node@v3
with: {node-version: "${{ env.DEFAULT_NODE_VERSION }}"}
- name: Deploy
run: dart run grinder pkg-pub-deploy
env: {PUB_CREDENTIALS: "${{ secrets.PUB_CREDENTIALS }}"}
deploy_sub_packages:
name: "Deploy Sub-Packages"
runs-on: ubuntu-latest
needs: [deploy_pub]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- name: Deploy
run: dart run grinder deploy-sub-packages
env:
PUB_CREDENTIALS: "${{ secrets.PUB_CREDENTIALS }}"
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot
deploy_homebrew:
name: "Deploy Homebrew"
runs-on: ubuntu-latest
needs: [bootstrap, bourbon, foundation, bulma]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- name: Deploy
run: dart run grinder pkg-homebrew-update
env:
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot
deploy_chocolatey:
name: "Deploy Chocolatey"
runs-on: windows-latest
needs: [bootstrap, bourbon, foundation, bulma]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- name: Deploy
run: dart run grinder pkg-chocolatey-deploy
env: {CHOCOLATEY_TOKEN: "${{ secrets.CHOCOLATEY_TOKEN }}"}
deploy_website:
name: "Deploy sass-lang.com"
runs-on: ubuntu-latest
needs: [bootstrap, bourbon, foundation, bulma]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v3
with:
repository: sass/sass-site
token: ${{ secrets.GH_TOKEN }}
- uses: EndBug/add-and-commit@v8
with:
author_name: Sass Bot
author_email: sass.bot.beep.boop@gmail.com
message: Cut a release for a new Dart Sass version
commit: --allow-empty
release_embedded_compiler:
name: "Release Embedded Compiler"
runs-on: ubuntu-latest
needs: [deploy_pub, deploy_sub_packages]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v3
with:
repository: sass/dart-sass-embedded
token: ${{ secrets.GH_TOKEN }}
- uses: dart-lang/setup-dart@v1
- uses: frenck/action-setup-yq@v1
with: {version: v4.30.5} # frenck/action-setup-yq#35
- name: Get version
id: version
run: |
echo "sass=${GITHUB_REF##*/}" | tee --append $GITHUB_OUTPUT
echo "sass_api=$(curl --fail --silent --show-error --location https://raw.githubusercontent.com/sass/dart-sass/${GITHUB_REF##*/}/pkg/sass_api/pubspec.yaml | yq .version)" | tee --append $GITHUB_OUTPUT
- name: Update version
run: |
sed -i 's/version: .*/version: ${{ steps.version.outputs.sass }}/' pubspec.yaml
dart pub remove sass_api
dart pub remove sass
dart pub add sass:${{ steps.version.outputs.sass }}
dart pub add sass_api:^${{ steps.version.outputs.sass_api }}
# Delete a dependency override on Sass if it exists, and delete the
# dependency_overrides field if it's now empty. The embedded compiler
# often uses dev dependencies to run against the latest Dart Sass, but
# once we release the latest version that's no longer necessary.
#
# TODO(dart-lang/pub#3700): Use pub for this instead to avoid removing
# blank lines. See also mikefarah/yq#515.
yq -i '
del(.dependency_overrides.sass) |
to_entries |
map(select(.key != "dependency_overrides" or (.value | length >0))) |
from_entries
' pubspec.yaml
# The embedded compiler has a checked-in pubspec.yaml, so upgrade to
# make sure we're releasing against the latest version of all deps.
dart pub upgrade
curl --fail --silent --show-error --location --output CHANGELOG.md https://raw.githubusercontent.com/sass/dart-sass/${{ steps.version.outputs.sass }}/CHANGELOG.md
- uses: EndBug/add-and-commit@v8
with:
author_name: Sass Bot
author_email: sass.bot.beep.boop@gmail.com
message: Update Dart Sass version and release
tag: ${{ steps.version.outputs.sass }}