From 4809a1aab17546d24938f13cd3f187207644e945 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Fri, 10 Dec 2021 22:04:05 +0800 Subject: [PATCH] chore: add NPM and PNPM to E2E tests (#6080) * chore: add NPM and PNPM to E2E tests * Align node versions * Install PNPM * Fix options Maybe fix Fix --- .github/workflows/tests-e2e.yml | 73 +++++++++++++++++++++++++++++++-- admin/scripts/test-release.sh | 6 +-- 2 files changed, 73 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests-e2e.yml b/.github/workflows/tests-e2e.yml index ddd86aa0f822..72a50be207e4 100644 --- a/.github/workflows/tests-e2e.yml +++ b/.github/workflows/tests-e2e.yml @@ -55,14 +55,13 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: ['14'] nodeLinker: [pnp, node-modules] steps: - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node }} + - name: Use Node.js 16 uses: actions/setup-node@v2 with: - node-version: ${{ matrix.node }} + node-version: '16' cache: yarn - name: Installation run: yarn @@ -97,3 +96,71 @@ jobs: working-directory: ../test-website env: CI: true + + npm: + name: E2E — NPM + timeout-minutes: 30 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 16 + uses: actions/setup-node@v2 + with: + node-version: '16' + cache: yarn + - name: Installation + 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 + env: + npm_config_registry: http://localhost:4873 + - name: Start test-website project + run: npm run start -- --no-open + working-directory: ../test-website + env: + E2E_TEST: true + - name: Build test-website project + run: npm run build + working-directory: ../test-website + env: + CI: true + + pnpm: + name: E2E — PNPM + timeout-minutes: 30 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 16 + uses: actions/setup-node@v2 + with: + node-version: '16' + cache: yarn + - name: Installation + 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 + pnpm install + working-directory: ../test-website + env: + npm_config_registry: http://localhost:4873 + - name: Start test-website project + run: pnpm run start -- --no-open + working-directory: ../test-website + env: + E2E_TEST: true + - name: Build test-website project + run: pnpm run build + working-directory: ../test-website + env: + CI: true diff --git a/admin/scripts/test-release.sh b/admin/scripts/test-release.sh index ae689ca4dadd..57640225a54e 100755 --- a/admin/scripts/test-release.sh +++ b/admin/scripts/test-release.sh @@ -17,10 +17,10 @@ usage() { echo "Usage: $0 [-n] [-s]" 1>&2; exit 1; } while getopts ":ns" o; do case "${o}" in n) - EXTRA_OPTS="--use-npm" + EXTRA_OPTS="${EXTRA_OPTS} --use-npm" ;; s) - EXTRA_OPTS="--skip-install" + EXTRA_OPTS="${EXTRA_OPTS} --skip-install" ;; *) usage @@ -52,7 +52,7 @@ git diff --name-only -- '*.json' | sed 's, ,\\&,g' | xargs git checkout -- cd .. # Build skeleton website with new version -npm_config_registry="$CUSTOM_REGISTRY_URL" npm init docusaurus@"$NEW_VERSION" test-website classic $EXTRA_OPTS +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