Skip to content

Commit 1f3104c

Browse files
authored
chore(ci): update compare assets processing (#2337)
1 parent c014de9 commit 1f3104c

File tree

110 files changed

+1237
-811
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+1237
-811
lines changed

.eslintrc

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
{
22
"env": {
33
"node": true,
4-
"es6": true
4+
"es2020": true
55
},
66
"parserOptions": {
7-
"ecmaVersion": 6
7+
"sourceType": "module"
88
},
99
"extends": "eslint:recommended",
1010
"rules": {
11-
"brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
12-
"func-call-spacing": ["error", "never"],
13-
"indent": ["error", 2],
14-
"linebreak-style": ["error", "unix"],
15-
"no-console": "off",
16-
"quotes": ["error", "single"],
17-
"avoidEscape": true,
18-
"semi": ["error", "always"],
19-
"space-before-blocks": ["error", "always"]
11+
"brace-style": ["warn", "stroustrup", { "allowSingleLine": true }],
12+
"func-call-spacing": ["warn", "never"],
13+
"indent": ["warn", 2],
14+
"linebreak-style": ["warn", "unix"],
15+
"no-console": 0,
16+
"quotes": ["warn", "single"],
17+
"semi": ["warn", "always"],
18+
"space-before-blocks": ["warn", "always"]
2019
},
2120
"root": true
2221
}

.github/GUIDE.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# GitHub Actions, templates, and bots (oh my!)
2+
3+
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.
4+
5+
## Architecture
6+
7+
```bash
8+
⎪ actions
9+
├── file-diff
10+
├──── action.yml - this defines the inputs and outputs of the action
11+
├──── index.js - the code that runs the action
12+
├──── package.json - has dependencies so has package
13+
├──── README.md - more documentation yay!
14+
⎪ workflows
15+
├── development.yml - run on pull requests only
16+
├── production.yml - runs only on pushes to main
17+
├── 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/).
18+
├── build.yml - builds a branch and outputs the compiled assets as artifacts
19+
├── compare-results.yml - compares the compiled assets between the pull request branch and the main branch
20+
```
21+
22+
**But wait! There's more!**
23+
24+
```bash
25+
⎪ ISSUE_TEMPLATE
26+
├── --bug-report.md
27+
├── --documentation-issue.md
28+
├── --feature-request.md
29+
├── --support-request.md
30+
⎪ PULL_REQUEST_TEMPLATE.md
31+
⎪ CONTRIBUTING.md
32+
⎪ dependabot.yml
33+
```
34+
35+
## Actions
36+
37+
### File Diff
38+
39+
This action is used to determine if a compiled asset has changed between two branches. See the [README](./file-diff/README.md) for more information.
40+
41+
## Workflows
42+
43+
### Development
44+
45+
This workflow runs:
46+
47+
- on pull requests when:
48+
- opened against the `main` branch
49+
- opened, reopened, synchronized (i.e., when a commit is pushed to the pull request), labeled or unlabeled, or if auto merge is enabled
50+
- any files other than markdown have changed (i.e., will not run on a pull request that only changes markdown files)
51+
52+
#### What does this workflow do?
53+
54+
##### 👷‍♀️ Build
55+
56+
Builds the pull request branch against various development environments. Installs dependencies and builds the project looking for basic processing errors.
57+
58+
##### 👷‍♀️ Compare results
59+
60+
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.
61+
62+
_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**.
63+
64+
##### 🧹 Linting
65+
66+
Runs stylelint or eslint if any relevant assets have been updated in this PR.
67+
68+
##### 📝 Publish site
69+
70+
After the build and visual regression tests have passed, this will build the docs site and publish it to Netlify.
71+
72+
##### 📸 Visual regression testing
73+
74+
Run these tests if the `run_vrt` label is added to the pull request.
75+
76+
**OR** the pull request is not in a draft state and is mergeable (meaning no conflicts with the base branch)
77+
78+
**OR** the pull request review request is approved.
79+
80+
The only step in this job is to run the `vrt.yml` workflow.
81+
82+
### Production
83+
84+
This workflow runs:
85+
86+
- on pushes to the `main` branch
87+
88+
#### What does this workflow do?
89+
90+
##### 👷🏾 1. Build
91+
92+
Builds the `main` branch and outputs the compiled assets as artifacts.
93+
94+
##### 📝 2. Publish site
95+
96+
Publish the docs site to Netlify.
97+
98+
##### 📸 3. Visual regression testing
99+
100+
Run the visual regression testing for **ALL** pushes to the `main` branch. Triggers the `vrt.yml` workflow, see below for more information.
101+
102+
<!-- ##### 💾 Auto-updates
103+
104+
If a pull request includes the `auto-update` label and uses `main` as the base branch, this workflow will run. It will attempt to update the pull request with the latest changes from `main` but will fail gracefully if there are conflicts. Conflicts will need to be resolved manually. -->
105+
106+
### Visual regression testing
107+
108+
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.

0 commit comments

Comments
 (0)