From 13365c661ab3dbc8b596dbbcb1a73d38fa4b93b7 Mon Sep 17 00:00:00 2001 From: Colin Rotherham Date: Tue, 20 Feb 2024 16:40:35 +0000 Subject: [PATCH] Update Sass CLI tests to check for `$govuk-*` Sass variables --- .github/workflows/sass.yaml | 38 ++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/.github/workflows/sass.yaml b/.github/workflows/sass.yaml index 5151e5ba93..bfc5510f59 100644 --- a/.github/workflows/sass.yaml +++ b/.github/workflows/sass.yaml @@ -35,8 +35,12 @@ jobs: npm install -g sass@v1.0.0 sass --version + # Compile Sass and check for `$govuk-` in output - name: Run command - run: time sass packages/govuk-frontend/src/govuk/all.scss > /dev/null + run: | + mkdir -p .tmp + time sass packages/govuk-frontend/src/govuk/all.scss > .tmp/all.css + grep --invert-match --null-data --quiet "\$govuk-" .tmp/all.css dart-sass-latest: name: Dart Sass v1 (latest) @@ -62,9 +66,13 @@ jobs: # 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`. + # taken by the entire pipeline, as we are now piping input into `sass`, + # then check for `$govuk-` in output - name: Run command - run: time sh -c 'echo "@import "\""govuk/all"\"";" | sass --stdin --quiet-deps --load-path=packages/govuk-frontend/src > /dev/null' + run: | + mkdir -p .tmp + time sh -c 'echo "@import "\""govuk/all"\"";" | sass --stdin --quiet-deps --load-path=packages/govuk-frontend/src > .tmp/all.css' + grep --invert-match --null-data --quiet "\$govuk-" .tmp/all.css # Node Sass v3.4.0 = LibSass v3.3.0 lib-sass: @@ -86,8 +94,12 @@ jobs: npm install -g node-sass@v3.4.0 node-sass --version + # Compile Sass and check for `$govuk-` in output - name: Run command - run: time node-sass packages/govuk-frontend/src/govuk/all.scss > /dev/null + run: | + mkdir -p + time node-sass packages/govuk-frontend/src/govuk/all.scss > .tmp/all.css + grep --invert-match --null-data --quiet "\$govuk-" .tmp/all.css # Node Sass v8.x = LibSass v3 latest lib-sass-latest: @@ -109,8 +121,12 @@ jobs: npm install -g node-sass@v8 node-sass --version + # Compile Sass and check for `$govuk-` in output - name: Run command - run: time node-sass packages/govuk-frontend/src/govuk/all.scss > /dev/null + run: | + mkdir -p .tmp + time node-sass packages/govuk-frontend/src/govuk/all.scss > .tmp/all.css + grep --invert-match --null-data --quiet "\$govuk-" .tmp/all.css ruby-sass: name: Ruby Sass v3.4.0 (deprecated) @@ -130,8 +146,12 @@ jobs: gem install sass -v 3.4.0 sass --version + # Compile Sass and check for `$govuk-` in output - name: Run command - run: time sass packages/govuk-frontend/src/govuk/all.scss > /dev/null + run: | + mkdir -p .tmp + time sass packages/govuk-frontend/src/govuk/all.scss > .tmp/all.css + grep --invert-match --null-data --quiet "\$govuk-" .tmp/all.css ruby-sass-latest: name: Ruby Sass v3 (latest, deprecated) @@ -151,5 +171,9 @@ jobs: gem install sass -v '~> 3.0' sass --version + # Compile Sass and check for `$govuk-` in output - name: Run command - run: time sass packages/govuk-frontend/src/govuk/all.scss > /dev/null + run: | + mkdir -p .tmp + time sass packages/govuk-frontend/src/govuk/all.scss > .tmp/all.css + grep --invert-match --null-data --quiet "\$govuk-" .tmp/all.css