dart-sass/.github/workflows/ci.yml
Natalie Weizenbaum 8090b992de
Test against real-world Sass frameworks (#1487)
In a future commit, I'll update these jobs to only run just before
release, since they're expected to be substantially less likely to
fail and we don't want to waste cycles. For now, I have them runnning
always to verify that they run successfully at least once.
2021-09-17 23:17:41 +00:00

435 lines
13 KiB
YAML

name: CI
defaults:
run: {shell: bash}
env:
# Run on Node 14 because node-fibers doesn't support odd-numbered Node
# versions. Note: when changing this, also change
# jobs.node_tests.strategy.matrix.node_version and the Node version for Dart
# dev tests.
DEFAULT_NODE_VERSION: 14
on:
push:
branches: [main, feature.*]
tags: ['**']
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@v2
- uses: dart-lang/setup-dart@v1
with: {sdk: "${{ matrix.dart_channel }}"}
- run: dart pub get
- name: Set up sass-spec
run: tool/github-action/check-out-sass-spec.sh
env:
PR_BRANCH: "${{ github.base_ref }}"
CURRENT_REF: "${{ github.ref }}"
PR_BODY: "${{ github.event.pull_request.body }}"
- uses: actions/setup-node@v2
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: [14]
include:
# Include LTS versions on Ubuntu
- os: ubuntu-latest
dart_channel: stable
node_version: 12
- os: ubuntu-latest
dart_channel: stable
node_version: 10
- os: ubuntu-latest
dart_channel: dev
node_version: 14
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
with: {sdk: "${{ matrix.dart_channel }}"}
- run: dart pub get
- uses: actions/setup-node@v2
with: {node-version: "${{ matrix.node_version }}"}
- name: Check out sass-spec
run: tool/github-action/check-out-sass-spec.sh
env:
PR_BRANCH: "${{ github.base_ref }}"
CURRENT_REF: "${{ github.ref }}"
PR_BODY: "${{ github.event.pull_request.body }}"
- name: Build JS
run: dart pub run grinder pkg-npm-dev
- name: Link Dart Sass into sass-spec
run: npm install ../build/npm
working-directory: sass-spec
- name: Check out Sass specification
run: git clone https://github.com/sass/sass.git language --depth 1
- name: Run tests
run: npm run js-api-spec -- --sassSassRepo ../language
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@v2
- uses: dart-lang/setup-dart@v1
with: {sdk: "${{ matrix.dart_channel }}"}
- run: dart pub get
- run: dart pub run grinder pkg-standalone-dev
- name: Run tests
run: dart pub 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: [14]
include:
# Include LTS versions on Ubuntu
- os: ubuntu-latest
dart_channel: stable
node_version: 12
- os: ubuntu-latest
dart_channel: stable
node_version: 10
- os: ubuntu-latest
dart_channel: dev
node_version: 14
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
with: {sdk: "${{ matrix.dart_channel }}"}
- run: dart pub get
- uses: actions/setup-node@v2
with: {node-version: "${{ matrix.node_version }}"}
- run: npm install
- run: dart pub run grinder before-test
- name: Run tests
run: dart pub run test -j 2 -t node -r expanded
static_analysis:
name: Static analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- 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@v2
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- name: dartdoc sass
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 && dartdoc --quiet --no-generate-docs
--errors ambiguous-doc-reference,broken-link,deprecated
--errors unknown-directive,unknown-macro,unresolved-doc-reference
bootstrap:
name: "Bootstrap ${{ matrix.bootstrap_version }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
bootstrap_version: [4, 5]
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- run: dart pub 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
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- run: dart pub 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
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- run: dart pub 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
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- run: dart pub 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
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@v2
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- name: Run checks
run: dart pub run grinder sanity-check-before-release
deploy_github_linux:
name: "Deploy Github: Linux"
runs-on: ubuntu-latest
needs: [double_check]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- name: Deploy
run: dart pub run grinder pkg-github-release pkg-github-linux
env:
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot
deploy_github_macos:
name: "Deploy Github: Mac OS"
runs-on: macos-latest
needs: [deploy_github_linux]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- name: Deploy
run: dart pub run grinder pkg-github-macos
env:
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot
deploy_github_windows:
name: "Deploy Github: Windows"
runs-on: windows-latest
needs: [deploy_github_linux]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- name: Deploy
run: dart pub run grinder pkg-github-windows
env:
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot
deploy_npm:
name: Deploy npm
runs-on: ubuntu-latest
needs: [double_check]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- uses: actions/setup-node@v2
with: {node-version: "${{ env.DEFAULT_NODE_VERSION }}"}
- name: Deploy
run: dart pub 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@v2
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- uses: actions/setup-node@v2
with: {node-version: "${{ env.DEFAULT_NODE_VERSION }}"}
- name: Deploy
run: dart pub run grinder update-bazel
env:
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot
deploy_pub:
name: "Deploy Pub"
runs-on: ubuntu-latest
needs: [double_check]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- uses: actions/setup-node@v2
with: {node-version: "${{ env.DEFAULT_NODE_VERSION }}"}
- name: Deploy
run: dart pub 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@v2
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- name: Deploy
run: dart pub 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: [double_check]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- name: Deploy
run: dart pub run grinder pkg-homebrew-update
env:
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot
deploy_chocolatey:
name: "Deploy Chocolatey"
runs-on: windows-latest
needs: [double_check]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- name: Deploy
run: dart pub run grinder pkg-chocolatey-deploy
env: {CHOCOLATEY_TOKEN: "${{ secrets.CHOCOLATEY_TOKEN }}"}
deploy_website:
name: "Deploy sass-lang.com"
runs-on: ubuntu-latest
needs: [double_check]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass'"
steps:
- uses: actions/checkout@v2
- name: Deploy
run: tool/github-action/deploy/heroku.sh
env: {HEROKU_TOKEN: "${{ secrets.HEROKU_TOKEN }}"}