2021-01-20 22:21:05 +01:00
|
|
|
name: CI
|
|
|
|
|
2022-12-20 00:36:23 +01:00
|
|
|
defaults:
|
|
|
|
run: {shell: bash}
|
|
|
|
|
2021-01-20 22:21:05 +01:00
|
|
|
on:
|
|
|
|
push:
|
2021-06-30 01:14:01 +02:00
|
|
|
branches: [main, feature.*]
|
2021-01-20 22:21:05 +01:00
|
|
|
tags: ['**']
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
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:
|
2022-08-03 03:18:12 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-12-20 00:36:23 +01:00
|
|
|
- uses: frenck/action-setup-yq@v1
|
|
|
|
with: {version: v4.30.5} # frenck/action-setup-yq#35
|
2023-02-09 02:30:05 +01:00
|
|
|
- uses: bufbuild/buf-setup-action@v1.13.1
|
|
|
|
with: {github_token: "${{ github.token }}"}
|
2021-03-03 19:25:28 +01:00
|
|
|
- uses: dart-lang/setup-dart@v1
|
|
|
|
with: {sdk: "${{ matrix.dart_channel }}"}
|
2022-01-25 03:29:11 +01:00
|
|
|
|
2022-07-12 08:10:48 +02:00
|
|
|
- name: Check out Dart Sass only if linked in the PR description
|
2022-01-25 03:29:11 +01:00
|
|
|
uses: sass/clone-linked-repo@v1
|
|
|
|
with:
|
|
|
|
repo: sass/dart-sass
|
|
|
|
path: build/dart-sass
|
|
|
|
default-ref: null
|
|
|
|
|
2022-12-20 00:36:23 +01:00
|
|
|
- name: Link the embedded compiler to Dart Sass
|
2022-02-01 01:12:20 +01:00
|
|
|
run: |
|
2022-01-25 03:29:11 +01:00
|
|
|
if [[ -d build/dart-sass ]]; then
|
2022-12-20 00:36:23 +01:00
|
|
|
yq -i '
|
|
|
|
.dependency_overrides.sass = {"path": "build/dart-sass"} |
|
|
|
|
.dependency_overrides.sass_api = {"path": "build/dart-sass/pkg/sass_api"}
|
|
|
|
' pubspec.yaml
|
2022-01-25 03:29:11 +01:00
|
|
|
fi
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Check out embedded Sass protocol
|
|
|
|
uses: sass/clone-linked-repo@v1
|
|
|
|
with: {repo: sass/embedded-protocol, path: build/embedded-protocol}
|
|
|
|
|
2021-01-20 22:21:05 +01:00
|
|
|
- run: dart pub get
|
2022-03-29 00:04:05 +02:00
|
|
|
- run: dart run grinder protobuf
|
2022-01-25 03:29:11 +01:00
|
|
|
env: {UPDATE_SASS_PROTOCOL: false}
|
2022-03-29 00:04:05 +02:00
|
|
|
- run: dart run grinder pkg-standalone-dev
|
2021-01-20 22:21:05 +01:00
|
|
|
- name: Run tests
|
2022-03-29 00:04:05 +02:00
|
|
|
run: dart run test -r expanded
|
2021-01-20 22:21:05 +01:00
|
|
|
|
2022-04-09 01:08:26 +02:00
|
|
|
# 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]
|
2023-01-25 01:04:39 +01:00
|
|
|
node_version: [18]
|
2022-04-09 01:08:26 +02:00
|
|
|
include:
|
|
|
|
# Include LTS versions on Ubuntu
|
|
|
|
- os: ubuntu
|
2023-01-25 01:04:39 +01:00
|
|
|
node_version: 16
|
2022-04-09 01:08:26 +02:00
|
|
|
- os: ubuntu
|
2023-01-25 01:04:39 +01:00
|
|
|
node_version: 14
|
2022-04-09 01:08:26 +02:00
|
|
|
|
|
|
|
steps:
|
2022-08-03 03:18:12 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-04-09 01:08:26 +02:00
|
|
|
- uses: dart-lang/setup-dart@v1
|
|
|
|
with: {sdk: stable}
|
2022-12-20 00:36:23 +01:00
|
|
|
- uses: frenck/action-setup-yq@v1
|
|
|
|
with: {version: v4.30.5} # frenck/action-setup-yq#35
|
2023-02-09 02:30:05 +01:00
|
|
|
- uses: bufbuild/buf-setup-action@v1.13.1
|
|
|
|
with: {github_token: "${{ github.token }}"}
|
2022-04-09 01:08:26 +02:00
|
|
|
|
2022-07-12 08:10:48 +02:00
|
|
|
- name: Check out Dart Sass only if linked in the PR description
|
2022-04-09 01:08:26 +02:00
|
|
|
uses: sass/clone-linked-repo@v1
|
2022-07-02 01:34:20 +02:00
|
|
|
with:
|
|
|
|
repo: sass/dart-sass
|
|
|
|
path: build/dart-sass
|
2022-12-20 00:38:07 +01:00
|
|
|
# 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 }}
|
2022-04-09 01:08:26 +02:00
|
|
|
|
2022-12-20 00:36:23 +01:00
|
|
|
- name: Link the embedded compiler to Dart Sass
|
2022-04-09 01:08:26 +02:00
|
|
|
run: |
|
|
|
|
if [[ -d build/dart-sass ]]; then
|
2022-12-20 00:36:23 +01:00
|
|
|
yq -i '
|
|
|
|
.dependency_overrides.sass = {"path": "build/dart-sass"} |
|
|
|
|
.dependency_overrides.sass_api = {"path": "build/dart-sass/pkg/sass_api"}
|
|
|
|
' pubspec.yaml
|
2022-04-09 01:08:26 +02:00
|
|
|
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}
|
|
|
|
|
2022-12-20 00:36:23 +01:00
|
|
|
- name: Initialize embedded host
|
2022-04-09 01:08:26 +02:00
|
|
|
run: |
|
2022-12-20 00:36:23 +01:00
|
|
|
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
|
2022-04-09 01:08:26 +02:00
|
|
|
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
|
|
|
|
|
2022-12-20 00:36:23 +01:00
|
|
|
- name: Version info
|
2022-04-09 01:08:26 +02:00
|
|
|
run: |
|
2022-12-20 00:36:23 +01:00
|
|
|
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
|
2022-04-09 01:08:26 +02:00
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
run: npm run js-api-spec -- --sassPackage ../embedded-host-node --sassSassRepo ../language
|
|
|
|
working-directory: sass-spec
|
|
|
|
|
2021-01-20 22:21:05 +01:00
|
|
|
static_analysis:
|
|
|
|
name: Static analysis
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2022-08-03 03:18:12 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-12-20 00:36:23 +01:00
|
|
|
- uses: frenck/action-setup-yq@v1
|
|
|
|
with: {version: v4.30.5} # frenck/action-setup-yq#35
|
2023-02-09 02:30:05 +01:00
|
|
|
- uses: bufbuild/buf-setup-action@v1.13.1
|
|
|
|
with: {github_token: "${{ github.token }}"}
|
2021-03-03 19:25:28 +01:00
|
|
|
- uses: dart-lang/setup-dart@v1
|
2022-01-25 03:29:11 +01:00
|
|
|
|
2022-07-12 08:10:48 +02:00
|
|
|
- name: Check out Dart Sass only if linked in the PR description
|
2022-01-25 03:29:11 +01:00
|
|
|
uses: sass/clone-linked-repo@v1
|
|
|
|
with:
|
|
|
|
repo: sass/dart-sass
|
|
|
|
path: build/dart-sass
|
|
|
|
default-ref: null
|
|
|
|
|
2022-12-20 00:36:23 +01:00
|
|
|
- name: Link the embedded compiler to Dart Sass
|
2022-02-01 01:12:20 +01:00
|
|
|
run: |
|
2022-01-25 03:29:11 +01:00
|
|
|
if [[ -d build/dart-sass ]]; then
|
2022-12-20 00:36:23 +01:00
|
|
|
yq -i '
|
|
|
|
.dependency_overrides.sass = {"path": "build/dart-sass"} |
|
|
|
|
.dependency_overrides.sass_api = {"path": "build/dart-sass/pkg/sass_api"}
|
|
|
|
' pubspec.yaml
|
2022-01-25 03:29:11 +01:00
|
|
|
fi
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Check out embedded Sass protocol
|
|
|
|
uses: sass/clone-linked-repo@v1
|
|
|
|
with: {repo: sass/embedded-protocol, path: build/embedded-protocol}
|
|
|
|
|
2021-01-20 22:21:05 +01:00
|
|
|
- run: dart pub get
|
2022-03-29 00:04:05 +02:00
|
|
|
- run: dart run grinder protobuf
|
2022-01-25 03:29:11 +01:00
|
|
|
env: {UPDATE_SASS_PROTOCOL: false}
|
2021-01-20 22:21:05 +01:00
|
|
|
- name: Analyze dart
|
2022-02-09 22:09:30 +01:00
|
|
|
run: dart analyze --fatal-warnings ./
|
2021-01-20 22:21:05 +01:00
|
|
|
|
2021-06-14 21:44:31 +02:00
|
|
|
format:
|
|
|
|
name: Code formatting
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2022-08-03 03:18:12 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-06-14 21:44:31 +02:00
|
|
|
- uses: dart-lang/setup-dart@v1
|
|
|
|
- run: dart format --fix .
|
|
|
|
- run: git diff --exit-code
|
|
|
|
|
2021-01-20 22:21:05 +01:00
|
|
|
deploy_github_linux:
|
2022-07-23 00:32:23 +02:00
|
|
|
name: "Deploy Github: linux-ia32, linux-x64"
|
2021-01-20 22:21:05 +01:00
|
|
|
runs-on: ubuntu-latest
|
2022-07-23 01:05:02 +02:00
|
|
|
needs: [dart_tests, sass_spec, static_analysis, format]
|
2021-01-20 22:21:05 +01:00
|
|
|
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass-embedded'"
|
|
|
|
|
|
|
|
steps:
|
2022-08-03 03:18:12 +02:00
|
|
|
- uses: actions/checkout@v3
|
2023-02-09 02:30:05 +01:00
|
|
|
- uses: bufbuild/buf-setup-action@v1.13.1
|
|
|
|
with: {github_token: "${{ github.token }}"}
|
2021-03-03 19:25:28 +01:00
|
|
|
- uses: dart-lang/setup-dart@v1
|
2021-01-20 22:21:05 +01:00
|
|
|
- run: dart pub get
|
2022-03-29 00:04:05 +02:00
|
|
|
- run: dart run grinder protobuf
|
2021-01-20 22:21:05 +01:00
|
|
|
- name: Deploy
|
2022-03-29 00:04:05 +02:00
|
|
|
run: dart run grinder pkg-github-release pkg-github-linux-ia32 pkg-github-linux-x64
|
|
|
|
env: {GH_BEARER_TOKEN: "${{ github.token }}"}
|
|
|
|
|
|
|
|
deploy_github_linux_qemu:
|
2022-07-23 00:32:23 +02:00
|
|
|
name: "Deploy Github: linux-${{ matrix.arch }}"
|
2022-03-29 00:04:05 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
2022-08-31 01:46:34 +02:00
|
|
|
- arch: arm
|
|
|
|
platform: linux/arm/v7
|
2022-03-29 00:04:05 +02:00
|
|
|
- arch: arm64
|
|
|
|
platform: linux/arm64
|
|
|
|
needs: [deploy_github_linux]
|
|
|
|
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass-embedded'"
|
|
|
|
|
|
|
|
steps:
|
2022-08-03 03:18:12 +02:00
|
|
|
- uses: actions/checkout@v3
|
2023-02-09 02:30:05 +01:00
|
|
|
- uses: bufbuild/buf-setup-action@v1.13.1
|
|
|
|
with: {github_token: "${{ github.token }}"}
|
|
|
|
- run: dart pub get
|
|
|
|
- run: dart pub grinder protobuf
|
2022-08-03 03:18:12 +02:00
|
|
|
- uses: docker/setup-qemu-action@v2
|
2022-03-29 00:04:05 +02:00
|
|
|
- name: Deploy
|
|
|
|
run: |
|
|
|
|
docker run --rm \
|
|
|
|
--env "GH_BEARER_TOKEN=$GH_BEARER_TOKEN" \
|
|
|
|
--platform ${{ matrix.platform }} \
|
2022-07-23 01:26:55 +02:00
|
|
|
--volume "$PWD:$PWD" \
|
2022-03-29 00:04:05 +02:00
|
|
|
--workdir "$PWD" \
|
|
|
|
docker.io/library/dart:latest \
|
2022-07-23 01:26:55 +02:00
|
|
|
/bin/sh -c "dart pub get && dart run grinder pkg-github-linux-${{ matrix.arch }}"
|
2021-01-21 01:32:18 +01:00
|
|
|
env: {GH_BEARER_TOKEN: "${{ github.token }}"}
|
2021-01-20 22:21:05 +01:00
|
|
|
|
2022-07-23 00:32:23 +02:00
|
|
|
deploy_github:
|
2022-08-03 03:18:16 +02:00
|
|
|
name: "Deploy Github: ${{ matrix.platform }}"
|
2022-07-23 00:32:23 +02:00
|
|
|
runs-on: ${{ matrix.runner }}
|
2021-01-20 22:21:05 +01:00
|
|
|
needs: [deploy_github_linux]
|
|
|
|
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass-embedded'"
|
2022-07-23 00:32:23 +02:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- runner: macos-latest
|
|
|
|
platform: macos-x64
|
2022-08-04 01:30:03 +02:00
|
|
|
architecture: x64
|
2022-07-23 00:32:23 +02:00
|
|
|
- runner: self-hosted
|
|
|
|
platform: macos-arm64
|
2022-08-04 01:30:03 +02:00
|
|
|
architecture: arm64
|
2022-07-23 00:32:23 +02:00
|
|
|
- runner: windows-latest
|
|
|
|
platform: windows
|
2022-08-04 01:30:03 +02:00
|
|
|
architecture: x64
|
2021-01-20 22:21:05 +01:00
|
|
|
|
|
|
|
steps:
|
2022-08-03 03:18:12 +02:00
|
|
|
- uses: actions/checkout@v3
|
2023-02-09 02:30:05 +01:00
|
|
|
- uses: bufbuild/buf-setup-action@v1.13.1
|
|
|
|
with: {github_token: "${{ github.token }}"}
|
2021-03-03 19:25:28 +01:00
|
|
|
- uses: dart-lang/setup-dart@v1
|
2022-08-04 01:30:03 +02:00
|
|
|
# Workaround for dart-lang/setup-dart#59
|
|
|
|
with:
|
|
|
|
architecture: ${{ matrix.architecture }}
|
2021-01-20 22:21:05 +01:00
|
|
|
- run: dart pub get
|
2023-02-09 02:30:05 +01:00
|
|
|
- run: dart pub run grinder protobuf
|
2021-01-20 22:21:05 +01:00
|
|
|
- name: Deploy
|
2022-07-23 00:32:23 +02:00
|
|
|
run: dart run grinder pkg-github-${{ matrix.platform }}
|
2021-01-21 01:32:18 +01:00
|
|
|
env: {GH_BEARER_TOKEN: "${{ github.token }}"}
|
2022-01-27 02:13:10 +01:00
|
|
|
|
2022-12-08 21:21:48 +01:00
|
|
|
deploy_homebrew:
|
|
|
|
name: "Deploy Homebrew"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [dart_tests, sass_spec, static_analysis, format]
|
|
|
|
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass-embedded'"
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2022-01-27 02:13:10 +01:00
|
|
|
release_embedded_host:
|
|
|
|
name: "Release Embedded Host"
|
|
|
|
runs-on: ubuntu-latest
|
2022-07-23 00:32:23 +02:00
|
|
|
needs: [deploy_github_linux, deploy_github_linux_qemu, deploy_github]
|
2022-01-27 02:13:10 +01:00
|
|
|
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass-embedded'"
|
|
|
|
|
|
|
|
steps:
|
2022-08-03 03:18:12 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-01-27 02:13:10 +01:00
|
|
|
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
|
2022-02-01 01:12:20 +01:00
|
|
|
run: |
|
2022-08-29 22:32:55 +02:00
|
|
|
# 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 &&
|
2022-08-31 00:24:56 +02:00
|
|
|
mv package.json.tmp "npm/$dir/package.json"
|
2022-08-29 22:32:55 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
# Update main package version and dependencies on binary packages
|
2022-01-27 02:13:10 +01:00
|
|
|
cat package.json |
|
|
|
|
jq --arg version ${{ steps.version.outputs.version }} '
|
|
|
|
.version |= $version |
|
2022-08-20 00:30:17 +02:00
|
|
|
."compiler-version" |= $version |
|
|
|
|
.optionalDependencies = (.optionalDependencies | .[] |= $version)
|
2022-01-27 02:13:10 +01:00
|
|
|
' > package.json.tmp &&
|
|
|
|
mv package.json.tmp package.json
|
2022-02-01 22:46:38 +01:00
|
|
|
curl https://raw.githubusercontent.com/sass/dart-sass/${{ steps.version.outputs.version }}/CHANGELOG.md > CHANGELOG.md
|
2022-01-27 02:13:10 +01:00
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- uses: EndBug/add-and-commit@v8
|
|
|
|
with:
|
|
|
|
author_name: Sass Bot
|
|
|
|
author_email: sass.bot.beep.boop@gmail.com
|
|
|
|
message: Update compiler version and release
|
|
|
|
tag: ${{ steps.version.outputs.version }}
|