Skip to content

Commit 6d6d5ee

Browse files
committed
Merge branch 'embedded-move' into embedded
2 parents 8dddcb7 + 3fc6a42 commit 6d6d5ee

39 files changed

+5739
-93
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Build Protobuf
2+
description: Check out and build the Dart Sass embedded protocol buffer.
3+
inputs:
4+
github-token: {required: true}
5+
runs:
6+
using: composite
7+
steps:
8+
- uses: bufbuild/[email protected]
9+
with: {github_token: "${{ inputs.github-token }}"}
10+
11+
- name: Check out embedded Sass protocol
12+
uses: sass/clone-linked-repo@v1
13+
with: {repo: sass/embedded-protocol, path: build/embedded-protocol}
14+
15+
- name: Generate Dart from protobuf
16+
run: dart run grinder protobuf
17+
env: {UPDATE_SASS_PROTOCOL: false}
18+
shell: bash

.github/workflows/ci.yml

Lines changed: 165 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,48 @@ on:
1616
pull_request:
1717

1818
jobs:
19+
format:
20+
name: Code formatting
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
- uses: dart-lang/setup-dart@v1
26+
- run: dart format --fix .
27+
- run: git diff --exit-code
28+
29+
static_analysis:
30+
name: Static analysis
31+
runs-on: ubuntu-latest
32+
33+
steps:
34+
- uses: actions/checkout@v3
35+
- uses: dart-lang/setup-dart@v1
36+
- run: dart pub get
37+
38+
- uses: ./.github/util/build-protobuf
39+
with: {github-token: "${{ github.token }}"}
40+
41+
- name: Analyze Dart
42+
run: dart analyze --fatal-warnings ./
43+
44+
dartdoc:
45+
name: Dartdoc
46+
runs-on: ubuntu-latest
47+
48+
steps:
49+
- uses: actions/checkout@v3
50+
- uses: dart-lang/setup-dart@v1
51+
- run: dart pub get
52+
- name: dartdoc sass
53+
run: dart run dartdoc --quiet --no-generate-docs
54+
--errors ambiguous-doc-reference,broken-link,deprecated
55+
--errors unknown-directive,unknown-macro,unresolved-doc-reference
56+
- name: dartdoc sass_api
57+
run: cd pkg/sass_api && dart run dartdoc --quiet --no-generate-docs
58+
--errors ambiguous-doc-reference,broken-link,deprecated
59+
--errors unknown-directive,unknown-macro,unresolved-doc-reference
60+
1961
sass_spec_language:
2062
name: "Language Tests | Dart ${{ matrix.dart_channel }} | ${{ matrix.async_label }}"
2163
runs-on: ubuntu-latest
@@ -43,6 +85,10 @@ jobs:
4385
with: {node-version: "${{ env.DEFAULT_NODE_VERSION }}"}
4486
- run: npm install
4587
working-directory: sass-spec
88+
89+
- uses: ./.github/util/build-protobuf
90+
with: {github-token: "${{ github.token }}"}
91+
4692
- name: Run specs
4793
run: npm run sass-spec -- --dart .. $extra_args
4894
working-directory: sass-spec
@@ -52,7 +98,7 @@ jobs:
5298
# They next need to be rotated April 2021. See
5399
# https://github.com/nodejs/Release.
54100
sass_spec_js:
55-
name: "JS API Tests | Dart ${{ matrix.dart_channel }} | Node ${{ matrix.node_version }} | ${{ matrix.os }}"
101+
name: "JS API Tests | Pure JS | Dart ${{ matrix.dart_channel }} | Node ${{ matrix.node_version }} | ${{ matrix.os }}"
56102
runs-on: "${{ matrix.os }}"
57103

58104
strategy:
@@ -82,6 +128,9 @@ jobs:
82128
with: {node-version: "${{ matrix.node_version }}"}
83129
- run: npm install
84130

131+
- uses: ./.github/util/build-protobuf
132+
with: {github-token: "${{ github.token }}"}
133+
85134
- name: Check out sass-spec
86135
uses: sass/clone-linked-repo@v1
87136
with: {repo: sass/sass-spec}
@@ -103,6 +152,72 @@ jobs:
103152
run: npm run js-api-spec -- --sassSassRepo ../language --sassPackage ../build/npm
104153
working-directory: sass-spec
105154

155+
# The versions should be kept up-to-date with the latest LTS Node releases.
156+
# They next need to be rotated October 2021. See
157+
# https://github.com/nodejs/Release.
158+
sass_spec_js_embedded:
159+
name: 'JS API Tests | Embedded | Node ${{ matrix.node_version }} | ${{ matrix.os }}'
160+
runs-on: ${{ matrix.os }}-latest
161+
162+
strategy:
163+
fail-fast: false
164+
matrix:
165+
os: [ubuntu, windows, macos]
166+
node_version: [18]
167+
include:
168+
# Include LTS versions on Ubuntu
169+
- os: ubuntu
170+
node_version: 16
171+
- os: ubuntu
172+
node_version: 14
173+
174+
steps:
175+
- uses: actions/checkout@v3
176+
- uses: dart-lang/setup-dart@v1
177+
with: {sdk: stable}
178+
- run: dart pub get
179+
180+
- uses: ./.github/util/build-protobuf
181+
with: {github-token: "${{ github.token }}"}
182+
183+
- name: Check out the embedded host
184+
uses: sass/clone-linked-repo@v1
185+
with: {repo: sass/embedded-host-node}
186+
187+
- name: Check out the JS API definition
188+
uses: sass/clone-linked-repo@v1
189+
with: {repo: sass/sass, path: language}
190+
191+
- name: Initialize embedded host
192+
run: |
193+
npm install
194+
npm run init -- --protocol-path=../build/embedded-protocol \
195+
--compiler-path=.. --api-path=../language
196+
npm run compile
197+
mv {`pwd`/,dist/}lib/src/vendor/dart-sass
198+
working-directory: embedded-host-node
199+
200+
- name: Check out sass-spec
201+
uses: sass/clone-linked-repo@v1
202+
with: {repo: sass/sass-spec}
203+
204+
- name: Install sass-spec dependencies
205+
run: npm install
206+
working-directory: sass-spec
207+
208+
- name: Version info
209+
run: |
210+
path=embedded-host-node/dist/lib/src/vendor/dart-sass/sass
211+
if [[ -f "$path.cmd" ]]; then "./$path.cmd" --version
212+
elif [[ -f "$path.bat" ]]; then "./$path.bat" --version
213+
elif [[ -f "$path.exe" ]]; then "./$path.exe" --version
214+
else "./$path" --version
215+
fi
216+
217+
- name: Run tests
218+
run: npm run js-api-spec -- --sassPackage ../embedded-host-node --sassSassRepo ../language
219+
working-directory: sass-spec
220+
106221
dart_tests:
107222
name: "Dart tests | Dart ${{ matrix.dart_channel }} | ${{ matrix.os }}"
108223
runs-on: "${{ matrix.os }}"
@@ -119,9 +234,13 @@ jobs:
119234
- uses: dart-lang/setup-dart@v1
120235
with: {sdk: "${{ matrix.dart_channel }}"}
121236
- run: dart pub get
237+
238+
- uses: ./.github/util/build-protobuf
239+
with: {github-token: "${{ github.token }}"}
240+
122241
- run: dart run grinder pkg-standalone-dev
123242
- name: Run tests
124-
run: dart run test -p vm -x node -r expanded
243+
run: dart run test -p vm -x node
125244

126245
# Unit tests that use Node.js, defined in test/.
127246
#
@@ -158,37 +277,13 @@ jobs:
158277
- uses: actions/setup-node@v3
159278
with: {node-version: "${{ matrix.node_version }}"}
160279
- run: npm install
161-
- run: dart run grinder before-test
162-
- name: Run tests
163-
run: dart run test -j 2 -t node -r expanded
164280

165-
static_analysis:
166-
name: Static analysis
167-
runs-on: ubuntu-latest
281+
- uses: ./.github/util/build-protobuf
282+
with: {github-token: "${{ github.token }}"}
168283

169-
steps:
170-
- uses: actions/checkout@v3
171-
- uses: dart-lang/setup-dart@v1
172-
- run: dart pub get
173-
- name: Analyze Dart
174-
run: dart analyze --fatal-warnings --fatal-infos .
175-
176-
dartdoc:
177-
name: Dartdoc
178-
runs-on: ubuntu-latest
179-
180-
steps:
181-
- uses: actions/checkout@v3
182-
- uses: dart-lang/setup-dart@v1
183-
- run: dart pub get
184-
- name: dartdoc sass
185-
run: dart run dartdoc --quiet --no-generate-docs
186-
--errors ambiguous-doc-reference,broken-link,deprecated
187-
--errors unknown-directive,unknown-macro,unresolved-doc-reference
188-
- name: dartdoc sass_api
189-
run: cd pkg/sass_api && dart run dartdoc --quiet --no-generate-docs
190-
--errors ambiguous-doc-reference,broken-link,deprecated
191-
--errors unknown-directive,unknown-macro,unresolved-doc-reference
284+
- run: dart run grinder before-test
285+
- name: Run tests
286+
run: dart run test -j 2 -t node
192287

193288
double_check:
194289
name: Double-check
@@ -200,6 +295,7 @@ jobs:
200295
- node_tests
201296
- static_analysis
202297
- dartdoc
298+
- format
203299
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
204300

205301
steps:
@@ -283,8 +379,11 @@ jobs:
283379

284380
steps:
285381
- uses: actions/checkout@v3
382+
- uses: bufbuild/[email protected]
383+
with: {github_token: "${{ github.token }}"}
286384
- uses: dart-lang/setup-dart@v1
287385
- run: dart pub get
386+
- run: dart run grinder protobuf
288387
- name: Deploy
289388
run: dart run grinder pkg-github-release pkg-github-linux-ia32 pkg-github-linux-x64
290389
env:
@@ -306,6 +405,11 @@ jobs:
306405

307406
steps:
308407
- uses: actions/checkout@v3
408+
- uses: bufbuild/[email protected]
409+
with: {github_token: "${{ github.token }}"}
410+
- uses: dart-lang/setup-dart@v1
411+
- run: dart pub get
412+
- run: dart run grinder protobuf
309413
- uses: docker/setup-qemu-action@v2
310414
- name: Deploy
311415
run: |
@@ -341,11 +445,14 @@ jobs:
341445

342446
steps:
343447
- uses: actions/checkout@v3
448+
- uses: bufbuild/[email protected]
449+
with: {github_token: "${{ github.token }}"}
344450
- uses: dart-lang/setup-dart@v1
345451
# Workaround for dart-lang/setup-dart#59
346452
with:
347453
architecture: ${{ matrix.architecture }}
348454
- run: dart pub get
455+
- run: dart run grinder protobuf
349456
- name: Deploy
350457
run: dart run grinder pkg-github-${{ matrix.platform }}
351458
env:
@@ -397,6 +504,7 @@ jobs:
397504
- uses: actions/checkout@v3
398505
- uses: dart-lang/setup-dart@v1
399506
- run: dart pub get
507+
- run: dart run grinder protobuf
400508
- uses: actions/setup-node@v3
401509
with: {node-version: "${{ env.DEFAULT_NODE_VERSION }}"}
402510
- name: Deploy
@@ -455,7 +563,6 @@ jobs:
455563
runs-on: ubuntu-latest
456564
needs: [bootstrap, bourbon, foundation, bulma]
457565
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
458-
459566
steps:
460567
- uses: actions/checkout@v3
461568
with:
@@ -469,58 +576,46 @@ jobs:
469576
message: Cut a release for a new Dart Sass version
470577
commit: --allow-empty
471578

472-
release_embedded_compiler:
473-
name: "Release Embedded Compiler"
579+
release_embedded_host:
580+
name: "Release Embedded Host"
474581
runs-on: ubuntu-latest
475-
needs: [deploy_pub, deploy_sub_packages]
476-
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
477-
582+
needs: [deploy_github_linux, deploy_github_linux_qemu, deploy_github]
583+
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass-embedded'"
478584
steps:
479585
- uses: actions/checkout@v3
480586
with:
481-
repository: sass/dart-sass-embedded
587+
repository: sass/embedded-host-node
482588
token: ${{ secrets.GH_TOKEN }}
483-
- uses: dart-lang/setup-dart@v1
484-
- uses: frenck/action-setup-yq@v1
485-
with: {version: v4.30.5} # frenck/action-setup-yq#35
486589

487590
- name: Get version
488591
id: version
489-
run: |
490-
echo "sass=${GITHUB_REF##*/}" | tee --append $GITHUB_OUTPUT
491-
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
592+
run: echo "::set-output name=version::${GITHUB_REF##*/}"
492593

493594
- name: Update version
494595
run: |
495-
sed -i 's/version: .*/version: ${{ steps.version.outputs.sass }}/' pubspec.yaml
496-
dart pub remove sass_api
497-
dart pub remove sass
498-
dart pub add sass:${{ steps.version.outputs.sass }}
499-
dart pub add sass_api:^${{ steps.version.outputs.sass_api }}
500-
501-
# Delete a dependency override on Sass if it exists, and delete the
502-
# dependency_overrides field if it's now empty. The embedded compiler
503-
# often uses dev dependencies to run against the latest Dart Sass, but
504-
# once we release the latest version that's no longer necessary.
505-
#
506-
# TODO(dart-lang/pub#3700): Use pub for this instead to avoid removing
507-
# blank lines. See also mikefarah/yq#515.
508-
yq -i '
509-
del(.dependency_overrides.sass) |
510-
to_entries |
511-
map(select(.key != "dependency_overrides" or (.value | length >0))) |
512-
from_entries
513-
' pubspec.yaml
514-
515-
# The embedded compiler has a checked-in pubspec.yaml, so upgrade to
516-
# make sure we're releasing against the latest version of all deps.
517-
dart pub upgrade
518-
519-
curl --fail --silent --show-error --location --output CHANGELOG.md https://raw.githubusercontent.com/sass/dart-sass/${{ steps.version.outputs.sass }}/CHANGELOG.md
596+
# Update binary package versions
597+
for dir in $(ls npm); do
598+
cat "npm/$dir/package.json" |
599+
jq --arg version ${{ steps.version.outputs.version }} '
600+
.version |= $version
601+
' > package.json.tmp &&
602+
mv package.json.tmp "npm/$dir/package.json"
603+
done
604+
605+
# Update main package version and dependencies on binary packages
606+
cat package.json |
607+
jq --arg version ${{ steps.version.outputs.version }} '
608+
.version |= $version |
609+
."compiler-version" |= $version |
610+
.optionalDependencies = (.optionalDependencies | .[] |= $version)
611+
' > package.json.tmp &&
612+
mv package.json.tmp package.json
613+
curl https://raw.githubusercontent.com/sass/dart-sass/${{ steps.version.outputs.version }}/CHANGELOG.md > CHANGELOG.md
614+
shell: bash
520615

521616
- uses: EndBug/add-and-commit@v8
522617
with:
523618
author_name: Sass Bot
524619
author_email: [email protected]
525620
message: Update Dart Sass version and release
526-
tag: ${{ steps.version.outputs.sass }}
621+
tag: ${{ steps.version.outputs.version }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ package-lock.json
1414
node_modules/
1515
/doc/api
1616
/pkg/*/doc/api
17+
18+
# Generated protocol buffer files.
19+
*.pb*.dart

0 commit comments

Comments
 (0)