Skip to content
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

ci: setup e2e tests workflow and local webpack e2e test #508

Open
wants to merge 58 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
c28fcbc
Add webpack and testfile
zxl629 Jan 14, 2025
65156dc
Add changeset
zxl629 Jan 14, 2025
2cf9341
Add to workflow
zxl629 Jan 15, 2025
2a9dc96
Fix
zxl629 Jan 15, 2025
649ff0c
Yml fix
zxl629 Jan 15, 2025
71d55e8
Yml fix
zxl629 Jan 15, 2025
8f45d3e
Bug fix
zxl629 Jan 15, 2025
6ccc577
Add log
zxl629 Jan 15, 2025
9b10d86
Bug fix
zxl629 Jan 15, 2025
db5d36a
Test
zxl629 Jan 16, 2025
690ac0e
Fix test
zxl629 Jan 16, 2025
a46e755
Fix test
zxl629 Jan 16, 2025
9e021d4
Fix test
zxl629 Jan 16, 2025
d2c0b8b
Test
zxl629 Jan 16, 2025
62823ea
Test
zxl629 Jan 16, 2025
77916ad
Test
zxl629 Jan 16, 2025
5f3dd32
Test
zxl629 Jan 16, 2025
bb341bf
Test
zxl629 Jan 16, 2025
f46c7a4
Test
zxl629 Jan 16, 2025
f9f97ab
Test
zxl629 Jan 16, 2025
412b26f
Test
zxl629 Jan 17, 2025
94a9465
Test
zxl629 Jan 17, 2025
7576a61
Test
zxl629 Jan 17, 2025
fac219b
Test
zxl629 Jan 17, 2025
fadf872
Test
zxl629 Jan 17, 2025
6bac295
Test
zxl629 Jan 17, 2025
965a09f
Test
zxl629 Jan 17, 2025
ac0808e
Test prod
zxl629 Jan 21, 2025
47c4908
Test prod + dev
zxl629 Jan 21, 2025
869e21c
Fail test
zxl629 Jan 21, 2025
633a1ab
Test
zxl629 Jan 21, 2025
04be5a3
Test
zxl629 Jan 21, 2025
2ccb90b
Test sample-staging
zxl629 Jan 21, 2025
fa1ea8d
Test sample-staging
zxl629 Jan 21, 2025
28d73af
Test exit code 4
zxl629 Jan 21, 2025
382494d
Test staging repo
zxl629 Jan 21, 2025
4a9fe2f
Test staging repo
zxl629 Jan 21, 2025
6cb2f25
Test exitinfos
zxl629 Jan 21, 2025
4630e4a
test exitinfos
zxl629 Jan 22, 2025
42c46f4
test success failure
zxl629 Jan 22, 2025
dca632d
concurrently version
zxl629 Jan 22, 2025
0e0927c
concurrently version
zxl629 Jan 22, 2025
ac56902
concurrently version
zxl629 Jan 22, 2025
745e442
Change url
zxl629 Jan 22, 2025
9b0a013
Restore workflows
zxl629 Jan 22, 2025
93a327b
Clean up
zxl629 Jan 22, 2025
729a5e3
Update docs
zxl629 Jan 22, 2025
ea96082
Clean up
zxl629 Jan 22, 2025
cb4b29b
Clean up
zxl629 Jan 22, 2025
6d945d1
Sample test run
zxl629 Jan 22, 2025
dd395dc
Clean up
zxl629 Jan 22, 2025
2ecf191
Merge branch 'main' into lzhouq/feat/webpack
zxl629 Jan 22, 2025
618913e
test chmod
zxl629 Jan 22, 2025
e98525c
test chmod
zxl629 Jan 22, 2025
783ab4a
test shell
zxl629 Jan 23, 2025
fb5277b
Fix test file path
zxl629 Jan 23, 2025
32a07b8
Fix test file path
zxl629 Jan 23, 2025
1ae4346
Test fail
zxl629 Jan 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/chilly-snails-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
4 changes: 4 additions & 0 deletions .github/integ-config/local-integ-all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tests:
- test_name: webpack_e2e_test
desc: 'Webpack 5'
framework: webpack
58 changes: 58 additions & 0 deletions .github/workflows/callable-local-e2e-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: E2E Test
run-name: e2e.${{ inputs.test_name }}

on:
workflow_call:
inputs:
test_name:
required: true
type: string
framework:
required: true
type: string
timeout_minutes:
required: true
type: number
retry_count:
required: true
type: number

jobs:
e2e-test:
name: E2E ${{ inputs.test_name }}
runs-on: ubuntu-latest
timeout-minutes: ${{ inputs.timeout_minutes }}

steps:
- name: Checkout repository
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 https://github.com/actions/checkout/commit/24cb9080177205b6e8c946b17badbe402adc938f
with:
path: amplify-data
- name: Setup node and build the repository
uses: ./amplify-data/.github/actions/node-and-build
- name: Make script executable
run: chmod +x ./amplify-data/scripts/retry-npm-script.sh ./amplify-data/scripts/bundler_test.sh
- name: Run e2e tests for ${{ inputs.test_name }} dev
shell: bash
working-directory: ./amplify-data
env:
E2E_FRAMEWORK: ${{ inputs.framework }}
E2E_RETRY_COUNT: ${{ inputs.retry_count }}
E2E_TEST_NAME: ${{ inputs.test_name }}
run: |
../amplify-data/scripts/retry-npm-script.sh -s \
"e2e-shell:test" \
-n $E2E_RETRY_COUNT
# - name: Run e2e tests for ${{ inputs.test_name }} prod
# shell: bash
# working-directory: ./amplify-data
# env:
# E2E_FRAMEWORK: ${{ inputs.framework }}
# E2E_RETRY_COUNT: ${{ inputs.retry_count }}
# E2E_TEST_NAME: ${{ inputs.test_name }}
# run: |
# ../amplify-data/scripts/retry-npm-script.sh -s \
# "ci:test \
# $E2E_FRAMEWORK \
# prod" \
# -n $E2E_RETRY_COUNT
64 changes: 48 additions & 16 deletions .github/workflows/callable-local-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,58 @@ name: Local E2E Tests
on: workflow_call

jobs:
unit_test:
name: Local E2E Tests
runs-on: ubuntu-latest
# unit_test:
# name: Local E2E Tests
# runs-on: ubuntu-latest

# steps:
# - name: Checkout repository
# uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 https://github.com/actions/checkout/commit/24cb9080177205b6e8c946b17badbe402adc938f
# with:
# path: amplify-data
# - name: Setup node and build the repository
# uses: ./amplify-data/.github/actions/node-and-build
# - name: Write Amplify outputs
# working-directory: ./amplify-data
# env:
# AMPLIFY_OUTPUTS_BASE64: ${{ secrets.E2E_NODE_AMPLIFY_OUTPUTS_BASE64 }}
# run: |
# echo $AMPLIFY_OUTPUTS_BASE64 | base64 --decode > ./packages/e2e-tests/node/amplify_outputs.json
# - name: Install Node Sample Dependencies
# working-directory: ./amplify-data
# run: npm run e2e-node:install
# - name: Run tests
# working-directory: ./amplify-data
# run: npm run e2e-node:test

e2e-prep:
name: Get E2E test config
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 https://github.com/actions/checkout/commit/24cb9080177205b6e8c946b17badbe402adc938f
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: amplify-data
- name: Setup node and build the repository
uses: ./amplify-data/.github/actions/node-and-build
- name: Write Amplify outputs
working-directory: ./amplify-data
env:
AMPLIFY_OUTPUTS_BASE64: ${{ secrets.E2E_NODE_AMPLIFY_OUTPUTS_BASE64 }}
- name: Read integ config files
id: load_config
run: |
echo $AMPLIFY_OUTPUTS_BASE64 | base64 --decode > ./packages/e2e-tests/node/amplify_outputs.json
- name: Install Node Sample Dependencies
echo "INTEG_CONFIG=$(cat .github/integ-config/local-integ-all.yml | yq '.tests' -o=json | jq -c .)" >> $GITHUB_OUTPUT
working-directory: ./amplify-data
run: npm run e2e-node:install
- name: Run tests
working-directory: ./amplify-data
run: npm run e2e-node:test
outputs:
integ-config: ${{ steps.load_config.outputs.INTEG_CONFIG }}


e2e-test-runner:
name: E2E test runnner
needs: e2e-prep
secrets: inherit
strategy:
matrix:
integ-config: ${{ fromJson(needs.e2e-prep.outputs.integ-config) }}
fail-fast: false
uses: ./.github/workflows/callable-local-e2e-test.yml
with:
test_name: ${{ matrix.integ-config.test_name }}
framework: ${{ matrix.integ-config.framework }}
timeout_minutes: ${{ matrix.integ-config.timeout_minutes || 35 }}
retry_count: ${{ matrix.integ-config.retry_count || 3 }}
16 changes: 8 additions & 8 deletions .github/workflows/callable-npm-publish-preid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ jobs:
- name: Setup node and build the repository
uses: ./amplify-data/.github/actions/node-and-build

- name: Run npm publish
uses: ./amplify-data/.github/actions/npm-publish
with:
target: preid
preid: ${{ inputs.preid }}
npm_token: ${{ secrets.NPM_TOKEN }}
github_user: ${{ vars.GH_USER}}
github_email: ${{ vars.GH_EMAIL}}
# - name: Run npm publish
# uses: ./amplify-data/.github/actions/npm-publish
# with:
# target: preid
# preid: ${{ inputs.preid }}
# npm_token: ${{ secrets.NPM_TOKEN }}
# github_user: ${{ vars.GH_USER}}
# github_email: ${{ vars.GH_EMAIL}}
48 changes: 24 additions & 24 deletions .github/workflows/callable-npm-publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@ jobs:
- name: Setup node and build the repository
uses: ./amplify-data/.github/actions/node-and-build

- name: Run npm publish
uses: ./amplify-data/.github/actions/npm-publish
with:
target: release
npm_token: ${{ secrets.NPM_TOKEN }}
github_user: ${{ vars.GH_USER}}
github_email: ${{ vars.GH_EMAIL}}
# - name: Run npm publish
# uses: ./amplify-data/.github/actions/npm-publish
# with:
# target: release
# npm_token: ${{ secrets.NPM_TOKEN }}
# github_user: ${{ vars.GH_USER}}
# github_email: ${{ vars.GH_EMAIL}}

- name: Set github commit user
env:
GITHUB_EMAIL: ${{ vars.GH_EMAIL }}
GITHUB_USER: ${{ vars.GH_USER }}
run: |
git config --global user.email $GITHUB_EMAIL
git config --global user.name $GITHUB_USER
# - name: Set github commit user
# env:
# GITHUB_EMAIL: ${{ vars.GH_EMAIL }}
# GITHUB_USER: ${{ vars.GH_USER }}
# run: |
# git config --global user.email $GITHUB_EMAIL
# git config --global user.name $GITHUB_USER

- name: Update lockfile with newly published version
working-directory: ./amplify-data
run: npm i
# - name: Update lockfile with newly published version
# working-directory: ./amplify-data
# run: npm i

- name: Commit version and changelog
working-directory: ./amplify-data
run: |
git add .
git commit -m "release: publish [ci skip]"
git push origin main
git push --follow-tags
# - name: Commit version and changelog
# working-directory: ./amplify-data
# run: |
# git add .
# git commit -m "release: publish [ci skip]"
# git push origin main
# git push --follow-tags
26 changes: 13 additions & 13 deletions .github/workflows/callable-release-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ jobs:
uses: ./.github/workflows/callable-prebuild-amplify-data.yml
with:
runs_on: ubuntu-latest
prebuild-samples-staging:
secrets: inherit
uses: ./.github/workflows/callable-prebuild-samples-staging.yml
unit-tests:
needs:
- prebuild-ubuntu
uses: ./.github/workflows/callable-unit-tests.yml
# prebuild-samples-staging:
# secrets: inherit
# uses: ./.github/workflows/callable-prebuild-samples-staging.yml
# unit-tests:
# needs:
# - prebuild-ubuntu
# uses: ./.github/workflows/callable-unit-tests.yml
local-e2e:
needs:
- prebuild-ubuntu
secrets: inherit
uses: ./.github/workflows/callable-local-e2e-tests.yml
e2e:
needs:
- prebuild-ubuntu
- prebuild-samples-staging
secrets: inherit
uses: ./.github/workflows/callable-e2e-tests.yml
# e2e:
# needs:
# - prebuild-ubuntu
# - prebuild-samples-staging
# secrets: inherit
# uses: ./.github/workflows/callable-e2e-tests.yml
63 changes: 32 additions & 31 deletions .github/workflows/push-main-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,50 +14,51 @@ on:
# Must disable publishing to NPM prior to adding this branch to avoid
# accidentally publishing changes.
- main
- lzhouq/feat/webpack

jobs:
prebuild-ubuntu:
uses: ./.github/workflows/callable-prebuild-amplify-data.yml
with:
runs_on: ubuntu-latest
# prebuild-ubuntu:
# uses: ./.github/workflows/callable-prebuild-amplify-data.yml
# with:
# runs_on: ubuntu-latest
# This step is included at the top level as a workround (i.e. not in a
# nested workflow). See: https://github.com/orgs/community/discussions/76409.
# The `configure-aws-credentials` GH Action is unable to retrieve the JWT
# token when run from a nested workflow.
# TODO: Find a workaround or alternative so that this can be included in a
# nested workflow (e.g. `callable-sandbox-e2e-tests.yml`).
sandbox_test:
name: Sandbox E2E Tests
needs: prebuild-ubuntu
runs-on: ubuntu-latest
permissions:
# these permissions are required for the `configure-aws-credentials` action to get a JWT:
id-token: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 https://github.com/actions/checkout/commit/24cb9080177205b6e8c946b17badbe402adc938f
with:
path: amplify-data
- name: Setup node and build the repository
uses: ./amplify-data/.github/actions/node-and-build
- name: Configure AWS test execution credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # version 4.0.2
with:
role-to-assume: ${{ secrets.SANDBOX_E2E_RUNNER_ROLE_ARN }}
aws-region: us-west-2
- name: Install Sandbox E2E Dependencies
working-directory: ./amplify-data
run: npm run e2e-sandbox:install
- name: Run E2E sandbox tests
working-directory: ./amplify-data
run: npm run e2e-sandbox:test
# sandbox_test:
# name: Sandbox E2E Tests
# needs: prebuild-ubuntu
# runs-on: ubuntu-latest
# permissions:
# # these permissions are required for the `configure-aws-credentials` action to get a JWT:
# id-token: write
# contents: read
# steps:
# - name: Checkout repository
# uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 https://github.com/actions/checkout/commit/24cb9080177205b6e8c946b17badbe402adc938f
# with:
# path: amplify-data
# - name: Setup node and build the repository
# uses: ./amplify-data/.github/actions/node-and-build
# - name: Configure AWS test execution credentials
# uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # version 4.0.2
# with:
# role-to-assume: ${{ secrets.SANDBOX_E2E_RUNNER_ROLE_ARN }}
# aws-region: us-west-2
# - name: Install Sandbox E2E Dependencies
# working-directory: ./amplify-data
# run: npm run e2e-sandbox:install
# - name: Run E2E sandbox tests
# working-directory: ./amplify-data
# run: npm run e2e-sandbox:test
release-verification-testing:
secrets: inherit
uses: ./.github/workflows/callable-release-verification.yml
release:
needs:
- release-verification-testing
- sandbox_test
# - sandbox_test
secrets: inherit
uses: ./.github/workflows/callable-npm-publish-release.yml
2 changes: 1 addition & 1 deletion e2e-TEST-COVERAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The following table outlines the current e2e test coverage for various runtimes
|---------------------|-----------|
| Chrome | [✅](.github/workflows/callable-e2e-test.yml) |
| Node | [✅](packages/e2e-tests/node/jest.config.ts) |
| Webpack | ⚠️ |
| Webpack | [✅](packages/e2e-tests/webpack/webpack.config.js) |
| Rollup | ⚠️ |
| Metro | ⚠️ |
| React Natives | ⚠️ |
Expand Down
Loading
Loading