Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Sass GitHub action to save built files #4929

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

romaricpascal
Copy link
Member

@romaricpascal romaricpascal commented Apr 8, 2024

This will allow inspecting the output should an older version of Sass fail.

Each job gets the output of the Sass compilation uploaded as artifact, which we can then download for investigation from the Summary page of our GitHub Sass workflow (accessible by clicking 'Details' next to any of the Sass checks and then 'Summary').

The artifact upload is set up as a final step for each job, so that checking there's no more Sass variables in the output runs first. It is set up with if: ${{ !cancelled() }} so that it runs even if an error happens beforehand (but respects the job having been cancelled, unlike always()).

@romaricpascal romaricpascal requested a review from a team as a code owner April 8, 2024 11:51
Copy link

github-actions bot commented Apr 8, 2024

📋 Stats

File sizes

File Size
dist/govuk-frontend-development.min.css 113.25 KiB
dist/govuk-frontend-development.min.js 42.21 KiB
packages/govuk-frontend/dist/govuk/all.bundle.js 87.21 KiB
packages/govuk-frontend/dist/govuk/all.bundle.mjs 81.95 KiB
packages/govuk-frontend/dist/govuk/all.mjs 4.17 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend-component.mjs 359 B
packages/govuk-frontend/dist/govuk/govuk-frontend.min.css 113.24 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend.min.js 42.2 KiB
packages/govuk-frontend/dist/govuk/i18n.mjs 5.55 KiB

Modules

File Size (bundled) Size (minified)
all.mjs 77.67 KiB 40.19 KiB
accordion.mjs 22.71 KiB 12.85 KiB
button.mjs 5.98 KiB 2.69 KiB
character-count.mjs 22.4 KiB 9.92 KiB
checkboxes.mjs 5.83 KiB 2.83 KiB
error-summary.mjs 7.89 KiB 3.46 KiB
exit-this-page.mjs 17.1 KiB 9.26 KiB
header.mjs 4.46 KiB 2.6 KiB
notification-banner.mjs 6.26 KiB 2.62 KiB
password-input.mjs 15.15 KiB 7.25 KiB
radios.mjs 4.83 KiB 2.38 KiB
skip-link.mjs 4.39 KiB 2.18 KiB
tabs.mjs 10.13 KiB 6.11 KiB

View stats and visualisations on the review app


Action run for 324724b

uses: actions/upload-artifact@v4.3.1
if: ${{ !cancelled() }}
with:
name: Dart Sass v1.0.0 output
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick Would have wanted to re-use the name of the job by looking in one of the contexts provided to the step... but couldn't find anything. If anyone knows how, would be keen to update.

Don't think that's a blocker, though, more of a nice-to-have-if-we-know-how.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uploading the artefact is also very repetitive – we briefly explored running these using a matrix in #3030 but at the time it felt like it made the code too complicated. Wondering if that's worth revisiting.

Equally with us dropping support for Ruby Sass and LibSass 'soon' maybe it's not worth spending any more time on this? 😕

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, thought there was a fair amount of repetitions and remembered Colin's attempt at having a matrix. Still not convinced we need to DRY things up with a matrix there given it's not that costly to add something 6 times and we don't touch those that often. Especially with the change of Sass compiler support at some point in the future.

If for whatever reason we start bulking these workflows with more shared steps, we could revisit then.

@@ -45,6 +45,14 @@ jobs:
run: |
! grep "\$govuk-" .tmp/all.css

- name: Save compiled Sass
uses: actions/upload-artifact@v4.3.1
if: ${{ !cancelled() }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick Thinking we could add a continue-on-error to avoid that step failing the job if the upload has an issue. This continue-on-error would have to be conditionned to the previous step being a success, though. Otherwise, I think it'd make test failures not fail the job.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to guard against the job being cancelled?

Copy link
Member Author

@romaricpascal romaricpascal Apr 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following GitHub's recommendations to prefer !cancelled() to always() to ensure a step runs regardless of the previous steps. Made sense to me as if the job was cancelled, we don't care about uploading artifacts anyways. Happy to drop a comment on the first one to remind of GitHub's recommendations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants