Merge pull request #5522 from alphagov/upgrade-old-libsass-test #12704
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sass | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- 'feature/**' | |
- 'support/**' | |
workflow_dispatch: | |
concurrency: | |
group: sass-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
dart-sass: | |
name: Dart Sass v1.0.0 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
cache: npm | |
node-version: 8 # Node.js 8 supported by Dart Sass v1.0.0 | |
- name: Install package | |
run: | | |
npm install -g [email protected] | |
sass --version | |
- name: Run command | |
run: | | |
mkdir -p .tmp | |
time sass packages/govuk-frontend/src/govuk/all.scss > .tmp/all.css | |
# Check output for uncompiled Sass | |
- name: Check output | |
run: | | |
! grep "\$govuk-" .tmp/all.css | |
dart-sass-latest: | |
name: Dart Sass v1 (latest) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
cache: npm | |
node-version-file: .nvmrc # Node.js project version must support Dart Sass v1 | |
- name: Install package | |
run: | | |
npm install -g sass@v1 | |
sass --version | |
# Treat GOV.UK Frontend as a dependency by importing it via load paths, | |
# allowing us to mimic the way we recommend our users silence deprecation | |
# warnings using the `quiet-deps` flag. | |
# | |
# Run the command through a shell to ensure `time` measures the time | |
# taken by the entire pipeline, as we are now piping input into `sass`. | |
- name: Run command | |
run: | | |
mkdir -p .tmp | |
time sh -c 'echo "@import "\""govuk/all"\"";" | sass --stdin --quiet-deps --load-path=packages/govuk-frontend/src > .tmp/all.css' | |
# Check output for uncompiled Sass | |
- name: Check output | |
run: | | |
! grep "\$govuk-" .tmp/all.css | |
# Node Sass v5.0.0 = LibSass v3.5.5 | |
lib-sass: | |
name: LibSass v3.5.5 (deprecated) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
cache: npm | |
# Node.js 15 is required for the stable support of ES Module | |
# used when installing `node-sass` | |
node-version: 15 | |
- name: Install package | |
# Sass 5.0.0 is the first version that supports Python 3 | |
# and as such can be built on a GitHub Actions runner | |
run: | | |
npm install -g [email protected] | |
node-sass --version | |
- name: Run command | |
run: | | |
mkdir -p .tmp | |
time node-sass packages/govuk-frontend/src/govuk/all.scss > .tmp/all.css | |
# Check output for uncompiled Sass | |
- name: Check output | |
run: | | |
! grep "\$govuk-" .tmp/all.css | |
# Node Sass v8.x = LibSass v3 latest | |
lib-sass-latest: | |
name: LibSass v3 (latest, deprecated) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
cache: npm | |
node-version-file: .nvmrc # Node.js project version must support Node Sass v8.x | |
- name: Install package | |
run: | | |
npm install -g node-sass@v8 | |
node-sass --version | |
- name: Run command | |
run: | | |
mkdir -p .tmp | |
time node-sass packages/govuk-frontend/src/govuk/all.scss > .tmp/all.css | |
# Check output for uncompiled Sass | |
- name: Check output | |
run: | | |
! grep "\$govuk-" .tmp/all.css | |
ruby-sass: | |
name: Ruby Sass v3.4.0 (deprecated) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.3 # Oldest version supported by Bundler v2 | |
- name: Install gem | |
run: | | |
gem install sass -v 3.4.0 | |
sass --version | |
- name: Run command | |
run: | | |
mkdir -p .tmp | |
time sass packages/govuk-frontend/src/govuk/all.scss > .tmp/all.css | |
# Check output for uncompiled Sass | |
- name: Check output | |
run: | | |
! grep "\$govuk-" .tmp/all.css | |
ruby-sass-latest: | |
name: Ruby Sass v3 (latest, deprecated) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2 # Ruby 3.2 supported by Ruby Sass v3 | |
- name: Install gem | |
run: | | |
gem install sass -v '~> 3.0' | |
sass --version | |
- name: Run command | |
run: | | |
mkdir -p .tmp | |
time sass packages/govuk-frontend/src/govuk/all.scss > .tmp/all.css | |
# Check output for uncompiled Sass | |
- name: Check output | |
run: | | |
! grep "\$govuk-" .tmp/all.css |