-
Notifications
You must be signed in to change notification settings - Fork 166
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
Percy workflow selectivity improvements #5108
Merged
bartaz
merged 5 commits into
canonical:main
from
jmuzina:percy-workflow-selectivity-improvements
Jun 18, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
131845f
Link percy builds with a specific pull request; remove unnecessary ar…
jmuzina cecce53
Link percy builds with a specific pull request; remove unnecessary ar…
jmuzina c0f0727
Rename percy workflows
jmuzina 14445ea
move percy-snapshot action into its own dir
jmuzina 9e60c58
Add more docs to Percy workflows; add Percy testing section to pull r…
jmuzina File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# This workflow is triggered by the `pr-percy-prepare` workflows. | ||
# It checks out the SCSS/example markup changes and uploads them to Github as an artifact. | ||
name: "Prepare Percy build" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
pr_number: | ||
required: true | ||
type: number | ||
repository: | ||
required: true | ||
type: string | ||
commitsh: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
copy_artifact: | ||
name: Copy changed files to GHA artifact | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: | | ||
templates/docs/examples/ | ||
scss/ | ||
ref: ${{ github.event.inputs.commitsh }} | ||
repository: ${{ github.event.inputs.repository }} | ||
|
||
- name: Populate artifact directory | ||
run: | | ||
mkdir -p artifact | ||
cp -R templates/docs/examples/ scss/ artifact/. | ||
|
||
# Archive the PR number associated with this workflow since it won't be available in the base workflow context | ||
# https://github.com/orgs/community/discussions/25220 | ||
- name: Archive PR data | ||
if: github.event_name=='pull_request' | ||
working-directory: artifact | ||
run: | | ||
echo ${{ inputs.pr_number }} > pr_num.txt | ||
echo ${{ inputs.commitsh }} > pr_head_sha.txt | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: "percy-testing-web-artifact" | ||
path: artifact/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# This workflow ensures Percy is executed against PRs with the Percy required label, regardless of which paths were changed | ||
name: "Percy (labeled)" | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
types: | ||
# workflow runs after a label is added to the PR, or when a commit is added to a PR with the Percy label | ||
- labeled | ||
- synchronize | ||
|
||
jobs: | ||
copy_artifact: | ||
name: Copy changed files to GHA artifact | ||
bartaz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if: contains(github.event.pull_request.labels.*.name, vars.PERCY_TEST_REQUESTED_LABEL_NAME) | ||
uses: ./.github/workflows/percy-prepare.yml | ||
with: | ||
pr_number: ${{ github.event.number }} | ||
repository: ${{ github.repository }} | ||
commitsh: ${{ github.event.pull_request.head.sha }} | ||
|
||
# Completion should trigger `pr-percy-snapshots` workflow. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# This workflow runs Percy against non-draft PRs that have changes in relevant examples filepaths. | ||
name: "Percy (pushed)" | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- "templates/docs/examples/**" | ||
- "scss/**" | ||
types: | ||
- opened | ||
- synchronize | ||
|
||
jobs: | ||
copy_artifact: | ||
name: Copy changed files to GHA artifact | ||
# Ignore draft PRS and PRs with the Percy label | ||
# If we run tests against PRs with the Percy label, we will run tests twice (test is also ran by the labelling workflow) | ||
if: ${{ !github.event.pull_request.draft && !contains(github.event.pull_request.labels.*.name, vars.PERCY_TEST_REQUESTED_LABEL_NAME) }} | ||
bartaz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
uses: ./.github/workflows/percy-prepare.yml | ||
with: | ||
pr_number: ${{ github.event.number }} | ||
repository: ${{ github.repository }} | ||
commitsh: ${{ github.event.pull_request.head.sha }} | ||
|
||
# Completion should trigger `pr-percy-snapshots` workflow. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a workflow, or an action?
It doesn't seem to be triggered via PR events, but reused in workflows as if it was an action, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to have a comment on top what the workflow does, and when it's supposed to be triggered, to have a better understanding of the flow.
As now it's getting complicated with multiple conditional workflows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bartaz
It is a reusable workflow.
Yes, it's triggered by the snapshot & label workflows - the workflow runs at job level whereas the action runs at the step level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I'll add a note to the workflow momentarily