Skip to content

chore: ci rework #2270

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

Merged
merged 1 commit into from
Nov 9, 2023
Merged

chore: ci rework #2270

merged 1 commit into from
Nov 9, 2023

Conversation

castastrophe
Copy link
Collaborator

@castastrophe castastrophe commented Nov 6, 2023

GitHub Actions, templates, and bots (oh my!)

The goal of this documentation is to provide an outline for the GitHub goodness that exists in this folder. This is a living document, so please feel free to contribute to it.

Architecture

⎪ actions
├── file-diff
├──── action.yml - this defines the inputs and outputs of the action
├──── index.js - the code that runs the action
├──── package.json - has dependencies so has package
├──── README.md - more documentation yay!
⎪ workflows
├── development.yml - run on pull requests only
├── production.yml - runs only on pushes to main
├── vrt.yml - a reusable workflow that can be called by other workflows (i.e., development.yml or production.yml) or called on it's own via [workflow dispatch](https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/).
├── build.yml - builds a branch and outputs the compiled assets as artifacts
├── compare-results.yml - compares the compiled assets between the pull request branch and the main branch

But wait! There's more!

⎪ ISSUE_TEMPLATE
├── --bug-report.md
├── --documentation-issue.md
├── --feature-request.md
├── --support-request.md
⎪ PULL_REQUEST_TEMPLATE.md
⎪ CONTRIBUTING.md
⎪ dependabot.yml

Actions

File Diff

This action is used to determine if a compiled asset has changed between two branches. See the README for more information.

Workflows

Development

This workflow runs:

  • on pull requests when:
    • opened against the main branch
    • opened, reopened, synchronized (i.e., when a commit is pushed to the pull request), labeled or unlabeled, or if auto merge is enabled
    • any files other than markdown have changed (i.e., will not run on a pull request that only changes markdown files)

What does this workflow do?

👷‍♀️ Build

Builds the pull request branch against various development environments. Installs dependencies and builds the project looking for basic processing errors.

👷‍♀️ Compare results

Compares the compiled assets between the pull request branch and the base branch. If there are differences, a comment is added to the pull request with a table detailing the files and the size differences.

to-do: This needs to diff the actual content of the files as well. Right now we're leveraging a canary approach which would catch any file size changes to the compiled assets. However, if the content of the file changes but the size doesn't, we won't catch that.

🧹 Linting

Runs stylelint or eslint if any relevant assets have been updated in this PR.

📝 Publish site

After the build and visual regression tests have passed, this will build the docs site and publish it to Netlify.

📸 Visual regression testing

Run these tests if the run_vrt label is added to the pull request.

OR the pull request is not in a draft state and is mergeable (meaning no conflicts with the base branch)

OR the pull request review request is approved.

The only step in this job is to run the vrt.yml workflow.

Production

This workflow runs:

  • on pushes to the main branch

What does this workflow do?

👷🏾 1. Build

Builds the main branch and outputs the compiled assets as artifacts.

📝 2. Publish site

Publish the docs site to Netlify.

📸 3. Visual regression testing

Run the visual regression testing for ALL pushes to the main branch. Triggers the vrt.yml workflow, see below for more information.

Visual regression testing

First, why is this a workflow and not it's own action? We want to be able to trigger the visual regression test manually via the GitHub UI or dynamically via another workflow. It also doesn't need to run in the same container as the rest of the workflow. An action is a definition of tasks and runs in the context it's called within while a workflow runs in it's own container.

To-do list

  • I have read the contribution guidelines.
  • If my change impacts documentation, I have updated the documentation accordingly.
  • ✨ This pull request is ready to merge. ✨

@castastrophe castastrophe force-pushed the chore-ci-rework branch 3 times, most recently from c5f78c4 to ee2e674 Compare November 7, 2023 13:22
@castastrophe castastrophe marked this pull request as ready for review November 7, 2023 13:22
@castastrophe castastrophe requested a review from pfulton November 7, 2023 13:22
@castastrophe castastrophe force-pushed the chore-ci-rework branch 6 times, most recently from 4e6c7ca to 5b965ee Compare November 9, 2023 15:00
Copy link
Contributor

github-actions bot commented Nov 9, 2023

🚀 Deployed on https://pr-2270--spectrum-css.netlify.app

Copy link
Contributor

github-actions bot commented Nov 9, 2023

File metrics

Overall Δ: No change 🎉 🎉

@castastrophe castastrophe merged commit 698b995 into main Nov 9, 2023
@castastrophe castastrophe deleted the chore-ci-rework branch November 9, 2023 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants