diff --git a/.github/actions/install-cli/action.yml b/.github/actions/install-cli/action.yml index 1058a41bccd..05726839617 100644 --- a/.github/actions/install-cli/action.yml +++ b/.github/actions/install-cli/action.yml @@ -21,6 +21,9 @@ runs: if: runner.os == 'Windows' run: | npm install -g @aws-amplify/cli@${{ inputs.cli-version }} - $AMPLIFY_PATH=(Get-Command amplify).Path + # "where.exe" is used instead of "where" to disambiguate + # "where" is aliased to "Where-Object" in powershell, i.e. not pointing to the tool we want + # "amplify.cmd" is searched because "where.exe amplify" returns ambiguous list + $AMPLIFY_PATH=(where.exe amplify.cmd) echo "AMPLIFY_PATH=$AMPLIFY_PATH" "AMPLIFY_PATH=$AMPLIFY_PATH" >> $env:GITHUB_ENV diff --git a/.github/actions/run-smoke-tests-windows/README.md b/.github/actions/run-smoke-tests-windows/README.md deleted file mode 100644 index f8b99d44a78..00000000000 --- a/.github/actions/run-smoke-tests-windows/README.md +++ /dev/null @@ -1,2 +0,0 @@ -The Run Smoke Tests contains lightweight version of smoke tests for Windows. -GitHub Action's Windows workers are small and using our E2E testing framework for smoke testing overwhelms them. diff --git a/.github/actions/run-smoke-tests-windows/action.yml b/.github/actions/run-smoke-tests-windows/action.yml deleted file mode 100644 index 0eeaa9fcaad..00000000000 --- a/.github/actions/run-smoke-tests-windows/action.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Run Smoke Tests -description: Executes Smoke Tests -inputs: - role-to-assume: - description: an IAM role to use in tests - required: true - region: - description: an AWS region to run in - required: false - default: us-west-2 -runs: - using: 'composite' - steps: - - name: Verify Amplify Path - shell: bash - run: | - if [[ -z "$AMPLIFY_PATH" ]]; then - echo "AMPLIFY_PATH must be defined" - exit 1 - fi - echo "AMPLIFY_PATH=$AMPLIFY_PATH" - $AMPLIFY_PATH version - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@04b98b3f9e85f563fb061be8751a0352327246b0 # v3.0.1 - with: - role-to-assume: ${{ inputs.role-to-assume }} - aws-region: ${{ inputs.region }} - - - name: Install AWS CLI - shell: powershell - run: | - msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi /qn - aws --version - - - name: Configure Profile - shell: bash - run: | - aws configure set region ${{ inputs.region }} --profile default - aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID --profile default - aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY --profile default - aws configure set aws_session_token $AWS_SESSION_TOKEN --profile default - - - name: Run Smoke Tests - shell: bash - run: .github/actions/run-smoke-tests-windows/windows-smoke-tests.sh - - - name: Cleanup - shell: bash - if: always() - run: | - cd $AMPLIFY_PROJ_DIR - $AMPLIFY_PATH delete --force diff --git a/.github/actions/run-smoke-tests-windows/add_api_request.json b/.github/actions/run-smoke-tests-windows/add_api_request.json deleted file mode 100644 index 31bd0c3dd0f..00000000000 --- a/.github/actions/run-smoke-tests-windows/add_api_request.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": 1, - "serviceConfiguration": { - "serviceName": "AppSync", - "apiName": "myApiName", - "transformSchema": "type Todo @model { id: ID! content: String}", - "defaultAuthType": { "mode": "API_KEY" } - } -} diff --git a/.github/actions/run-smoke-tests-windows/add_auth_request.json b/.github/actions/run-smoke-tests-windows/add_auth_request.json deleted file mode 100644 index 847d7da074d..00000000000 --- a/.github/actions/run-smoke-tests-windows/add_auth_request.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": 2, - "resourceName": "myAuthResource", - "serviceConfiguration": { - "serviceName": "Cognito", - "includeIdentityPool": false, - "userPoolConfiguration": { "requiredSignupAttributes": ["EMAIL", "PHONE_NUMBER"], "signinMethod": "USERNAME" } - } -} diff --git a/.github/actions/run-smoke-tests-windows/windows-smoke-tests.sh b/.github/actions/run-smoke-tests-windows/windows-smoke-tests.sh deleted file mode 100755 index 00ca2eca044..00000000000 --- a/.github/actions/run-smoke-tests-windows/windows-smoke-tests.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -e - -$AMPLIFY_PATH version - -random_guid=$(powershell -Command "[guid]::NewGuid().ToString()") -random_guid=${random_guid//-/} -random_guid=${random_guid:0:6} -projDir="smoke-test-${random_guid}" -echo "AMPLIFY_PROJ_DIR=$projDir" >> $GITHUB_ENV - -# Read headless requests content. This must be done before we change directory to $projDir. -THIS_SCRIPT_PATH=$(dirname "${BASH_SOURCE[0]}") -ADD_AUTH_REQUEST=$(cat $THIS_SCRIPT_PATH/add_auth_request.json) -ADD_AUTH_REQUEST=${ADD_AUTH_REQUEST//[$'\r\n']} -ADD_API_REQUEST=$(cat $THIS_SCRIPT_PATH/add_api_request.json) -ADD_API_REQUEST=${ADD_API_REQUEST//[$'\r\n']} - -mkdir $projDir -cd $projDir - -$AMPLIFY_PATH init --yes - -$AMPLIFY_PATH status - -echo $ADD_AUTH_REQUEST -$AMPLIFY_PATH add auth --headless <<< $ADD_AUTH_REQUEST - -$AMPLIFY_PATH status - -$AMPLIFY_PATH push --yes - -$AMPLIFY_PATH status - -echo $ADD_API_REQUEST -$AMPLIFY_PATH add api --headless <<< $ADD_API_REQUEST - -$AMPLIFY_PATH status - -$AMPLIFY_PATH push --yes - -$AMPLIFY_PATH status diff --git a/.github/actions/run-smoke-tests/action.yml b/.github/actions/run-smoke-tests/action.yml index f86126c1d3f..a0cf759c974 100644 --- a/.github/actions/run-smoke-tests/action.yml +++ b/.github/actions/run-smoke-tests/action.yml @@ -21,6 +21,14 @@ runs: echo "AMPLIFY_PATH=$AMPLIFY_PATH" $AMPLIFY_PATH version + - name: Remove Pkg Fetch Checksum on Windows + shell: bash + if: runner.os == 'Windows' + run: | + cd scripts + yarn + yarn ts-node remove-pkg-fetch-checksum.ts + - name: Install Dependencies shell: bash run: yarn install --immutable diff --git a/.github/workflows/smoke-tests-manual.yml b/.github/workflows/smoke-tests-manual.yml index 0280df3e6d9..534a7d8b3f6 100644 --- a/.github/workflows/smoke-tests-manual.yml +++ b/.github/workflows/smoke-tests-manual.yml @@ -11,7 +11,7 @@ on: os: required: false type: string - default: '["macos-latest-xl", "ubuntu-latest", "windows-latest"]' + default: '["macos-latest-xl", "ubuntu-latest", "amplify-cli_windows-latest_8-core"]' versions: required: false type: string diff --git a/.github/workflows/smoke-tests.yml b/.github/workflows/smoke-tests.yml index 835311caa49..79ef4b4dde6 100644 --- a/.github/workflows/smoke-tests.yml +++ b/.github/workflows/smoke-tests.yml @@ -11,7 +11,7 @@ on: os: required: false type: string - default: '["macos-latest-xl", "ubuntu-latest", "windows-latest"]' + default: '["macos-latest-xl", "ubuntu-latest", "amplify-cli_windows-latest_8-core"]' versions: required: false type: string @@ -40,14 +40,7 @@ jobs: with: cli-version: ${{ matrix.cli-version }} - - name: Run Smoke Tests Unix - if: runner.os != 'Windows' + - name: Run Smoke Tests uses: ./.github/actions/run-smoke-tests with: role-to-assume: ${{ secrets.SMOKE_TESTS_ROLE_ARN }} - - - name: Run Smoke Tests Windows - if: runner.os == 'Windows' - uses: ./.github/actions/run-smoke-tests-windows - with: - role-to-assume: ${{ secrets.SMOKE_TESTS_ROLE_ARN }} diff --git a/packages/amplify-e2e-core/src/utils/nexpect.ts b/packages/amplify-e2e-core/src/utils/nexpect.ts index b23fb505b58..1071f556723 100644 --- a/packages/amplify-e2e-core/src/utils/nexpect.ts +++ b/packages/amplify-e2e-core/src/utils/nexpect.ts @@ -737,7 +737,7 @@ export function nspawn(command: string | string[], params: string[] = [], option } const testingWithLatestCodebase = isTestingWithLatestCodebase(command); - if (testingWithLatestCodebase || (process.platform === 'win32' && !command.endsWith('.exe'))) { + if (testingWithLatestCodebase || (process.platform === 'win32' && !(command.endsWith('.exe') || command.endsWith('.cmd')))) { params.unshift(command); command = getScriptRunnerPath(testingWithLatestCodebase); }