-
Notifications
You must be signed in to change notification settings - Fork 2.2k
chore(actions): run test suite against PRs and on label #14372
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
Open
ashwinkumar6
wants to merge
7
commits into
main
Choose a base branch
from
ashwin-run-integ-onTag
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
792d589
chore(actions): run test suite against PRs and on label
ce2efd8
Merge branch 'main' into ashwin-run-integ-onTag
ashwinkumar6 9e016ee
Merge branch 'main' into ashwin-run-integ-onTag
ashwinkumar6 6141cfd
Merge branch 'main' into ashwin-run-integ-onTag
AllanZhengYP e50af37
Update .github/workflows/pr-label.yml
ashwinkumar6 222e674
Update .github/workflows/pr-label.yml
ashwinkumar6 3a84ceb
Merge branch 'main' into ashwin-run-integ-onTag
ashwinkumar6 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 hidden or 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,68 @@ | ||
name: 'Set Status' | ||
description: 'Set status on a specified head-sha' | ||
inputs: | ||
context: | ||
description: 'Name of the status' | ||
required: true | ||
description: | ||
description: 'Short description of the status' | ||
required: false | ||
state: | ||
description: >- | ||
State of the status with possible values of 'error', 'failure', 'pending', 'success' | ||
required: true | ||
sha: | ||
description: 'The commit ID to add the status to' | ||
required: true | ||
target-url: | ||
description: >- | ||
Target URL to associate with this status. | ||
This URL will be linked from the GitHub UI to allow users to easily see the source of the status.' | ||
required: false | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Set a commit status | ||
id: set-status | ||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 https://github.com/actions/github-script/commit/60a0d83039c74a4aee543508d2ffcb1c3799cdea | ||
env: | ||
status_context: ${{ inputs.context }} | ||
description: ${{ inputs.description }} | ||
state: ${{ inputs.state }} | ||
sha: ${{ inputs.sha }} | ||
target_url: ${{ inputs.target-url }} | ||
owner: ${{ github.event.repository.owner.login }} | ||
repo: ${{ github.event.repository.name }} | ||
with: | ||
result-encoding: string | ||
script: | | ||
const { status_context, description, state, sha, target_url, owner, repo } = process.env; | ||
const inputValidationErrors = []; | ||
if (state.length === 0) { | ||
inputValidationErrors.push('"state" input cannot be empty.'); | ||
} | ||
if (!["error", "failure", "pending", "success"].includes(state)) { | ||
inputValidationErrors.push('"state" must be a string input with possible value of "error", "failure", "pending", "success".'); | ||
} | ||
if (context.length === 0) { | ||
inputValidationErrors.push('"context" input cannot be empty.'); | ||
} | ||
if (sha.length === 0) { | ||
inputValidationErrors.push('"sha" input cannot be empty.'); | ||
} | ||
if (!sha.match(/^[0-9a-z]+$/)) { | ||
inputValidationErrors.push('"sha" must be an alphanumeric string.'); | ||
} | ||
if (inputValidationErrors.length > 0) { | ||
inputValidationErrors.forEach(core.error); | ||
process.exit(1); | ||
} | ||
github.rest.repos.createCommitStatus({ | ||
owner, | ||
repo, | ||
sha, | ||
state, | ||
context: status_context, | ||
description: description.length > 0 ? description : undefined, | ||
target_url: target_url.length > 0 ? target_url : undefined, | ||
}); |
This file contains hidden or 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,90 @@ | ||
# Description: This workflow runs test suite against PRs that are not from forks. | ||
# | ||
# Triggers: | ||
# - When a PR is opened, updated, or labeled against specific branches | ||
# - Only runs when the PR has the 'run-tests' label | ||
# - Only runs for internal PRs (not from forks) | ||
|
||
name: Test / Internal PRs | ||
|
||
concurrency: | ||
group: push-e2e-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
pull_request: | ||
ashwinkumar6 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
branches: [main, release] | ||
types: [opened, synchronize, labeled] | ||
|
||
jobs: | ||
setup: | ||
if: | | ||
github.event.pull_request.head.repo.full_name == github.repository && | ||
contains(github.event.pull_request.labels.*.name, 'run-tests') | ||
runs-on: ubuntu-latest | ||
permissions: | ||
statuses: write # This is required for running set-status actions | ||
steps: | ||
- uses: actions/checkout@b80ff79f1755d06ba70441c368a6fe801f5f3a62 # v4.1.3 https://github.com/actions/checkout/commit/cd7d8d697e10461458bc61a30d094dc601a8b017 | ||
- name: Update status to pending prior to starting tests | ||
uses: ./.github/actions/set-status | ||
with: | ||
sha: ${{ github.event.pull_request.head.sha }} | ||
state: 'pending' | ||
context: 'Run PR e2e checks' | ||
description: 'PR e2e checks are now running' | ||
# URL below is a link to the current workflow run to allow users to see the status of the workflow. | ||
target-url: https://github.com/${{ github.event.repository.owner.login }}/${{ github.event.repository.name }}/actions/runs/${{ github.run_id }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. any validation on target-url? If not, please restrict this to only expected input (min/max length, malicious characters, etc). |
||
|
||
prebuild: | ||
needs: setup | ||
strategy: | ||
matrix: | ||
platform: [ubuntu-latest, macos-latest] | ||
uses: ./.github/workflows/callable-prebuild-amplify-js.yml | ||
with: | ||
runs_on: ${{ matrix.platform }} | ||
|
||
prebuild-samples-staging: | ||
needs: setup | ||
secrets: inherit | ||
uses: ./.github/workflows/callable-prebuild-samples-staging.yml | ||
|
||
e2e: | ||
ashwinkumar6 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
needs: [setup, prebuild, prebuild-samples-staging] | ||
secrets: inherit | ||
uses: ./.github/workflows/callable-e2e-tests.yml | ||
|
||
update-success-status: | ||
if: ${{ success() }} | ||
needs: [e2e] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
statuses: write # This is required for running set-status actions | ||
steps: | ||
- uses: actions/checkout@b80ff79f1755d06ba70441c368a6fe801f5f3a62 # v4.1.3 https://github.com/actions/checkout/commit/cd7d8d697e10461458bc61a30d094dc601a8b017 | ||
- name: Update status when tests are successful | ||
uses: ./.github/actions/set-status | ||
with: | ||
sha: ${{ github.event.pull_request.head.sha }} | ||
state: 'success' | ||
context: 'Run PR e2e checks' | ||
description: 'PR e2e checks have finished running' | ||
target-url: https://github.com/${{ github.event.repository.owner.login }}/${{ github.event.repository.name }}/actions/runs/${{ github.run_id }} | ||
|
||
update-failure-status: | ||
if: ${{ failure() }} | ||
needs: [e2e] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
statuses: write # This is required for running set-status actions | ||
steps: | ||
- uses: actions/checkout@b80ff79f1755d06ba70441c368a6fe801f5f3a62 # v4.1.3 https://github.com/actions/checkout/commit/cd7d8d697e10461458bc61a30d094dc601a8b017 | ||
- name: Update status when tests are not successful | ||
uses: ./.github/actions/set-status | ||
with: | ||
sha: ${{ github.event.pull_request.head.sha }} | ||
state: 'failure' | ||
context: 'Run e2e PR checks' | ||
description: 'PR e2e checks have failed' | ||
target-url: https://github.com/${{ github.event.repository.owner.login }}/${{ github.event.repository.name }}/actions/runs/${{ github.run_id }} |
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.
Uh oh!
There was an error while loading. Please reload this page.