Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/bright-clouds-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aws-amplify/integration-tests': patch
---

install, build, unit test, and e2e test using lts/iron & lts/hydrogen
5 changes: 4 additions & 1 deletion .github/actions/build_with_cache/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: build_with_cache
description: builds the source code if cache miss and caches the result
inputs:
node-version:
default: 18
runs:
using: composite
steps:
Expand All @@ -9,7 +12,7 @@ runs:
id: build-cache
with:
path: '**/lib'
key: ${{ github.sha }}
key: ${{ github.sha }}-node${{ inputs.node-version }}
enableCrossOsArchive: true
# only build if cache miss
- if: steps.build-cache.outputs.cache-hit != 'true'
Expand Down
5 changes: 4 additions & 1 deletion .github/actions/install_with_cache/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: install_with_cache
description: installs node_modules if cache miss and stores in the cache
inputs:
node-version:
default: 18
runs:
using: composite
steps:
Expand All @@ -10,7 +13,7 @@ runs:
path: |
node_modules
packages/**/node_modules
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}-v2
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}-node${{ inputs.node-version }}
# only install if cache miss
- if: steps.npm-cache.outputs.cache-hit != 'true'
shell: bash
Expand Down
6 changes: 5 additions & 1 deletion .github/actions/restore_build_cache/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: restore_build_cache
description: composes restoring node_modules and restoring build artifacts
inputs:
node-version:
description: node version used to configure environment with
default: 18
runs:
using: composite
steps:
Expand All @@ -9,6 +13,6 @@ runs:
id: build-cache
with:
path: '**/lib'
key: ${{ github.sha }}
key: ${{ github.sha }}-node${{ inputs.node-version }}
fail-on-cache-miss: true
enableCrossOsArchive: true
6 changes: 5 additions & 1 deletion .github/actions/restore_install_cache/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: restore_install_cache
description: restores node_modules from the cache and fails if no cache entry found
inputs:
node-version:
description: node version used to configure environment with
default: 18
runs:
using: composite
steps:
Expand All @@ -10,5 +14,5 @@ runs:
path: |
node_modules
packages/**/node_modules
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}-node${{ inputs.node-version }}
fail-on-cache-miss: true
6 changes: 5 additions & 1 deletion .github/actions/setup_node/action.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# basic setup that applies to most jobs
# checks out the repo and configures node
name: setup_node
inputs:
node-version:
description: node version used to configure environment with
default: 18
runs:
using: composite
steps:
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # version 3.8.1
with:
node-version: 18
node-version: ${{ inputs.node-version }}
cache: 'npm'
42 changes: 40 additions & 2 deletions .github/workflows/health_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,51 @@ jobs:
# creates file system links that include drive letter.
# Changing between standard and custom workers requires full install cache invalidation
os: [ubuntu-latest, macos-14, windows-latest]
node: [18, 20]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # version 3.6.0
- uses: ./.github/actions/setup_node
with:
node-version: ${{ matrix.node }}
- uses: ./.github/actions/install_with_cache
with:
node-version: ${{ matrix.node }}
build:
strategy:
matrix:
node: [18, 20]
runs-on: ubuntu-latest
needs:
- install
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # version 3.6.0
- uses: ./.github/actions/setup_node
with:
node-version: ${{ matrix.node }}
- uses: ./.github/actions/build_with_cache
with:
node-version: ${{ matrix.node }}
test_with_coverage:
needs:
- build
strategy:
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
node: [18, 20]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # version 3.6.0
- uses: ./.github/actions/setup_node
with:
node-version: ${{ matrix.node }}
- uses: ./.github/actions/install_with_cache
with:
node-version: ${{ matrix.node }}
- uses: ./.github/actions/restore_build_cache
with:
node-version: ${{ matrix.node }}
- run: npm run set-script-shell
- run: npm run test:coverage:threshold
test_scripts:
Expand Down Expand Up @@ -137,6 +157,13 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14-xlarge, windows-latest]
node-version: [18, 20]
# skip multiple node version test on other os
exclude:
- os: macos-14-xlarge
node-version: 20
- os: windows-latest
node-version: 20
runs-on: ${{ matrix.os }}
timeout-minutes: 25
needs:
Expand All @@ -149,6 +176,8 @@ jobs:
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # version 3.6.0
- uses: ./.github/actions/setup_node
with:
node-version: ${{ matrix.node-version }}
- uses: ./.github/actions/restore_build_cache
- run: cd packages/cli && npm link
- name: Configure test tooling credentials
Expand All @@ -171,6 +200,13 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
node-version: [18, 20]
# skip multiple node version test on other os
exclude:
- os: macos-14
node-version: 20
- os: windows-latest
node-version: 20
runs-on: ${{ matrix.os }}
timeout-minutes: ${{ matrix.os == 'windows-latest' && 35 || 25 }}
needs:
Expand All @@ -179,6 +215,8 @@ jobs:
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # version 3.6.0
- uses: ./.github/actions/setup_node
with:
node-version: ${{ matrix.node-version }}
- uses: ./.github/actions/restore_build_cache
- run: cd packages/cli && npm link
- name: Run e2e create-amplify tests
Expand All @@ -191,7 +229,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
pkg-manager: [npm, yarn-classic, yarn-modern, pnpm]
node-version: [20]
node-version: ['20']
env:
PACKAGE_MANAGER: ${{ matrix.pkg-manager }}
runs-on: ${{ matrix.os }}
Expand All @@ -207,7 +245,7 @@ jobs:
- name: Checkout aws-amplify/amplify-cli repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Node.js
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # version 3.8.1
uses: ./.github/actions/setup_node
with:
node-version: ${{ matrix.node-version }}
- name: Restore Build Cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,18 @@ import crypto from 'node:crypto';
import { gql } from 'graphql-tag';
import { IamCredentials } from '../types.js';
import { AmplifyAuthCredentialsFactory } from '../amplify_auth_credentials_factory.js';
import { SemVer } from 'semver';

// TODO: this is a work around
// it seems like as of amplify v6 , some of the code only runs in the browser ...
// see https://github.com/aws-amplify/amplify-js/issues/12751
// @ts-expect-error altering typing for global to make compiler happy is not worth the effort assuming this is temporary workaround
globalThis.crypto = crypto;
if (process.versions.node) {
// node >= 20 now exposes crypto by default. This workaround is not needed: https://github.com/nodejs/node/pull/42083
if (new SemVer(process.versions.node).major < 20) {
// @ts-expect-error altering typing for global to make compiler happy is not worth the effort assuming this is temporary workaround
globalThis.crypto = crypto;
}
}

/**
* Creates access testing projects with typescript idioms.
Expand Down