Skip to content

Commit

Permalink
feat: init e2e test workflow for Package Manager Support (#533)
Browse files Browse the repository at this point in the history
* test: init e2e flow test

* fix GH hash

* use dynamic pkg manager

* setup nodejs with npm

* setup more pkg managers

* install pkg managers

* fix yarn1 and change step name

* fix yarn1

* fix yarn1

* split yarn1 into 2 steps

* fix yarn1

* fix yarn1 win

* exclude bun on windows

* yarn1 windows

* setup yarn3

* yarn3

* yarn3 yarnPath

* yarn use 3rd party action

* try yarn3

* set yarn 3.6.x

* set yarn berry

* set yarn stable and pass --yes

* feat: add env ci support

* test: update unit tests

* feat: create amplify --yes option

* chore: remove un-used code

* feat: support Panage Manager env var

* chore: add comments

* chore: remove env.CI

* chore: update changeset

* chore: rename PACKAGE_MANAGER_EXECUTABLE

* fix: tests

* use Env Var PACKAGE_MANAGER_EXECUTABLE

* fix npm -> npx, remove bun

* fix npm -> npx

* change -- --yes

* chore: update package.lock

* chore: remove @Alpha

* fix: clean up yarn

* fix: change yarn1 to yarn

* chore: rename yarn step

* chore: use env

* fix: yarn-stable env var

* add comments

* chore: update sample app with new imports (#541)

* feat: use "use client"; directive in generated react components (#540)

* fix: flatten prop types auth (#534)

* fix: flatten auth login with types

* chore: update snapshots

* chore: update api

* chore: add changeset

* chore: add TODO

---------

Co-authored-by: Amplifiyer <[email protected]>
Co-authored-by: Spencer Stolworthy <[email protected]>
Co-authored-by: awsluja <[email protected]>
  • Loading branch information
4 people authored Oct 31, 2023
1 parent 3799a9c commit c7af239
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 4 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/poc-e2e-flow-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Description: This workflow mimic the flow of behaviors when user using Amplify CLI;

name: 'poc-e2e-flow-test'

on: # TODO: need to change the trigger
push:
branches:
- poc/e2e-test

jobs:
create-amplify-project:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
node-version: [18]
pkg-manager: [npm, yarn, yarn-stable, pnpm]
runs-on: ${{ matrix.os }}
env:
PACKAGE_MANAGER_EXECUTABLE: ${{ matrix.pkg-manager }} # TODO: remove PACKAGE_MANAGER_EXECUTABLE once CLI is able to getPackageManager().
steps:
- name: Checkout aws-amplify/amplify-cli repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1. TODO: try only fetch .github/workflow
- name: Setup Node.js
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 #4.0.0
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Local Publish create-amplify
shell: bash
run: npm run install:local && npm run build && npm run vend
- name: ${{matrix.pkg-manager}}-create-amplify-project
if: matrix.pkg-manager != 'yarn-stable'
shell: bash
run:
| # TODO: last step `create amplify` should be replaced by `run e2e`
mkdir -p /tmp/amplify-project; cd /tmp/amplify-project
npm install -g ${{matrix.pkg-manager}}
echo "$(${{matrix.pkg-manager}}) config set registry http://localhost:4873"
${{matrix.pkg-manager}} config set registry http://localhost:4873
echo "$(${{matrix.pkg-manager}}) config get registry"
${{matrix.pkg-manager}} config get registry
${{matrix.pkg-manager}} create amplify --yes

- name: yarn-stable-create-amplify-project
if: matrix.pkg-manager == 'yarn-stable'
shell: bash
run:
| # TODO: last step `create amplify` should be replaced by `run e2e`
mkdir -p /tmp/amplify-project; cd /tmp/amplify-project
corepack enable
echo "yarn set version stable"
yarn set version stable
echo "yarn version $(yarn --version)"
yarn config set unsafeHttpWhitelist localhost
yarn config set npmRegistryServer http://localhost:4873
PACKAGE_MANAGER_EXECUTABLE=yarn yarn create amplify --yes
12 changes: 8 additions & 4 deletions packages/create-amplify/src/tsconfig_initializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,14 @@ export class TsConfigInitializer {
}

try {
await this.execa(this.executableName, tscArgs, {
stdio: 'inherit',
cwd: this.projectRoot,
});
await this.execa(
this.executableName === 'npm' ? 'npx' : this.executableName,
tscArgs,
{
stdio: 'inherit',
cwd: this.projectRoot,
}
);
} catch {
throw new Error(
`\`${
Expand Down

0 comments on commit c7af239

Please sign in to comment.