Migrate CI to github actions (#28)

This commit is contained in:
Christophe Coevoet 2021-01-20 22:21:05 +01:00 committed by GitHub
parent 8128431b18
commit d18aa4dbbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 106 additions and 107 deletions

105
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,105 @@
name: CI
env:
protoc_version: '3.x'
on:
push:
branches: [master, 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: cedx/setup-dart@v2
with: {release-channel: "${{ matrix.dart_channel }}"}
- run: dart pub get
- run: dart pub run grinder protobuf
- 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: cedx/setup-dart@v2
- run: dart pub get
- run: dart pub run grinder protobuf
- name: Analyze dart
run: dartanalyzer --fatal-warnings ./
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: cedx/setup-dart@v2
- 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_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-embedded'"
steps:
- uses: actions/checkout@v2
- uses: arduino/setup-protoc@v1
with: { version: "${{ env.protoc_version }}", repo-token: "${{ github.token }}" }
- uses: cedx/setup-dart@v2
- run: dart pub get
- run: dart pub run grinder protobuf
- 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-embedded'"
steps:
- uses: actions/checkout@v2
- uses: arduino/setup-protoc@v1
with: { version: "${{ env.protoc_version }}", repo-token: "${{ github.token }}" }
- uses: cedx/setup-dart@v2
- run: dart pub get
- run: dart pub run grinder protobuf
- name: Deploy
run: dart pub run grinder pkg-github-windows
env:
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot

View File

@ -1,106 +0,0 @@
language: dart
branches:
only:
- master
# Semantic version tags and legacy branches of the form "1.2.x".
- "/^\\d+\\.\\d+\\.(\\d+([+-].*)?|x)$/"
dart: stable
cache:
directories:
- $HOME/.pub-cache
env:
global:
- PROTOBUF_VERSION=3.10.1
- PATH="$HOME/protoc/bin:$PATH"
before_install:
- if [[ "$TRAVIS_OS_NAME" = windows ]]; then
curl -Lo protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-win64.zip;
else
curl -Lo protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-${TRAVIS_OS_NAME}-x86_64.zip;
fi
- unzip -d "$HOME/protoc" protoc.zip
before_script:
- pub run grinder protobuf
# Format the generated code or else the formatter task will get upset.
# TODO(awjin): Re-enable this once dart-lang/sdk#42989 is fixed.
# - dartfmt -w --fix lib/src/embedded_sass.pb*
- pub run grinder pkg-standalone-dev
jobs:
include:
## Testing
- dart_task: test
- dart: dev
dart_task: test
- os: windows
dart_task: test
- os: osx
dart_task: test
# Static checks
- dart_task: {dartanalyzer: --fatal-warnings ./}
# TODO(awjin): Re-enable this once dart-lang/sdk#42989 is fixed.
# - dart_task: dartfmt
## Deploying
# Deploy Linux releases to GitHub. Mac OS and Windows releases are deployed in
# a later stage so that we can build native snapshots on bots with the same
# operating system.
- stage: deploy 1
name: "GitHub: Linux"
if: &deploy-if
(type IN (push, api)) AND (repo = sass/dart-sass-embedded) AND tag =~ ^\d+\.\d+\.\d+([+-].*)?$
env: &github-env
- GITHUB_USER=sassbot
# GITHUB_TOKEN="..."
- secure: "Z77zxJXwfCdwD1E/jsUi7U/G3O9fak/7C9VESoNyHYm0QBRXA/Soy4+Iydg8nGz/NZSbWrx1MA4OlAfndqSzrKqosjezZguOEWrLLN6y1ac4Ba0yfp1askxXMAs6qjQTW6j+/TsFH8b9N9eQAvHDu6cVnRjHHvEJ8elQtsUmWw80/+kaLZ7xgLqOGKnaADQice0T6Z/GtjQGQMD4SEN1im6AH21LE4ebk66SOuuy1eQ/gwRoESOZSXO2p3CP+5nQcqmZG1h9ygK9VQiderMLtI39OLq6VWIe49Bq5NECxblVlvU2ABcBxHSSYr9snCgxQtuZSs3BFIqNE+/mJV/udwcD1ITgF6Y2p6uCY9YH/Rfqz5ajJWRByVJ7aj2dJI01l9w0z7OrLNSHVLFQfunJ6I0TjI/vMyEptvEgbtcGJHloKLHBlMKqKB4JhT3o/eitirULII6h2wI1uyFZkiSSoH/y2CGm03HzOimAZFOOesE2dY8fusTbi8/8OgFYFYg0Kn9Ru2e3BKfDZiOd+kptGlgWhqJvMuNpQiB4QI2AT9BoL0hU1FGAYatiGRHPoD+U0rdq3ypY92uxE8CSmaxXMlgBHErmqu4UD+bFpCJ9PMVUkdy9DMy/8HhxaDDp22mE+gcI8L2ynk7sWCEKOKaL/uguPMFOlWZtvL0rLV8kp0g="
script: skip # Don't run tests
deploy:
provider: script
script: pub run grinder pkg-github-release pkg-github-linux
skip_cleanup: true # Don't clean up the Dart SDK.
# This causes the deploy to only be build when a tag is pushed. This
# is because the `tag` attribute in `if:` statements has a different
# understanding of the "current tag" than this, which uses the
# `TRAVIS_TAG` environment variable. `if:` statements check whether a
# tag exists that refers to the current commit, whereas `TRAVIS_TAG`
# checks whether the current build was caused by a tag.
#
# We check `if:` because it avoids unnecessary build steps, and
# `on: {tags: true}` ensures that we only deploy on the build caused
# by pushing a tag, not the build caused by pushing master.
on: {tags: true}
# Deploy to Bazel. This is in a separate deploy stage because it needs to
# install the npm package.
- stage: deploy 2
name: "GitHub: Mac OS"
if: *deploy-if
env: *github-env
script: skip
os: osx
deploy:
provider: script
script: pub run grinder pkg-github-macos
skip_cleanup: true
on: {tags: true}
- name: "GitHub: Windows"
if: *deploy-if
env: *github-env
script: skip
os: windows
deploy:
provider: script
script: pub run grinder pkg-github-windows
skip_cleanup: true
on: {tags: true}

View File

@ -259,7 +259,7 @@ void main() {
var failure = getCompileFailure(await process.outbound.next);
expect(failure.message, startsWith("Cannot open file: "));
expect(failure.message.split(":").last.trim(),
expect(failure.message.replaceFirst("Cannot open file: ", "").trim(),
equalsPath(d.path('test.scss')));
expect(failure.span, equals(SourceSpan()));
expect(failure.stackTrace, isEmpty);