Skip to content

Commit

Permalink
Backport GitHub Actions config from feature.color-4 (#1930)
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 authored Aug 21, 2023
1 parent 790ec46 commit 74e22a0
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 80 deletions.
34 changes: 34 additions & 0 deletions .github/util/dart-sass/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Dart Sass
description: Check out Dart Sass and build the embedded protocol buffer.
inputs:
github-token: {required: true}
dart-sdk: {required: false, default: stable}
architecture: {required: false}
runs:
using: composite
steps:
- uses: dart-lang/setup-dart@v1
with:
sdk: "${{ inputs.dart-sdk }}"
architecture: "${{ inputs.architecture }}"

- uses: bufbuild/[email protected]
with: {github_token: "${{ inputs.github-token }}"}

- uses: sass/clone-linked-repo@v1
with: {repo: sass/dart-sass, path: dart-sass}

- run: dart pub get
shell: bash
working-directory: dart-sass

- name: Check out the language repo
uses: sass/clone-linked-repo@v1
with: {repo: sass/sass, path: dart-sass/build/language}

- name: Generate Dart from protobuf
run: dart run grinder protobuf
env: {UPDATE_SASS_PROTOCOL: false}
working-directory: dart-sass
shell: bash

132 changes: 52 additions & 80 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,14 @@ jobs:
- uses: actions/setup-node@v3
with: {node-version: "${{ env.NODE_VERSION }}"}
- run: npm install
- uses: dart-lang/setup-dart@v1
with: {sdk: "${{ matrix.dart_channel }}"}
- uses: bufbuild/[email protected]
with: {github_token: "${{ github.token }}"}

- name: Install dart-sass
run: |
GITHUB_REF=${PR_REF:-$CURRENT_REF}
if [[ "$GITHUB_REF" == refs/heads/feature.* ]]; then branch="${GITHUB_REF:11}"; else branch=main; fi
git clone https://github.com/sass/dart-sass.git ../dart-sass --depth 1 --branch "$branch"
(
cd ../dart-sass
dart pub get
dart run grinder protobuf
)
env:
PR_REF: "${{ github.base_ref }}"
CURRENT_REF: "${{ github.ref }}"
- uses: ./.github/util/dart-sass
with:
github-token: ${{ github.token }}
dart-sdk: ${{ matrix.dart_channel }}

- name: Run specs
run: npm run sass-spec -- --dart ../dart-sass
run: npm run sass-spec -- --dart dart-sass

libsass:
name: "Language | LibSass"
Expand All @@ -94,7 +81,7 @@ jobs:
with: {node-version: "${{ env.NODE_VERSION }}"}
- run: npm install

- name: Install sassc
- name: Install SassC
run: |
export SASS_LIBSASS_PATH=$BUILD_DIR/../libsass
export SASS_SASSC_PATH=$BUILD_DIR/../sassc
Expand Down Expand Up @@ -134,30 +121,20 @@ jobs:
- uses: actions/setup-node@v3
with: {node-version: "${{ matrix.node_version }}"}
- run: npm install
- uses: dart-lang/setup-dart@v1
with: {sdk: stable}
- uses: bufbuild/[email protected]
with: {github_token: "${{ github.token }}"}

- name: Install Dart Sass
run: |
git clone https://github.com/sass/dart-sass.git ../dart-sass --depth 1
(
cd ../dart-sass
dart pub get
dart pub run grinder protobuf pkg-npm-dev
cd build/npm
npm install
)
- name: Check out Sass specification
uses: sass/clone-linked-repo@v1
- uses: ./.github/util/dart-sass
with:
repo: sass/sass
path: language
github-token: ${{ github.token }}

- name: Dart Sass | Build
run: dart run grinder pkg-npm-dev
working-directory: dart-sass

- name: Run specs
run: npm run js-api-spec -- --sassPackage ../dart-sass/build/npm --sassSassRepo language
run: |
npm run js-api-spec -- \
--sassPackage dart-sass/build/npm \
--sassSassRepo dart-sass/build/language
js_api_dart_sass_browser:
name: "JS API | Pure JS | Browser"
Expand All @@ -168,40 +145,30 @@ jobs:
- uses: actions/checkout@v3
- uses: browser-actions/setup-chrome@v1
- run: npm install
- uses: dart-lang/setup-dart@v1
with: {sdk: stable}
- uses: bufbuild/[email protected]
with: {github_token: "${{ github.token }}"}

- name: Install Dart Sass
run: |
git clone https://github.com/sass/dart-sass.git ../dart-sass --depth 1
(
cd ../dart-sass
dart pub get
dart pub run grinder protobuf pkg-npm-dev
cd build/npm
npm install
)
- name: Check out Sass specification
uses: sass/clone-linked-repo@v1
- uses: ./.github/util/dart-sass
with:
repo: sass/sass
path: language
github-token: ${{ github.token }}

- name: Dart Sass | Build
run: dart run grinder pkg-npm-dev
working-directory: dart-sass

- name: Run specs
run: npm run js-api-spec -- --sassPackage ../dart-sass/build/npm --sassSassRepo language --browser
env:
CHROME_EXECUTABLE: chrome
run: |
npm run js-api-spec -- \
--browser \
--sassPackage dart-sass/build/npm \
--sassSassRepo dart-sass/build/language
env: {CHROME_EXECUTABLE: chrome}

# 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.
js_api_sass_embedded:
name: "JS API | Embedded | Node ${{ matrix.node_version }} | ${{ matrix.os }}"
runs-on: "${{ matrix.os }}"
if: "github.event_name != 'pull_request' || !contains(github.event.pull_request.body, 'skip sass-embedded')"
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.body, 'skip sass-embedded')

strategy:
fail-fast: false
Expand All @@ -220,25 +187,30 @@ jobs:
- uses: actions/setup-node@v3
with: {node-version: "${{ matrix.node_version }}"}
- run: npm install
- uses: dart-lang/setup-dart@v1
with: {sdk: stable}

- name: Install sass-embedded
run: |
git clone https://github.com/sass/embedded-host-node.git \
../embedded-host-node --depth 1
(
cd ../embedded-host-node
npm install
npm run init
npm run compile
)
- name: Check out Sass specification
uses: sass/clone-linked-repo@v1
- uses: ./.github/util/dart-sass
with:
repo: sass/sass
path: language
github-token: ${{ github.token }}

- name: Node.js Embedded Host | Checkout
uses: sass/clone-linked-repo@v1
with: {repo: sass/embedded-host-node, path: embedded-host-node}

# Work around actions/checkout#197. We need this outside the main checkout
# because otherwise its `node_modules` conflict with sass-spec's.
- run: mv embedded-host-node ..

- name: Node.js Embedded Host | Install
run: |
npm install
npm run init -- \
--compiler-path=../sass-spec/dart-sass \
--language-path=../sass-spec/dart-sass/build/language
npm run compile
working-directory: ../embedded-host-node

- name: Run specs
run: npm run js-api-spec -- --sassPackage ../embedded-host-node --sassSassRepo language
run: |
npm run js-api-spec -- \
--sassPackage ../embedded-host-node \
--sassSassRepo dart-sass/build/language

0 comments on commit 74e22a0

Please sign in to comment.