GitHub Actions runs using workflows, which define jobs that we run for continuous integration (CI). Inside of our GitHub Actions, we have 4 different kinds of workflows:
- Core - Linting, Unit Tests, and Non-Snapshot Functional Tests
- Snapshot Comparison
- Update Snapshots
- Commit Snapshots
- Release
Snapshot-based workflows are split further by US and non-US due to the numerous offers that US has. This keeps our CI running quickly.
This workflow runs two jobs.
lintAndUnit
- Lints code to make sure it follows coding standards.
- Runs unit tests to ensure code is working at a basic level.
functionalNonSnapshot
- Runs non-snapshot functional tests to ensure that code works when it runs in the browser.
This workflow runs two jobs.
compareSnapshots
- Reads
matrix.json
and provides it as output. - Takes each locale and group to output a JSON array of valid testPathPatterns.
compareSnapshots
compareSnapshots
reads the output ofgetMatrix
to determine the tests to run.- The server is run.
- Any failed comparison tests are collected and uploaded to imgur.
This workflow runs three jobs.
getMatrix
- Reads
matrix.json
and provides it as output. - Takes each locale and group to output a JSON array of valid testPathPatterns.
captureMetadata
- Saves the pull request number to a file.
updateSnapshots
- Reads the output of
getMatrix
to determine which tests may need updating. - The server is run.
- Any comparison tests that failed in Snapshot Comparison will have their images updated.
- Saves updated images as artifacts (workflow storage).
This workflow runs one job.
commit
- Downloads the snapshot image artifacts from
updateSnapshots
. - Removes the
snapshots
label. - Commits thee snapshot images.
This workflow runs three jobs.
core
compareSnapshots
release
- Runs semantic-release to create a new release
Triggers are what causes a workflow to run. These are the current triggers for each of our workflows.
- Linting, Unit Tests, and Non-Snapshot Functional Tests
workflow_dispatch
- allows for manually running a workflowpush
- runs the workflow when code is pushed todevelop
orrelease
pull_request
- runs on all pull requests
- Snapshot Comparison
workflow_dispatch
- allows for manually running a workflowworkflow_call
-push
- runs the workflow when code is pushed todevelop
orrelease
pull_request
- runs on all pull requests- Note -
push
andpull_request
run US or non-US workflows if their related files are changed
- Update Snapshots
workflow_dispatch
- allows for manually running a workflowpull_request
- runs on all pull requestspull_request_target
- runs on all pull requests from forks if the pull request has a label on it- Note - this workflow only runs if it is labeled with
snapshots
- Commit Snapshots
workflow_run
- runs wheen another workflow finishes
- Release
workflow_dispatch
- allows for manually running a workflowpush
- runs the workflow when code is pushed torelease
The strategy matrix makes it easy to run the same job with a different configuration.
This matrix is used to run snapshot tests for each locale and to split the US locale by various test path patterns. The matrix
option is generated dynamically by reading in matrix.json
. This is done so developers can change locale
and groups
in one place and every workflow using those options stays in sync.
You can read more in the official docs here.