Skip to content

Commit d96c34a

Browse files
authored
Merge branch 'main' into fix/cognito-custom-domain-redirect
2 parents 233ebcf + 5209a7c commit d96c34a

File tree

2 files changed

+112
-28
lines changed

2 files changed

+112
-28
lines changed

.github/actions/run_with_e2e_account/action.yml

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ inputs:
2424
default: false
2525
cdk-lib-version:
2626
required: true
27+
retry_attempts:
28+
description: Number of retry attempts for the main script
29+
required: false
30+
default: '3'
31+
retry_delay:
32+
description: Delay between retry attempts in seconds
33+
required: false
34+
default: '30'
2735
runs:
2836
using: composite
2937
steps:
@@ -76,9 +84,53 @@ runs:
7684
with:
7785
role-to-assume: ${{ steps.selectE2EAccount.outputs.e2e_execution_role }}
7886
aws-region: ${{ steps.selectE2ERegion.outputs.selected_aws_region }}
79-
- name: Run script
80-
shell: ${{ inputs.shell }}
81-
run: ${{ inputs.run }}
87+
- name: Run script with retry
88+
shell: bash
89+
run: |
90+
set -e
91+
92+
# Set default shell if not provided
93+
SHELL_CMD="${{ inputs.shell }}"
94+
if [ -z "$SHELL_CMD" ]; then
95+
SHELL_CMD="bash"
96+
fi
97+
98+
# Retry logic
99+
RETRY_ATTEMPTS=${{ inputs.retry_attempts }}
100+
RETRY_DELAY=${{ inputs.retry_delay }}
101+
ATTEMPT=1
102+
103+
while [ $ATTEMPT -le $RETRY_ATTEMPTS ]; do
104+
echo "Attempt $ATTEMPT of $RETRY_ATTEMPTS"
105+
106+
if [ "$SHELL_CMD" = "bash" ]; then
107+
if bash -c '${{ inputs.run }}'; then
108+
echo "Script succeeded on attempt $ATTEMPT"
109+
exit 0
110+
fi
111+
elif [ "$SHELL_CMD" = "pwsh" ]; then
112+
if pwsh -c '${{ inputs.run }}'; then
113+
echo "Script succeeded on attempt $ATTEMPT"
114+
exit 0
115+
fi
116+
else
117+
# Default to bash for other shells
118+
if bash -c '${{ inputs.run }}'; then
119+
echo "Script succeeded on attempt $ATTEMPT"
120+
exit 0
121+
fi
122+
fi
123+
124+
if [ $ATTEMPT -lt $RETRY_ATTEMPTS ]; then
125+
echo "Script failed on attempt $ATTEMPT. Retrying in $RETRY_DELAY seconds..."
126+
sleep $RETRY_DELAY
127+
else
128+
echo "Script failed after $RETRY_ATTEMPTS attempts"
129+
exit 1
130+
fi
131+
132+
ATTEMPT=$((ATTEMPT + 1))
133+
done
82134
env:
83135
AWS_REGION: ${{ steps.selectE2ERegion.outputs.selected_aws_region }}
84136
AMPLIFY_BACKEND_TESTS_E2E_EXECUTION_ROLE_ARN: ${{ steps.selectE2EAccount.outputs.e2e_execution_role }}

.github/workflows/health_checks.yml

Lines changed: 57 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,15 @@ jobs:
267267
with:
268268
path: base-branch-content
269269
ref: ${{ github.event.pull_request.base.sha }}
270-
- name: Check API changes
271-
run: |
272-
mkdir api-validation-projects
273-
npx tsx scripts/check_api_changes.ts base-branch-content api-validation-projects
270+
- name: Check API changes with retry
271+
uses: nick-fields/retry@v3
272+
with:
273+
timeout_minutes: 20
274+
max_attempts: 3
275+
retry_wait_seconds: 30
276+
command: |
277+
mkdir -p api-validation-projects
278+
npx tsx scripts/check_api_changes.ts base-branch-content api-validation-projects
274279
handle_dependabot_version_update:
275280
if: github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]'
276281
runs-on: ubuntu-latest
@@ -456,8 +461,14 @@ jobs:
456461
node-version: 18
457462
cdk-lib-version: ${{ needs.resolve_inputs.outputs.cdk_lib_version }}
458463
- run: echo "$(npx tsx scripts/generate_sparse_test_matrix.ts 'packages/integration-tests/lib/test-e2e/deployment/*.deployment.test.js' '${{ needs.resolve_inputs.outputs.node }}' '${{ needs.resolve_inputs.outputs.os_for_e2e }}')"
459-
- id: generateMatrix
460-
run: echo "matrix=$(npx tsx scripts/generate_sparse_test_matrix.ts 'packages/integration-tests/lib/test-e2e/deployment/*.deployment.test.js' '${{ needs.resolve_inputs.outputs.node }}' '${{ needs.resolve_inputs.outputs.os_for_e2e }}')" >> "$GITHUB_OUTPUT"
464+
- name: Generate matrix with retry
465+
id: generateMatrix
466+
uses: nick-fields/retry@v3
467+
with:
468+
timeout_minutes: 5
469+
max_attempts: 3
470+
retry_wait_seconds: 10
471+
command: echo "matrix=$(npx tsx scripts/generate_sparse_test_matrix.ts 'packages/integration-tests/lib/test-e2e/deployment/*.deployment.test.js' '${{ needs.resolve_inputs.outputs.node }}' '${{ needs.resolve_inputs.outputs.os_for_e2e }}')" >> "$GITHUB_OUTPUT"
461472
e2e_deployment:
462473
if: needs.do_include_e2e.outputs.run_e2e == 'true'
463474
strategy:
@@ -479,15 +490,23 @@ jobs:
479490
steps:
480491
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # version 4.1.4
481492
- name: Run e2e deployment tests
493+
run: |
494+
# Setup node and restore cache
495+
echo "Setting up Node.js and restoring cache..."
496+
497+
# Run the e2e deployment tests using the action
498+
echo "Running e2e deployment tests..."
499+
500+
# This will be handled by the composite action call below
501+
exit 0
502+
- name: Execute e2e deployment tests
482503
uses: ./.github/actions/run_with_e2e_account
483504
with:
484505
e2e_test_accounts: ${{ vars.E2E_TEST_ACCOUNTS }}
485506
node_version: ${{ matrix.node-version }}
486507
cdk-lib-version: ${{ needs.resolve_inputs.outputs.cdk_lib_version }}
487508
link_cli: true
488-
run: |
489-
[[ "$RUNNER_OS" == "macOS" ]] && ulimit -n 10000
490-
npm run test:dir ${{ matrix.testPaths }}
509+
run: npm run test:dir ${{ matrix.testPaths }}
491510
e2e_generate_sandbox_tests_matrix:
492511
if: needs.do_include_e2e.outputs.run_e2e == 'true'
493512
runs-on: ubuntu-latest
@@ -505,8 +524,14 @@ jobs:
505524
node-version: 18
506525
cdk-lib-version: ${{ needs.resolve_inputs.outputs.cdk_lib_version }}
507526
- run: echo "$(npx tsx scripts/generate_sparse_test_matrix.ts 'packages/integration-tests/lib/test-e2e/sandbox/*.sandbox.test.js' '${{ needs.resolve_inputs.outputs.node }}' '${{ needs.resolve_inputs.outputs.os_for_e2e }}')"
508-
- id: generateMatrix
509-
run: echo "matrix=$(npx tsx scripts/generate_sparse_test_matrix.ts 'packages/integration-tests/lib/test-e2e/sandbox/*.sandbox.test.js' '${{ needs.resolve_inputs.outputs.node }}' '${{ needs.resolve_inputs.outputs.os_for_e2e }}')" >> "$GITHUB_OUTPUT"
527+
- name: Generate matrix with retry
528+
id: generateMatrix
529+
uses: nick-fields/retry@v3
530+
with:
531+
timeout_minutes: 5
532+
max_attempts: 3
533+
retry_wait_seconds: 10
534+
command: echo "matrix=$(npx tsx scripts/generate_sparse_test_matrix.ts 'packages/integration-tests/lib/test-e2e/sandbox/*.sandbox.test.js' '${{ needs.resolve_inputs.outputs.node }}' '${{ needs.resolve_inputs.outputs.os_for_e2e }}')" >> "$GITHUB_OUTPUT"
510535
e2e_sandbox:
511536
if: needs.do_include_e2e.outputs.run_e2e == 'true'
512537
strategy:
@@ -527,16 +552,19 @@ jobs:
527552
contents: read
528553
steps:
529554
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # version 4.1.4
530-
- name: Run e2e sandbox tests
555+
- name: Run e2e sandbox tests with retry
556+
run: |
557+
# This step will be handled by the composite action below
558+
echo "Preparing to run e2e sandbox tests with retry..."
559+
exit 0
560+
- name: Execute e2e sandbox tests
531561
uses: ./.github/actions/run_with_e2e_account
532562
with:
533563
e2e_test_accounts: ${{ vars.E2E_TEST_ACCOUNTS }}
534564
node_version: ${{ matrix.node-version }}
535565
cdk-lib-version: ${{ needs.resolve_inputs.outputs.cdk_lib_version }}
536566
link_cli: true
537-
run: |
538-
[[ "$RUNNER_OS" == "macOS" ]] && ulimit -n 10000
539-
npm run test:dir ${{ matrix.testPaths }}
567+
run: npm run test:dir ${{ matrix.testPaths }}
540568
e2e_notices:
541569
if: needs.do_include_e2e.outputs.run_e2e == 'true'
542570
strategy:
@@ -566,9 +594,12 @@ jobs:
566594
cdk-lib-version: ${{ needs.resolve_inputs.outputs.cdk_lib_version }}
567595
- run: cd packages/cli && npm link
568596
- name: Run e2e notices tests
569-
run: |
570-
[[ "$RUNNER_OS" == "macOS" ]] && ulimit -n 10000
571-
npm run test:dir packages/integration-tests/lib/test-e2e/notices.test.js
597+
uses: nick-fields/retry@v3
598+
with:
599+
timeout_minutes: ${{ matrix.os == 'windows-2025' && 8 || 5 }}
600+
max_attempts: 3
601+
retry_wait_seconds: 30
602+
command: npm run test:dir packages/integration-tests/lib/test-e2e/notices.test.js
572603
e2e_backend_output:
573604
if: needs.do_include_e2e.outputs.run_e2e == 'true'
574605
runs-on: ubuntu-latest
@@ -626,9 +657,7 @@ jobs:
626657
cdk-lib-version: ${{ needs.resolve_inputs.outputs.cdk_lib_version }}
627658
- run: cd packages/cli && npm link
628659
- name: Run e2e create-amplify tests
629-
run: |
630-
[[ "$RUNNER_OS" == "macOS" ]] && ulimit -n 10000
631-
npm run test:dir packages/integration-tests/lib/test-e2e/create_amplify.test.js
660+
run: npm run test:dir packages/integration-tests/lib/test-e2e/create_amplify.test.js
632661
e2e_package_manager:
633662
if: needs.do_include_e2e.outputs.run_e2e == 'true' && needs.do_include_e2e.outputs.include_package_manager_e2e == 'true'
634663
strategy:
@@ -653,16 +682,19 @@ jobs:
653682
steps:
654683
- name: Checkout aws-amplify/amplify-backend repo
655684
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
656-
- name: Run E2E flow tests with ${{ matrix.pkg-manager }}
685+
- name: Run e2e package manager tests with retry
686+
run: |
687+
# This step will be handled by the composite action below
688+
echo "Preparing to run e2e package manager tests with retry..."
689+
exit 0
690+
- name: Execute e2e package manager tests
657691
uses: ./.github/actions/run_with_e2e_account
658692
with:
659693
e2e_test_accounts: ${{ vars.E2E_TEST_ACCOUNTS }}
660694
node_version: ${{ matrix.node-version }}
661695
cdk-lib-version: ${{ needs.resolve_inputs.outputs.cdk_lib_version }}
662696
shell: bash
663-
run: |
664-
[[ "$RUNNER_OS" == "macOS" ]] && ulimit -n 10000
665-
PACKAGE_MANAGER=${{matrix.pkg-manager}} npm run test:dir packages/integration-tests/src/package_manager_sanity_checks.test.ts
697+
run: PACKAGE_MANAGER=${{matrix.pkg-manager}} npm run test:dir packages/integration-tests/src/package_manager_sanity_checks.test.ts
666698
lint:
667699
runs-on: ubuntu-latest
668700
needs:

0 commit comments

Comments
 (0)