From 0dd388fb314d4b3d321ff57c206d0808a58843c8 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Sat, 26 Feb 2022 13:40:16 +0800 Subject: [PATCH 1/6] test: add TypeScript template to E2E test --- .github/workflows/tests-e2e.yml | 12 ++++++++++-- admin/scripts/test-release.sh | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-e2e.yml b/.github/workflows/tests-e2e.yml index f6c70b034c34..aa28a5782759 100644 --- a/.github/workflows/tests-e2e.yml +++ b/.github/workflows/tests-e2e.yml @@ -54,6 +54,11 @@ jobs: strategy: matrix: nodeLinker: [pnp, node-modules] + variant: + - name: JS + option: -s + - name: TS + option: -s -t steps: - uses: actions/checkout@v2 - name: Use Node.js 16 @@ -63,8 +68,8 @@ jobs: cache: yarn - name: Installation run: yarn - - name: Generate test-website project against main branch - run: yarn test:build:website -s + - name: Generate test-website project in ${{ matrix.variant.name }} against main branch + run: yarn test:build:website ${{ matrix.variant.option }} env: KEEP_CONTAINER: true - name: Install test-website project with Yarn Berry and nodeLinker = ${{ matrix.nodeLinker }} @@ -92,6 +97,9 @@ jobs: working-directory: ../test-website env: E2E_TEST: true + - name: Type check + if: matrix.variant.name == 'TS' + run: yarn typecheck - name: Build test-website project run: yarn build working-directory: ../test-website diff --git a/admin/scripts/test-release.sh b/admin/scripts/test-release.sh index 2ecda2a3e51b..17abb68b22f4 100755 --- a/admin/scripts/test-release.sh +++ b/admin/scripts/test-release.sh @@ -19,6 +19,9 @@ while getopts ":ns" o; do s) EXTRA_OPTS="${EXTRA_OPTS} --skip-install" ;; + t) + EXTRA_OPTS="${EXTRA_OPTS} --typescript" + ;; *) usage ;; From 6ce8da7558e740dd746b8a92c6fc06950c7b16c9 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Sat, 26 Feb 2022 13:46:20 +0800 Subject: [PATCH 2/6] fix --- admin/scripts/test-release.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/scripts/test-release.sh b/admin/scripts/test-release.sh index 17abb68b22f4..2931b33ff087 100755 --- a/admin/scripts/test-release.sh +++ b/admin/scripts/test-release.sh @@ -12,9 +12,9 @@ NEW_VERSION="$(node -p "require('./packages/docusaurus/package.json').version"). CONTAINER_NAME="verdaccio" EXTRA_OPTS="" -usage() { echo "Usage: $0 [-s]" 1>&2; exit 1; } +usage() { echo "Usage: $0 [-s] [-t]" 1>&2; exit 1; } -while getopts ":ns" o; do +while getopts ":st" o; do case "${o}" in s) EXTRA_OPTS="${EXTRA_OPTS} --skip-install" From 5aa1f4cd41fc5a9b0bc94a0da092aa30162cbd44 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Sun, 27 Feb 2022 08:28:52 +0800 Subject: [PATCH 3/6] fix --- .github/workflows/tests-e2e.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests-e2e.yml b/.github/workflows/tests-e2e.yml index aa28a5782759..de585afcfede 100644 --- a/.github/workflows/tests-e2e.yml +++ b/.github/workflows/tests-e2e.yml @@ -70,6 +70,7 @@ jobs: run: yarn - name: Generate test-website project in ${{ matrix.variant.name }} against main branch run: yarn test:build:website ${{ matrix.variant.option }} + working-directory: ../test-website env: KEEP_CONTAINER: true - name: Install test-website project with Yarn Berry and nodeLinker = ${{ matrix.nodeLinker }} From 25e4c1d3c575fdc16fd598ef11ee99a2b079f276 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Sun, 27 Feb 2022 08:33:49 +0800 Subject: [PATCH 4/6] fix... --- .github/workflows/tests-e2e.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-e2e.yml b/.github/workflows/tests-e2e.yml index de585afcfede..b6d96efe2e6d 100644 --- a/.github/workflows/tests-e2e.yml +++ b/.github/workflows/tests-e2e.yml @@ -70,7 +70,6 @@ jobs: run: yarn - name: Generate test-website project in ${{ matrix.variant.name }} against main branch run: yarn test:build:website ${{ matrix.variant.option }} - working-directory: ../test-website env: KEEP_CONTAINER: true - name: Install test-website project with Yarn Berry and nodeLinker = ${{ matrix.nodeLinker }} @@ -101,6 +100,7 @@ jobs: - name: Type check if: matrix.variant.name == 'TS' run: yarn typecheck + working-directory: ../test-website - name: Build test-website project run: yarn build working-directory: ../test-website From f6345315d67e98adf28a8d75e9ce48007b4b7fbc Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Sun, 27 Feb 2022 08:48:26 +0800 Subject: [PATCH 5/6] exclude this --- .github/workflows/tests-e2e.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests-e2e.yml b/.github/workflows/tests-e2e.yml index b6d96efe2e6d..c03433df1137 100644 --- a/.github/workflows/tests-e2e.yml +++ b/.github/workflows/tests-e2e.yml @@ -54,11 +54,12 @@ jobs: strategy: matrix: nodeLinker: [pnp, node-modules] - variant: - - name: JS - option: -s - - name: TS - option: -s -t + variant: [-s, -st] + exclude: + # Running tsc on PnP requires additional installations, which is not + # worthwhile for a simple E2E test + - variant: -st + nodeLinker: pnp steps: - uses: actions/checkout@v2 - name: Use Node.js 16 @@ -68,8 +69,8 @@ jobs: cache: yarn - name: Installation run: yarn - - name: Generate test-website project in ${{ matrix.variant.name }} against main branch - run: yarn test:build:website ${{ matrix.variant.option }} + - name: Generate test-website project in ${{ matrix.variant }} against main branch + run: yarn test:build:website ${{ matrix.variant }} env: KEEP_CONTAINER: true - name: Install test-website project with Yarn Berry and nodeLinker = ${{ matrix.nodeLinker }} From 5f53639ac3c1783583686e50119514797429ae60 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Sun, 27 Feb 2022 09:00:12 +0800 Subject: [PATCH 6/6] refactor --- .github/workflows/tests-e2e.yml | 12 ++---------- admin/scripts/test-release.sh | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests-e2e.yml b/.github/workflows/tests-e2e.yml index c03433df1137..e30bb24d0637 100644 --- a/.github/workflows/tests-e2e.yml +++ b/.github/workflows/tests-e2e.yml @@ -31,8 +31,6 @@ jobs: run: yarn - name: Generate test-website project against main branch run: yarn test:build:website -s - env: - KEEP_CONTAINER: true - name: Install test-website project with Yarn v1 run: yarn install working-directory: ../test-website @@ -69,10 +67,8 @@ jobs: cache: yarn - name: Installation run: yarn - - name: Generate test-website project in ${{ matrix.variant }} against main branch + - name: Generate test-website project with ${{ matrix.variant }} against main branch run: yarn test:build:website ${{ matrix.variant }} - env: - KEEP_CONTAINER: true - name: Install test-website project with Yarn Berry and nodeLinker = ${{ matrix.nodeLinker }} run: | yarn set version berry @@ -99,7 +95,7 @@ jobs: env: E2E_TEST: true - name: Type check - if: matrix.variant.name == 'TS' + if: matrix.variant == '-st' run: yarn typecheck working-directory: ../test-website - name: Build test-website project @@ -121,8 +117,6 @@ jobs: run: yarn - name: Generate test-website project against main branch run: yarn test:build:website -s - env: - KEEP_CONTAINER: true - name: Install test-website project with NPM run: npm install working-directory: ../test-website @@ -152,8 +146,6 @@ jobs: run: yarn - name: Generate test-website project against main branch run: yarn test:build:website -s - env: - KEEP_CONTAINER: true - name: Install test-website project with PNPM run: | curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm diff --git a/admin/scripts/test-release.sh b/admin/scripts/test-release.sh index 2931b33ff087..1b968aca8660 100755 --- a/admin/scripts/test-release.sh +++ b/admin/scripts/test-release.sh @@ -55,7 +55,7 @@ cd .. npm_config_registry="$CUSTOM_REGISTRY_URL" npx create-docusaurus@"$NEW_VERSION" test-website classic $EXTRA_OPTS # Stop Docker container -if [[ -z "${KEEP_CONTAINER:-}" ]] && ( $(docker container inspect "$CONTAINER_NAME" > /dev/null 2>&1) ); then +if [[ -z "${KEEP_CONTAINER:-true}" ]] && ( $(docker container inspect "$CONTAINER_NAME" > /dev/null 2>&1) ); then # Remove Docker container docker container stop $CONTAINER_NAME > /dev/null fi