dart-sass/.github/workflows/ci.yml

646 lines
19 KiB
YAML
Raw Normal View History

2021-01-06 13:41:24 +01:00
name: CI
defaults:
run: {shell: bash}
# The default Node version lives in ../util/initialize/action.yml. It should be
# kept up-to-date with the latest Node LTS releases, along with the various
# node-version matrices below.
#
# Next update: April 2021
2021-01-08 23:36:24 +01:00
2021-01-06 13:41:24 +01:00
on:
push:
branches: [main, feature.*]
tags: ['[0-9]+.[0-9]+.*']
2021-01-06 13:41:24 +01:00
pull_request:
jobs:
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
static_analysis:
name: Static analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}
- name: Analyze Dart
run: dart analyze --fatal-warnings ./
dartdoc:
name: Dartdoc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}
- 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
sass_spec_language:
name: "Language Tests | Dart ${{ matrix.dart_channel }} | ${{ matrix.async_label }}"
2021-01-08 23:36:24 +01:00
runs-on: ubuntu-latest
2021-01-06 13:41:24 +01:00
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:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
- uses: ./.github/util/initialize
with:
dart-sdk: ${{ matrix.dart_channel }}
github-token: ${{ github.token }}
- uses: ./.github/util/sass-spec
2021-01-06 13:41:24 +01:00
- name: Run specs
run: npm run sass-spec -- --dart .. $extra_args
2021-01-06 13:41:24 +01:00
working-directory: sass-spec
2021-01-08 23:36:24 +01:00
env: {extra_args: "${{ matrix.async_args }}"}
2021-01-06 13:41:24 +01:00
# 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 | Pure JS | 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:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
- uses: ./.github/util/initialize
with:
dart-sdk: ${{ matrix.dart_channel }}
github-token: ${{ github.token }}
node-version: ${{ matrix.node-version }}
- uses: ./.github/util/sass-spec
2021-10-21 22:40:20 +02:00
- 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
2021-10-21 22:40:20 +02:00
run: npm run js-api-spec -- --sassSassRepo ../language --sassPackage ../build/npm
working-directory: sass-spec
# 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_js_embedded:
name: 'JS API Tests | Embedded | 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: ./.github/util/initialize
with:
github-token: ${{ github.token }}
node-version: ${{ matrix.node-version }}
- uses: ./.github/util/sass-spec
- name: Check out the embedded host
uses: sass/clone-linked-repo@v1
with: {repo: sass/embedded-host-node}
- name: Check out the language repo
uses: sass/clone-linked-repo@v1
with: {repo: sass/sass, path: build/language}
- name: Initialize embedded host
run: |
npm install
npm run init -- --compiler-path=.. --language-path=../build/language
npm run compile
mv {`pwd`/,dist/}lib/src/vendor/dart-sass
working-directory: embedded-host-node
- name: Version info
run: |
path=embedded-host-node/dist/lib/src/vendor/dart-sass/sass
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 ../build/language
working-directory: sass-spec
sass_spec_js_browser:
name: "JS API Tests | Browser | Dart ${{ matrix.dart_channel }}"
strategy:
matrix:
dart_channel: [stable]
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: browser-actions/setup-chrome@v1
- uses: ./.github/util/initialize
with:
dart-sdk: ${{ matrix.dart_channel }}
github-token: ${{ github.token }}
- uses: ./.github/util/sass-spec
- name: Build JS
run: dart run grinder pkg-npm-dev
- name: Install built dependencies
run: npm install
working-directory: build/npm
- 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 --browser
working-directory: sass-spec
env:
CHROME_EXECUTABLE: chrome
2021-01-06 13:41:24 +01:00
dart_tests:
name: "Dart tests | Dart ${{ matrix.dart_channel }} | ${{ matrix.os }}"
2021-01-08 23:36:24 +01:00
runs-on: "${{ matrix.os }}"
2021-01-06 13:41:24 +01:00
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
dart_channel: [stable]
2021-01-08 23:36:24 +01:00
include: [{os: ubuntu-latest, dart_channel: dev}]
2021-01-06 13:41:24 +01:00
steps:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
- uses: ./.github/util/initialize
with:
dart-sdk: ${{ matrix.dart_channel }}
github-token: ${{ github.token }}
- run: dart run grinder pkg-standalone-dev
2021-01-06 13:41:24 +01:00
- name: Run tests
run: dart run test -x node
2021-01-06 13:41:24 +01:00
# 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 }}"
2021-01-08 23:36:24 +01:00
runs-on: "${{ matrix.os }}"
2021-01-06 13:41:24 +01:00
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
dart_channel: [stable]
node-version: [18]
2021-01-06 13:41:24 +01:00
include:
# Include LTS versions on Ubuntu
- os: ubuntu-latest
dart_channel: stable
node-version: 16
2021-01-06 13:41:24 +01:00
- os: ubuntu-latest
dart_channel: stable
node-version: 14
- os: ubuntu-latest
dart_channel: dev
node-version: 18
2021-01-06 13:41:24 +01:00
steps:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
- uses: ./.github/util/initialize
with:
dart-sdk: ${{ matrix.dart_channel }}
github-token: ${{ github.token }}
node-version: ${{ matrix.node-version }}
2021-01-06 13:41:24 +01:00
- run: dart run grinder pkg-npm-dev
- name: Run tests
run: dart run test -t node -j 2
2023-06-08 02:50:00 +02:00
browser_tests:
name: "Browser Tests | Dart ${{ matrix.dart_channel }}"
strategy:
matrix:
dart_channel: [stable]
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: browser-actions/setup-chrome@v1
- uses: ./.github/util/initialize
with:
dart-sdk: ${{ matrix.dart_channel }}
github-token: ${{ github.token }}
- run: dart run grinder pkg-npm-dev
- name: Run tests
run: dart run test -p chrome -j 2
env:
CHROME_EXECUTABLE: chrome
double_check:
name: Double-check
runs-on: ubuntu-latest
needs:
- sass_spec_language
- sass_spec_js
2023-06-08 02:50:00 +02:00
- sass_spec_js_browser
- sass_spec_js_embedded
- dart_tests
- node_tests
2023-06-08 02:50:00 +02:00
- browser_tests
- static_analysis
- dartdoc
- format
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}
- 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:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}
- 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:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}
- 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:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}
- 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:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}
- 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
2021-01-06 13:41:24 +01:00
deploy_github_linux:
name: "Deploy Github: linux-ia32, linux-x64"
2021-01-06 13:41:24 +01:00
runs-on: ubuntu-latest
needs: [bootstrap, bourbon, foundation, bulma]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
2021-01-06 13:41:24 +01:00
steps:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}
2021-01-06 13:41:24 +01:00
- 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:
2022-08-31 01:46:39 +02:00
- 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:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}
2022-07-23 02:18:59 +02:00
- 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 }}"
2021-01-06 13:41:24 +01:00
env:
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot
2021-01-06 13:41:24 +01:00
deploy_github:
name: "Deploy Github: ${{ matrix.platform }}"
runs-on: ${{ matrix.runner }}
2021-01-06 13:41:24 +01:00
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
2021-01-06 13:41:24 +01:00
steps:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
- uses: ./.github/util/initialize
# Workaround for dart-lang/setup-dart#59
with:
github-token: ${{ github.token }}
architecture: ${{ matrix.architecture }}
2021-01-06 13:41:24 +01:00
- name: Deploy
run: dart run grinder pkg-github-${{ matrix.platform }}
2021-01-06 13:41:24 +01:00
env:
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot
2021-01-06 13:41:24 +01:00
deploy_npm:
2021-01-08 23:36:24 +01:00
name: Deploy npm
2021-01-06 13:41:24 +01:00
runs-on: ubuntu-latest
needs: [bootstrap, bourbon, foundation, bulma]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
2021-01-06 13:41:24 +01:00
steps:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}
2021-01-06 13:41:24 +01:00
- name: Deploy
run: dart run grinder pkg-npm-deploy
2021-01-06 13:41:24 +01:00
env:
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
deploy_bazel:
2021-01-08 23:36:24 +01:00
name: Deploy Bazel
2021-01-06 13:41:24 +01:00
runs-on: ubuntu-latest
needs: [deploy_npm]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
2021-01-06 13:41:24 +01:00
steps:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}
2021-01-06 13:41:24 +01:00
- name: Deploy
run: dart run grinder update-bazel
env:
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot
2021-01-06 13:41:24 +01:00
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'"
2021-01-06 13:41:24 +01:00
steps:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}
2021-01-06 13:41:24 +01:00
- name: Deploy
run: dart run grinder pkg-pub-deploy
2021-01-08 23:36:24 +01:00
env: {PUB_CREDENTIALS: "${{ secrets.PUB_CREDENTIALS }}"}
2021-01-06 13:41:24 +01:00
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:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}
- name: Deploy
run: dart run grinder deploy-sub-packages
env:
PUB_CREDENTIALS: "${{ secrets.PUB_CREDENTIALS }}"
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot
2021-01-06 13:41:24 +01:00
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'"
2021-01-06 13:41:24 +01:00
steps:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
2021-01-06 13:41:24 +01:00
- run: dart pub get
2021-01-06 13:41:24 +01:00
- name: Deploy
run: dart run grinder pkg-homebrew-update
2021-01-06 13:41:24 +01:00
env:
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot
2021-01-06 13:41:24 +01:00
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'"
2021-01-06 13:41:24 +01:00
steps:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
2023-06-08 02:15:18 +02:00
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}
2021-01-06 13:41:24 +01:00
- name: Deploy
run: dart run grinder pkg-chocolatey-deploy
2021-01-08 23:36:24 +01:00
env: {CHOCOLATEY_TOKEN: "${{ secrets.CHOCOLATEY_TOKEN }}"}
2021-01-06 13:41:24 +01:00
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'"
2021-01-06 13:41:24 +01:00
steps:
2022-07-23 02:18:59 +02:00
- 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:
2022-07-23 02:18:59 +02:00
- uses: actions/checkout@v3
with:
repository: sass/embedded-host-node
token: ${{ secrets.GH_TOKEN }}
- name: Get version
id: version
run: echo "version=${GITHUB_REF##*/}" | tee --append "$GITHUB_OUTPUT"
- 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 }}