Skip to content

chore(react): update tests for disabled Fieldset (#4389) #4554

chore(react): update tests for disabled Fieldset (#4389)

chore(react): update tests for disabled Fieldset (#4389) #4554

Workflow file for this run

# Description: This workflow runs unit + e2e tests, then publishes UI packages
# to `@next` NPM tag.
#
# Triggered by: merge to `main`
name: Test and Publish / next
concurrency:
group: e2e-${{ github.sha }}
cancel-in-progress: true
on:
push:
branches: [main]
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
setup-cache:
uses: aws-amplify/amplify-ui/.github/workflows/reusable-setup-cache.yml@main
with:
commit: ${{ github.sha }}
repository: ${{ github.repository }}
unit:
uses: aws-amplify/amplify-ui/.github/workflows/reusable-unit.yml@main
needs: setup-cache
with:
commit: ${{ github.sha }}
repository: ${{ github.repository }}
e2e:
uses: aws-amplify/amplify-ui/.github/workflows/reusable-e2e.yml@main
needs: unit
with:
commit: ${{ github.sha }}
repository: ${{ github.repository }}
skip-changed-packages-check: 'true' # always run e2e tests for native platform on main
secrets:
AUTH_E2E_ROLE_ARN: ${{ secrets.AUTH_E2E_ROLE_ARN }}
DATASTORE_E2E_ROLE_ARN: ${{ secrets.DATASTORE_E2E_ROLE_ARN }}
GEO_E2E_ROLE_ARN: ${{ secrets.GEO_E2E_ROLE_ARN }}
STORAGE_E2E_ROLE_ARN: ${{ secrets.STORAGE_E2E_ROLE_ARN }}
LIVENESS_E2E_ROLE_ARN: ${{ secrets.LIVENESS_E2E_ROLE_ARN }}
IN_APP_MESSAGING_E2E_ROLE_ARN: ${{ secrets.IN_APP_MESSAGING_E2E_ROLE_ARN }}
DOMAIN: ${{ secrets.DOMAIN }}
PHONE_NUMBER: ${{ secrets.PHONE_NUMBER }}
USERNAME: ${{ secrets.USERNAME }}
NEW_PASSWORD: ${{ secrets.NEW_PASSWORD }}
VALID_PASSWORD: ${{ secrets.VALID_PASSWORD }}
SITE_URL: ${{ secrets.SITE_URL }}
DOCSEARCH_DOCS_APP_ID: ${{ secrets.DOCSEARCH_DOCS_APP_ID }}
DOCSEARCH_DOCS_API_KEY: ${{ secrets.DOCSEARCH_DOCS_API_KEY }}
DOCSEARCH_DOCS_INDEX_NAME: ${{ secrets.DOCSEARCH_DOCS_INDEX_NAME }}
guides:
runs-on: ubuntu-latest
environment: ci
env:
NODE_ENV: test
strategy:
fail-fast: false
matrix:
include:
- path: ./guides/react/protected-routes
tags: '@guides and not @todo-guides'
steps:
- name: Checkout Amplify UI
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 https://github.com/actions/checkout/commit/24cb9080177205b6e8c946b17badbe402adc938f
with:
persist-credentials: false
- name: Setup Node.js 16
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 https://github.com/actions/setup-node/commit/64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
with:
node-version: 16
cache: 'yarn'
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
- name: Restore cypress runner Cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 https://github.com/actions/cache/commit/88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
id: restore-cypress-cache
with:
path: ~/.cache/Cypress
key: ${{ runner.os }}-cypress-${{ hashFiles('yarn.lock') }}
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
- name: Install packages
run: yarn install
- name: Add Amplify CLI
run: yarn global add @aws-amplify/cli
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef # v2.0.0 https://github.com/aws-actions/configure-aws-credentials/commit/e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef
with:
aws-region: us-east-2
role-to-assume: ${{ secrets.AUTH_E2E_ROLE_ARN }}
# Amplify CLI does not support headless pull with temporary credentials
# when useProfile is false.
# See: https://github.com/aws-amplify/amplify-cli/issues/11009.
- name: Create temp AWS profile
run: |
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID && \
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY && \
aws configure set aws_session_token $AWS_SESSION_TOKEN && \
aws configure set default.region $AWS_REGION
- name: Pull down AWS environments
run: yarn environments auth pull:email
- name: Delete AWS Profile
run: rm -rf ~/.aws
- name: Install guides
run: yarn install
working-directory: ${{ matrix.path }}
- name: Build guides
run: yarn build
working-directory: ${{ matrix.path }}
- name: Start guides site
run: yarn start & npx wait-on -c waitOnConfig.json -t 20000 http-get://localhost:3000
working-directory: ${{ matrix.path }}
- name: Run E2E tests against guides
run: yarn e2e test:guides
id: e2e
env:
# Override on the default value in `cypress.json` with framework-specific tag
TAGS: '${{ matrix.tags }}'
# Env values for testing flows
DOMAIN: ${{ secrets.DOMAIN }}
PHONE_NUMBER: ${{ secrets.PHONE_NUMBER }}
USERNAME: ${{ secrets.USERNAME }}
NEW_PASSWORD: ${{ secrets.NEW_PASSWORD }}
VALID_PASSWORD: ${{ secrets.VALID_PASSWORD }}
- name: Upload videos and screenshots
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 https://github.com/actions/upload-artifact/commit/0b7f8abb1508181956e8e162db84b466c27e18ce
if: ${{ failure() && steps.e2e.outcome != 'success' }}
with:
name: guides-cypress-error
path: |
packages/e2e/cypress/videos/**
packages/e2e/cypress/screenshots/**
retention-days: 5
publish:
needs: [e2e, guides]
uses: aws-amplify/amplify-ui/.github/workflows/reusable-tagged-publish.yml@main
with:
dist-tag: next
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
deploy-sample-app:
runs-on: ubuntu-latest
environment: deployment
needs: publish
steps:
- name: Trigger build for beta liveness sample app pointing at next tag
run: curl -X POST -d {} $ENDPOINT -H "Content-Type:application/json"
env:
ENDPOINT: ${{ secrets.LIVENESS_BETA_SAMPLE_APP_BUILD_TRIGGER }}
build-test:
needs: publish
runs-on: ubuntu-latest
environment: ci
steps:
- name: Checkout repo
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 https://github.com/actions/checkout/commit/24cb9080177205b6e8c946b17badbe402adc938f
- name: Setup Node.js 16
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 https://github.com/actions/setup-node/commit/64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
with:
node-version: 16
cache: 'yarn'
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
- name: Add Amplify CLI
run: yarn global add @aws-amplify/cli
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef # v2.0.0 https://github.com/aws-actions/configure-aws-credentials/commit/e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef
with:
aws-region: us-east-2
role-to-assume: ${{ secrets.AUTH_E2E_ROLE_ARN }}
# Amplify CLI does not support headless pull with temporary credentials
# when useProfile is false.
# See: https://github.com/aws-amplify/amplify-cli/issues/11009.
- name: Create temp AWS profile
run: |
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID && \
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY && \
aws configure set aws_session_token $AWS_SESSION_TOKEN && \
aws configure set default.region $AWS_REGION
- name: Pull down AWS environments
run: yarn pull
working-directory: ./canary
- name: Delete AWS Profile
run: rm -rf ~/.aws
- name: Setup canary apps against @next
run: yarn setup:next
working-directory: ./canary
- name: Run yarn install on each sample app
run: yarn install
working-directory: ./canary
- name: Run yarn build on each sample app
run: yarn build
working-directory: ./canary
log-failure-metric:
# Send a failure data point to metric PublishNextFailure in github-workflows@ us-east-2, if it's a failure
runs-on: ubuntu-latest
environment: ci
needs: build-test
if: ${{ failure() }}
steps:
- name: Log failure data point to metric PublishNextFailure
uses: aws-amplify/amplify-ui/.github/actions/log-metric@main
with:
metric-name: PublishNextFailure
value: 1
role-to-assume: ${{ secrets.METRIC_LOGGER_ROLE_ARN }}
aws-region: us-east-2
log-success-metric:
# Send a success data point to metric PublishNextFailure in github-workflows@ us-east-2, if it's a success
runs-on: ubuntu-latest
environment: ci
needs: build-test
if: ${{ success() }}
steps:
- name: Log success data point to metric PublishNextFailure
uses: aws-amplify/amplify-ui/.github/actions/log-metric@main
with:
metric-name: PublishNextFailure
value: 0
role-to-assume: ${{ secrets.METRIC_LOGGER_ROLE_ARN }}
aws-region: us-east-2