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

330 lines
11 KiB
YAML
Raw Normal View History

2021-01-20 22:21:05 +01:00
name: CI
env:
protoc_version: '3.x'
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:
- uses: actions/checkout@v2
- uses: arduino/setup-protoc@v1
with: { version: "${{ env.protoc_version }}", repo-token: "${{ github.token }}" }
- uses: dart-lang/setup-dart@v1
with: {sdk: "${{ matrix.dart_channel }}"}
- 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
default-ref: null
- name: Check out Dart Sass from main HEAD when using -dev dependency
run: |
if [[ ! -d build/dart-sass ]] && grep --quiet -E '\bsass:\s*.*-dev["'"'"']?$' pubspec.yaml; then
git clone https://github.com/sass/dart-sass.git \
--depth 1 build/dart-sass
fi
shell: bash
- name: Override dart-sass dependency only if repo was cloned a priori
run: |
if [[ -d build/dart-sass ]]; then
(
echo "dependency_overrides:"
echo " sass: {path: build/dart-sass}"
echo " 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}
2021-01-20 22:21:05 +01:00
- run: dart pub get
- run: dart run grinder protobuf
env: {UPDATE_SASS_PROTOCOL: false}
- run: dart run grinder pkg-standalone-dev
2021-01-20 22:21:05 +01:00
- name: Run tests
run: dart run test -r expanded
2021-01-20 22:21:05 +01: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]
node_version: [16]
include:
# Include LTS versions on Ubuntu
- os: ubuntu
node_version: 14
- os: ubuntu
node_version: 12
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
with: {sdk: stable}
- uses: actions/setup-node@v2
with: {node-version: "${{ matrix.node_version }}"}
- uses: arduino/setup-protoc@v1
with:
version: ${{ env.PROTOC_VERSION }}
repo-token: '${{ github.token }}'
- name: Check out Dart Sass only if linked in the PR description
uses: sass/clone-linked-repo@v1
2022-07-02 01:34:20 +02:00
with:
repo: sass/dart-sass
path: build/dart-sass
default-ref: null
- name: Check out Dart Sass from main HEAD when using -dev dependency
run: |
if [[ ! -d build/dart-sass ]] && grep --quiet -E '\bsass:\s*.*-dev["'"'"']?$' pubspec.yaml; then
git clone https://github.com/sass/dart-sass.git \
--depth 1 build/dart-sass
fi
shell: bash
- name: Override dart-sass dependency only if repo was cloned a priori
run: |
if [[ -d build/dart-sass ]]; then
(
echo "dependency_overrides:"
echo " sass: {path: build/dart-sass}"
echo " 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: "Embedded host: npm install"
run: npm install
working-directory: embedded-host-node
- name: "Embedded host: npm run init"
run: |
npm run init -- --protocol-path=../build/embedded-protocol --compiler-path=.. --api-path=../language
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: Compile embedded host
run: |
npm run compile
2022-07-02 02:29:55 +02:00
mv {`pwd`/,dist/}lib/src/vendor/dart-sass-embedded
shell: bash
working-directory: embedded-host-node
- 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:
- uses: actions/checkout@v2
- uses: arduino/setup-protoc@v1
with: { version: "${{ env.protoc_version }}", repo-token: "${{ github.token }}" }
- uses: dart-lang/setup-dart@v1
- 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
default-ref: null
- name: Check out Dart Sass from main HEAD when using -dev dependency
run: |
if [[ ! -d build/dart-sass ]] && grep --quiet -E '\bsass:\s*.*-dev["'"'"']?$' pubspec.yaml; then
git clone https://github.com/sass/dart-sass.git \
--depth 1 build/dart-sass
fi
shell: bash
- name: Override dart-sass dependency only if repo was cloned a priori
run: |
if [[ -d build/dart-sass ]]; then
(
echo "dependency_overrides:"
echo " sass: {path: build/dart-sass}"
echo " 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}
2021-01-20 22:21:05 +01:00
- run: dart pub get
- run: dart run grinder protobuf
env: {UPDATE_SASS_PROTOCOL: false}
2021-01-20 22:21:05 +01:00
- name: Analyze dart
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:
- uses: actions/checkout@v2
- 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:
name: "Deploy Github: linux-ia32, linux-x64"
2021-01-20 22:21:05 +01:00
runs-on: ubuntu-latest
needs: [dart_tests, static_analysis]
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/dart-sass-embedded'"
steps:
- uses: actions/checkout@v2
- uses: arduino/setup-protoc@v1
with: { version: "${{ env.protoc_version }}", repo-token: "${{ github.token }}" }
- uses: dart-lang/setup-dart@v1
2021-01-20 22:21:05 +01:00
- run: dart pub get
- run: dart run grinder protobuf
2021-01-20 22:21:05 +01:00
- name: Deploy
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:
name: "Deploy Github: linux-${{ matrix.arch }}"
runs-on: ubuntu-latest
strategy:
matrix:
include:
# https://github.com/dart-lang/sdk/pull/48665
# - 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-embedded'"
steps:
- uses: actions/checkout@v2
- uses: arduino/setup-protoc@v1
with: { version: "${{ env.protoc_version }}", repo-token: "${{ github.token }}" }
- uses: dart-lang/setup-dart@v1
- run: dart pub get
- run: dart run grinder protobuf
- uses: docker/setup-qemu-action@v1
- name: Deploy
run: |
docker run --rm \
--env "GH_BEARER_TOKEN=$GH_BEARER_TOKEN" \
--platform ${{ matrix.platform }} \
2022-06-01 02:56:42 +02:00
--mount type=bind,source="$PWD",target="$PWD" \
--mount type=tmpfs,destination=/root/.pub-cache \
--mount type=tmpfs,destination=/tmp \
--workdir "$PWD" \
docker.io/library/dart:latest \
2022-06-01 02:56:42 +02:00
/bin/sh -c "cp -R . /tmp/workspace && cd /tmp/workspace && dart pub get && dart run grinder pkg-github-linux-${{ matrix.arch }}"
env: {GH_BEARER_TOKEN: "${{ github.token }}"}
2021-01-20 22:21:05 +01:00
deploy_github:
name: "Deploy Github: ${{ matrix.platform }})"
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'"
strategy:
matrix:
include:
- runner: macos-latest
platform: macos-x64
- runner: self-hosted
platform: macos-arm64
- runner: windows-latest
platform: windows
2021-01-20 22:21:05 +01:00
steps:
- uses: actions/checkout@v2
- uses: arduino/setup-protoc@v1
with: { version: "${{ env.protoc_version }}", repo-token: "${{ github.token }}" }
- uses: dart-lang/setup-dart@v1
2021-01-20 22:21:05 +01:00
- run: dart pub get
- run: dart run grinder protobuf
2021-01-20 22:21:05 +01:00
- name: Deploy
run: dart run grinder pkg-github-${{ matrix.platform }}
env: {GH_BEARER_TOKEN: "${{ github.token }}"}
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@v2
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: |
cat package.json |
jq --arg version ${{ steps.version.outputs.version }} '
.version |= $version |
."compiler-version" |= $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 compiler version and release
tag: ${{ steps.version.outputs.version }}