dart-sass/.github/workflows/ci.yml
Christophe Coevoet 2cc136022f
Use dart analyze instead of the old dartanalyzer (#70)
The old dartanalyzer does not take exclude rules into account properly
for linting rules if the excluded file is also imported from a
non-excluded file (which is the case for the files generated by
protobuf). The new tool does not suffer from this issue.
2022-02-09 13:09:30 -08:00

192 lines
6.0 KiB
YAML

name: CI
env:
protoc_version: '3.x'
on:
push:
branches: [main, feature.*]
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
uses: sass/clone-linked-repo@v1
with:
repo: sass/dart-sass
path: build/dart-sass
default-ref: null
- name: Add Dart Sass to pubspec
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}
- run: dart pub get
- run: dart pub run grinder protobuf
env: {UPDATE_SASS_PROTOCOL: false}
- run: dart pub run grinder pkg-standalone-dev
- name: Run tests
run: dart pub run test -r expanded
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
uses: sass/clone-linked-repo@v1
with:
repo: sass/dart-sass
path: build/dart-sass
default-ref: null
- name: Add Dart Sass to pubspec
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}
- run: dart pub get
- run: dart pub run grinder protobuf
env: {UPDATE_SASS_PROTOCOL: false}
- name: Analyze dart
run: dart analyze --fatal-warnings ./
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
deploy_github_linux:
name: "Deploy Github: Linux"
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
- run: dart pub get
- run: dart pub run grinder protobuf
- name: Deploy
run: dart pub run grinder pkg-github-release pkg-github-linux
env: {GH_BEARER_TOKEN: "${{ github.token }}"}
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-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 pub run grinder protobuf
- name: Deploy
run: dart pub run grinder pkg-github-macos
env: {GH_BEARER_TOKEN: "${{ github.token }}"}
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-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 pub run grinder protobuf
- name: Deploy
run: dart pub run grinder pkg-github-windows
env: {GH_BEARER_TOKEN: "${{ github.token }}"}
release_embedded_host:
name: "Release Embedded Host"
runs-on: ubuntu-latest
needs: [deploy_github_linux, deploy_github_macos, deploy_github_windows]
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 }}