Skip to content

Commit

Permalink
Merge pull request #1929 from sass/merge-main
Browse files Browse the repository at this point in the history
Merge main into feature.color-4
  • Loading branch information
nex3 authored Aug 21, 2023
2 parents 70c8dc2 + 4f03460 commit 380093f
Show file tree
Hide file tree
Showing 209 changed files with 9,331 additions and 4,416 deletions.
34 changes: 34 additions & 0 deletions .github/util/dart-sass/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Dart Sass
description: Check out Dart Sass and build the embedded protocol buffer.
inputs:
github-token: {required: true}
dart-sdk: {required: false, default: stable}
architecture: {required: false}
runs:
using: composite
steps:
- uses: dart-lang/setup-dart@v1
with:
sdk: "${{ inputs.dart-sdk }}"
architecture: "${{ inputs.architecture }}"

- uses: bufbuild/[email protected]
with: {github_token: "${{ inputs.github-token }}"}

- uses: sass/clone-linked-repo@v1
with: {repo: sass/dart-sass, path: dart-sass}

- run: dart pub get
shell: bash
working-directory: dart-sass

- name: Check out the language repo
uses: sass/clone-linked-repo@v1
with: {repo: sass/sass, path: dart-sass/build/language}

- name: Generate Dart from protobuf
run: dart run grinder protobuf
env: {UPDATE_SASS_PROTOCOL: false}
working-directory: dart-sass
shell: bash

147 changes: 76 additions & 71 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defaults:
run: {shell: bash}

env:
PROTOC_VERSION: 3.x
# TODO(jathak): Update this to Node 18 once unit tests are fixed.
NODE_VERSION: 14

on:
Expand All @@ -17,8 +17,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with: {node-version: "${{ env.NODE_VERSION }}"}
- uses: dart-lang/setup-dart@v1
with: {sdk: stable}
Expand All @@ -30,8 +30,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with: {node-version: "${{ env.NODE_VERSION }}"}
- run: npm install
- run: npm run lint
Expand All @@ -41,8 +41,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with: {node-version: "${{ env.NODE_VERSION }}"}
- run: npm install
- run: npm run lint-spec
Expand All @@ -57,19 +57,15 @@ jobs:
dart_channel: [stable, dev]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with: {node-version: "${{ env.NODE_VERSION }}"}
- run: npm install
- uses: dart-lang/setup-dart@v1
with: {sdk: "${{ matrix.dart_channel }}"}

- name: Dart Sass | Checkout
uses: sass/clone-linked-repo@v1
with: {repo: sass/dart-sass, path: dart-sass}
- name: Dart Sass | dart pub get
run: dart pub get
working-directory: dart-sass
- uses: ./.github/util/dart-sass
with:
github-token: ${{ github.token }}
dart-sdk: ${{ matrix.dart_channel }}

- name: Run specs
run: npm run sass-spec -- --dart dart-sass
Expand All @@ -80,8 +76,8 @@ jobs:
if: "github.event_name != 'pull_request' || !contains(github.event.pull_request.body, 'skip libsass')"

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with: {node-version: "${{ env.NODE_VERSION }}"}
- run: npm install

Expand All @@ -104,108 +100,117 @@ jobs:
# They next need to be rotated October 2021. See
# https://github.com/nodejs/Release.
js_api_dart_sass:
name: "JS API | Dart Sass | Node ${{ matrix.node_version }} | ${{ matrix.os }}"
name: "JS API | Pure JS | Node ${{ matrix.node_version }} | ${{ matrix.os }}"
runs-on: "${{ matrix.os }}"
if: "github.event_name != 'pull_request' || !contains(github.event.pull_request.body, 'skip dart-sass')"

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node_version: [16]
node_version: [18]
# Only test LTS versions on Ubuntu
include:
- os: ubuntu-latest
node_version: 12
- os: ubuntu-latest
node_version: 14
- os: ubuntu-latest
node_version: 16

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with: {node-version: "${{ matrix.node_version }}"}
- run: npm install
- uses: dart-lang/setup-dart@v1
with: {sdk: stable}

- name: Dart Sass | Checkout
uses: sass/clone-linked-repo@v1
with: {repo: sass/dart-sass, path: dart-sass}
- name: Dart Sass | Install
run: |
dart pub get
dart pub run grinder pkg-npm-dev
cd build/npm
npm install
- uses: ./.github/util/dart-sass
with:
github-token: ${{ github.token }}

- name: Dart Sass | Build
run: dart run grinder pkg-npm-dev
working-directory: dart-sass

- name: Check out Sass specification
uses: sass/clone-linked-repo@v1
- name: Run specs
run: |
npm run js-api-spec -- \
--sassPackage dart-sass/build/npm \
--sassSassRepo dart-sass/build/language
js_api_dart_sass_browser:
name: "JS API | Pure JS | Browser"
runs-on: ubuntu-latest
if: "github.event_name != 'pull_request' || !contains(github.event.pull_request.body, 'skip dart-sass')"

steps:
- uses: actions/checkout@v3
- uses: browser-actions/setup-chrome@v1
- run: npm install

- uses: ./.github/util/dart-sass
with:
repo: sass/sass
path: language
github-token: ${{ github.token }}

- name: Dart Sass | Build
run: dart run grinder pkg-npm-dev
working-directory: dart-sass

- name: Run specs
run: npm run js-api-spec -- --sassPackage dart-sass/build/npm --sassSassRepo language
run: |
npm run js-api-spec -- \
--browser \
--sassPackage dart-sass/build/npm \
--sassSassRepo dart-sass/build/language
env: {CHROME_EXECUTABLE: chrome}

# The versions should be kept up-to-date with the latest LTS Node releases.
# They next need to be rotated October 2021. See
# https://github.com/nodejs/Release.
js_api_sass_embedded:
name: "JS API | sass-embedded | Node ${{ matrix.node_version }} | ${{ matrix.os }}"
name: "JS API | Embedded | Node ${{ matrix.node_version }} | ${{ matrix.os }}"
runs-on: "${{ matrix.os }}"
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.body, 'skip sass-embedded')

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node_version: [16]
node_version: [18]
# Only test LTS versions on Ubuntu
include:
- os: ubuntu-latest
node_version: 12
- os: ubuntu-latest
node_version: 14
- os: ubuntu-latest
node_version: 16

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with: {node-version: "${{ matrix.node_version }}"}
- run: npm install
- uses: dart-lang/setup-dart@v1
with: {sdk: stable}
- uses: arduino/setup-protoc@v1
with:
version: ${{ env.PROTOC_VERSION }}
repo-token: '${{ github.token }}'

# Clone linked versions of Dart Sass Embedded and the Embedded Protocol so
# that they match the current feature branch.
- name: Dart Sass Embedded | Checkout
uses: sass/clone-linked-repo@v1
with: {repo: sass/dart-sass-embedded, path: dart-sass-embedded}
- name: Embedded Protocol | Checkout
uses: sass/clone-linked-repo@v1
with: {repo: sass/embedded-protocol, path: embedded-protocol}
- uses: ./.github/util/dart-sass
with:
github-token: ${{ github.token }}

- name: Node.js Embedded Host | Checkout
uses: sass/clone-linked-repo@v1
with: {repo: sass/embedded-host-node, path: embedded-host-node}

# Work around actions/checkout#197. We need this outside the main checkout
# because otherwise its `node_modules` conflict with sass-spec's.
- run: mv embedded-host-node ..

- name: Node.js Embedded Host | Install
run: |
npm install
npm run init -- \
--compiler-path=../dart-sass-embedded \
--protocol-path=../embedded-protocol
--compiler-path=../sass-spec/dart-sass \
--language-path=../sass-spec/dart-sass/build/language
npm run compile
working-directory: embedded-host-node

- name: Check out Sass specification
uses: sass/clone-linked-repo@v1
with:
repo: sass/sass
path: language
working-directory: ../embedded-host-node

- name: Run specs
run: npm run js-api-spec -- --sassPackage embedded-host-node --sassSassRepo language
run: |
npm run js-api-spec -- \
--sassPackage ../embedded-host-node \
--sassSassRepo dart-sass/build/language
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,9 @@ arguments:

[Sass language specification repository]: https://github.com/sass/sass

The JS API specs are run using [Jest], so you can also pass any [Jest command
line arguments] to `npm run js-api-spec`.
The JS API specs are run using [Jasmine].

[Jest]: https://jestjs.io/
[Jest command line arguments]: https://jestjs.io/docs/cli
[Jasmine]: https://jasmine.github.io/

#### Dart Sass

Expand All @@ -354,12 +352,21 @@ git clone https://github.com/sass/dart-sass
)
export DART_SASS_PATH=`pwd`/dart-sass

npm run sass-spec -- --sassSass $SASS_SASS_PATH --sassPackage $DART_SASS_PATH/build/npm
npm run js-api-spec -- --sassSassRepo $SASS_SASS_PATH --sassPackage $DART_SASS_PATH/build/npm
```

Whenever you modify Dart Sass, make sure to re-run `dart run grinder
pkg-npm-dev` to rebuild the JavaScript output.

##### Browser Build

To run specs against [Dart Sass] compiled for a browser context, add the
`--browser` flag to the above command:

```sh
npm run js-api-spec -- --sassSassRepo $SASS_SASS_PATH --sassPackage $DART_SASS_PATH/build/npm --browser
```

#### Embedded Host

To run specs against [the Node Embedded Host], which embeds Dart Sass as a
Expand All @@ -385,7 +392,7 @@ git clone https://github.com/sass/embedded-host-node
)
export SASS_EMBEDDED_PATH=`pwd`/embedded-host-node

npm run sass-spec -- --sassSass $SASS_SASS_PATH --sassPackage $SASS_EMBEDDED_PATH
npm run js-api-spec -- --sassSassRepo $SASS_SASS_PATH --sassPackage $SASS_EMBEDDED_PATH
```

Whenever you modify the Sass embedded host, make sure to re-run `npm run
Expand Down
Loading

0 comments on commit 380093f

Please sign in to comment.