Merge the Dart Sass embedded compiler repo into the Dart Sass repo #1263
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: bufbuild/buf-setup-action@v1.13.1 | |
with: {github_token: "${{ github.token }}"} | |
- uses: dart-lang/setup-dart@v1 | |
with: {sdk: "${{ matrix.dart_channel }}"} | |
- name: Check out embedded Sass protocol | |
uses: sass/clone-linked-repo@v1 | |
with: {repo: sass/embedded-protocol, path: build/embedded-protocol} | |
- run: dart pub get | |
- run: dart run grinder protobuf | |
env: {UPDATE_SASS_PROTOCOL: false} | |
- run: dart run grinder pkg-standalone-dev | |
- name: Run tests | |
run: dart run test -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: | |
# 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 | |
# 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. | |
sass_spec: | |
name: 'JS API Tests | Node ${{ matrix.node_version }} | ${{ matrix.os }}' | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu, windows, macos] | |
node_version: [18] | |
include: | |
# Include LTS versions on Ubuntu | |
- os: ubuntu | |
node_version: 16 | |
- os: ubuntu | |
node_version: 14 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dart-lang/setup-dart@v1 | |
with: {sdk: stable} | |
- uses: frenck/action-setup-yq@v1 | |
with: {version: v4.30.5} # frenck/action-setup-yq#35 | |
- uses: bufbuild/buf-setup-action@v1.13.1 | |
with: {github_token: "${{ github.token }}"} | |
- name: Check out Dart Sass only if linked in the PR description | |
uses: sass/clone-linked-repo@v1 | |
with: | |
repo: sass/dart-sass | |
path: build/dart-sass | |
# Unless we're cutting a release, run the main branch of Dart Sass | |
# against the main branch of sass-spec so that we don't need to make | |
# an empty commit to this repo every time we update those two. | |
default-ref: ${{ !startsWith(github.ref, 'refs/tags/') && 'main' || null }} | |
- name: Link the embedded compiler to Dart Sass | |
run: | | |
if [[ -d build/dart-sass ]]; then | |
yq -i ' | |
.dependency_overrides.sass = {"path": "build/dart-sass"} | | |
.dependency_overrides.sass_api = {"path": "build/dart-sass/pkg/sass_api"} | |
' pubspec.yaml | |
fi | |
shell: bash | |
- name: Check out embedded Sass protocol | |
uses: sass/clone-linked-repo@v1 | |
with: {repo: sass/embedded-protocol, path: build/embedded-protocol} | |
- name: Check out the embedded host | |
uses: sass/clone-linked-repo@v1 | |
with: {repo: sass/embedded-host-node} | |
- name: Check out the JS API definition | |
uses: sass/clone-linked-repo@v1 | |
with: {repo: sass/sass, path: language} | |
- name: Initialize embedded host | |
run: | | |
npm install | |
npm run init -- --protocol-path=../build/embedded-protocol \ | |
--compiler-path=.. --api-path=../language | |
npm run compile | |
mv {`pwd`/,dist/}lib/src/vendor/dart-sass-embedded | |
working-directory: embedded-host-node | |
- 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: Version info | |
run: | | |
path=embedded-host-node/dist/lib/src/vendor/dart-sass-embedded/dart-sass-embedded | |
if [[ -f "$path.cmd" ]]; then "./$path.cmd" --version | |
elif [[ -f "$path.bat" ]]; then "./$path.bat" --version | |
elif [[ -f "$path.exe" ]]; then "./$path.exe" --version | |
else "./$path" --version | |
fi | |
- name: Run tests | |
run: npm run js-api-spec -- --sassPackage ../embedded-host-node --sassSassRepo ../language | |
working-directory: sass-spec | |
static_analysis: | |
name: Static analysis | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: bufbuild/buf-setup-action@v1.13.1 | |
with: {github_token: "${{ github.token }}"} | |
- uses: dart-lang/setup-dart@v1 | |
- name: Check out embedded Sass protocol | |
uses: sass/clone-linked-repo@v1 | |
with: {repo: sass/embedded-protocol, path: build/embedded-protocol} | |
- run: dart pub get | |
- run: dart run grinder protobuf | |
env: {UPDATE_SASS_PROTOCOL: false} | |
- name: Analyze Dart | |
run: dart analyze --fatal-warnings ./ | |
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 | |
- format | |
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 | |
format: | |
name: Code formatting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dart-lang/setup-dart@v1 | |
- run: dart format --fix . | |
- run: git diff --exit-code | |
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: bufbuild/buf-setup-action@v1.13.1 | |
with: {github_token: "${{ github.token }}"} | |
- uses: dart-lang/setup-dart@v1 | |
- run: dart pub get | |
- run: dart run grinder protobuf | |
- 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: bufbuild/buf-setup-action@v1.13.1 | |
with: {github_token: "${{ github.token }}"} | |
- uses: dart-lang/setup-dart@v1 | |
- run: dart pub get | |
- run: dart run grinder protobuf | |
- 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: bufbuild/buf-setup-action@v1.13.1 | |
with: {github_token: "${{ github.token }}"} | |
- uses: dart-lang/setup-dart@v1 | |
# Workaround for dart-lang/setup-dart#59 | |
with: | |
architecture: ${{ matrix.architecture }} | |
- run: dart pub get | |
- run: dart run grinder protobuf | |
- 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 | |
- run: dart run grinder protobuf | |
- 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_host: | |
name: "Release Embedded Host" | |
runs-on: ubuntu-latest | |
needs: [deploy_github_linux, deploy_github_linux_qemu, deploy_github] | |
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass-embedded'" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: sass/embedded-host-node | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Get version | |
id: version | |
run: echo "::set-output name=version::${GITHUB_REF##*/}" | |
- name: Update version | |
run: | | |
# Update binary package versions | |
for dir in $(ls npm); do | |
cat "npm/$dir/package.json" | | |
jq --arg version ${{ steps.version.outputs.version }} ' | |
.version |= $version | |
' > package.json.tmp && | |
mv package.json.tmp "npm/$dir/package.json" | |
done | |
# Update main package version and dependencies on binary packages | |
cat package.json | | |
jq --arg version ${{ steps.version.outputs.version }} ' | |
.version |= $version | | |
."compiler-version" |= $version | | |
.optionalDependencies = (.optionalDependencies | .[] |= $version) | |
' > package.json.tmp && | |
mv package.json.tmp package.json | |
curl https://raw.githubusercontent.com/sass/dart-sass/${{ steps.version.outputs.version }}/CHANGELOG.md > CHANGELOG.md | |
shell: bash | |
- 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.version }} |