Skip to content

Commit a8649ab

Browse files
author
Ashwin Kumar
committed
test e2e on label
1 parent 3c4d29e commit a8649ab

File tree

3 files changed

+146
-21
lines changed

3 files changed

+146
-21
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: 'Set Status'
2+
description: 'Set status on a specified head-sha'
3+
inputs:
4+
context:
5+
description: 'Name of the status'
6+
required: true
7+
description:
8+
description: 'Short description of the status'
9+
required: false
10+
state:
11+
description: >-
12+
State of the status with possible values of 'error', 'failure', 'pending', 'success'
13+
required: true
14+
sha:
15+
description: 'The commit ID to add the status to'
16+
required: true
17+
target-url:
18+
description: >-
19+
Target URL to associate with this status.
20+
This URL will be linked from the GitHub UI to allow users to easily see the source of the status.'
21+
required: false
22+
runs:
23+
using: 'composite'
24+
steps:
25+
- name: Set a commit status
26+
id: set-status
27+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 https://github.com/actions/github-script/commit/60a0d83039c74a4aee543508d2ffcb1c3799cdea
28+
env:
29+
status_context: ${{ inputs.context }}
30+
description: ${{ inputs.description }}
31+
state: ${{ inputs.state }}
32+
sha: ${{ inputs.sha }}
33+
target_url: ${{ inputs.target-url }}
34+
owner: ${{ github.event.repository.owner.login }}
35+
repo: ${{ github.event.repository.name }}
36+
with:
37+
result-encoding: string
38+
script: |
39+
const { status_context, description, state, sha, target_url, owner, repo } = process.env;
40+
const inputValidationErrors = [];
41+
if (state.length === 0) {
42+
inputValidationErrors.push('"state" input cannot be empty.');
43+
}
44+
if (!["error", "failure", "pending", "success"].includes(state)) {
45+
inputValidationErrors.push('"state" must be a string input with possible value of "error", "failure", "pending", "success".');
46+
}
47+
if (context.length === 0) {
48+
inputValidationErrors.push('"context" input cannot be empty.');
49+
}
50+
if (sha.length === 0) {
51+
inputValidationErrors.push('"sha" input cannot be empty.');
52+
}
53+
if (!sha.match(/^[0-9a-z]+$/)) {
54+
inputValidationErrors.push('"sha" must be an alphanumeric string.');
55+
}
56+
if (inputValidationErrors.length > 0) {
57+
inputValidationErrors.forEach(core.error);
58+
process.exit(1);
59+
}
60+
github.rest.repos.createCommitStatus({
61+
owner,
62+
repo,
63+
sha,
64+
state,
65+
context: status_context,
66+
description: description.length > 0 ? description : undefined,
67+
target_url: target_url.length > 0 ? target_url : undefined,
68+
});

.github/workflows/callable-release-verification.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@ jobs:
77
uses: ./.github/workflows/callable-prebuild-amplify-js.yml
88
with:
99
runs_on: ubuntu-latest
10-
prebuild-macos:
11-
uses: ./.github/workflows/callable-prebuild-amplify-js.yml
12-
with:
13-
runs_on: macos-latest
14-
prebuild-samples-staging:
15-
secrets: inherit
16-
uses: ./.github/workflows/callable-prebuild-samples-staging.yml
17-
e2e:
18-
needs:
19-
- prebuild-macos
20-
- prebuild-ubuntu
21-
- prebuild-samples-staging
22-
secrets: inherit
23-
uses: ./.github/workflows/callable-e2e-tests.yml
24-
unit-tests:
25-
needs:
26-
- prebuild-ubuntu
27-
uses: ./.github/workflows/callable-unit-tests.yml
28-
bundle-size-tests:
29-
needs: prebuild-ubuntu
30-
uses: ./.github/workflows/callable-bundle-size-tests.yml
10+
# prebuild-macos:
11+
# uses: ./.github/workflows/callable-prebuild-amplify-js.yml
12+
# with:
13+
# runs_on: macos-latest
14+
# prebuild-samples-staging:
15+
# secrets: inherit
16+
# uses: ./.github/workflows/callable-prebuild-samples-staging.yml
17+
# e2e:
18+
# needs:
19+
# - prebuild-macos
20+
# - prebuild-ubuntu
21+
# - prebuild-samples-staging
22+
# secrets: inherit
23+
# uses: ./.github/workflows/callable-e2e-tests.yml
24+
# unit-tests:
25+
# needs:
26+
# - prebuild-ubuntu
27+
# uses: ./.github/workflows/callable-unit-tests.yml
28+
# bundle-size-tests:
29+
# needs: prebuild-ubuntu
30+
# uses: ./.github/workflows/callable-bundle-size-tests.yml

.github/workflows/pr-label.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Description: This workflow runs test suite against PRs that are not from forks.
2+
#
3+
# Triggers:
4+
# - When a PR is opened, updated, or labeled against specific branches
5+
# - Only runs when the PR has the 'run-tests' label
6+
# - Only runs for internal PRs (not from forks)
7+
8+
name: Test / Internal PRs
9+
10+
concurrency:
11+
group: test-internal-prs-${{ github.event.pull_request.number }}
12+
cancel-in-progress: true
13+
14+
on:
15+
pull_request:
16+
branches:
17+
- ashwin-run-integ-onTag
18+
# - main
19+
# - release
20+
types: [opened, synchronize, labeled]
21+
22+
jobs:
23+
check_conditions:
24+
runs-on: ubuntu-latest
25+
env:
26+
IS_INTERNAL_PR: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
27+
HAS_RUN_TESTS_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'run-tests') }}
28+
outputs:
29+
should_run: ${{ env.IS_INTERNAL_PR == 'true' && env.HAS_RUN_TESTS_LABEL == 'true' }}
30+
steps:
31+
- name: Check PR conditions
32+
id: check
33+
run: |
34+
echo "Internal PR: $IS_INTERNAL_PR"
35+
echo "Has run-tests label: $HAS_RUN_TESTS_LABEL"
36+
37+
prebuild:
38+
needs: check_conditions
39+
if: ${{ needs.check_conditions.outputs.should_run == 'true' }}
40+
strategy:
41+
matrix:
42+
platform: [ubuntu-latest, macos-latest]
43+
uses: ./.github/workflows/callable-prebuild-amplify-js.yml
44+
with:
45+
runs_on: ${{ matrix.platform }}
46+
47+
# prebuild-samples-staging:
48+
# needs: check_conditions
49+
# if: ${{ needs.check_conditions.outputs.should_run == 'true' }}
50+
# secrets: inherit
51+
# uses: ./.github/workflows/callable-prebuild-samples-staging.yml
52+
53+
# e2e:
54+
# needs: [check_conditions, prebuild, prebuild-samples-staging]
55+
# if: ${{ needs.check_conditions.outputs.should_run == 'true' }}
56+
# secrets: inherit
57+
# uses: ./.github/workflows/callable-e2e-tests.yml

0 commit comments

Comments
 (0)