test: add TypeScript template to E2E test matrix (#6768)

* test: add TypeScript template to E2E test

* fix

* fix

* fix...

* exclude this

* refactor
This commit is contained in:
Joshua Chen 2022-02-27 09:20:59 +08:00 committed by GitHub
parent 68a55f0d11
commit bafa4711b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 13 deletions

View file

@ -31,8 +31,6 @@ jobs:
run: yarn run: yarn
- name: Generate test-website project against main branch - name: Generate test-website project against main branch
run: yarn test:build:website -s run: yarn test:build:website -s
env:
KEEP_CONTAINER: true
- name: Install test-website project with Yarn v1 - name: Install test-website project with Yarn v1
run: yarn install run: yarn install
working-directory: ../test-website working-directory: ../test-website
@ -54,6 +52,12 @@ jobs:
strategy: strategy:
matrix: matrix:
nodeLinker: [pnp, node-modules] nodeLinker: [pnp, node-modules]
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: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Use Node.js 16 - name: Use Node.js 16
@ -63,10 +67,8 @@ jobs:
cache: yarn cache: yarn
- name: Installation - name: Installation
run: yarn run: yarn
- name: Generate test-website project against main branch - name: Generate test-website project with ${{ matrix.variant }} against main branch
run: yarn test:build:website -s run: yarn test:build:website ${{ matrix.variant }}
env:
KEEP_CONTAINER: true
- name: Install test-website project with Yarn Berry and nodeLinker = ${{ matrix.nodeLinker }} - name: Install test-website project with Yarn Berry and nodeLinker = ${{ matrix.nodeLinker }}
run: | run: |
yarn set version berry yarn set version berry
@ -92,6 +94,10 @@ jobs:
working-directory: ../test-website working-directory: ../test-website
env: env:
E2E_TEST: true E2E_TEST: true
- name: Type check
if: matrix.variant == '-st'
run: yarn typecheck
working-directory: ../test-website
- name: Build test-website project - name: Build test-website project
run: yarn build run: yarn build
working-directory: ../test-website working-directory: ../test-website
@ -111,8 +117,6 @@ jobs:
run: yarn run: yarn
- name: Generate test-website project against main branch - name: Generate test-website project against main branch
run: yarn test:build:website -s run: yarn test:build:website -s
env:
KEEP_CONTAINER: true
- name: Install test-website project with NPM - name: Install test-website project with NPM
run: npm install run: npm install
working-directory: ../test-website working-directory: ../test-website
@ -142,8 +146,6 @@ jobs:
run: yarn run: yarn
- name: Generate test-website project against main branch - name: Generate test-website project against main branch
run: yarn test:build:website -s run: yarn test:build:website -s
env:
KEEP_CONTAINER: true
- name: Install test-website project with PNPM - name: Install test-website project with PNPM
run: | run: |
curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm

View file

@ -12,13 +12,16 @@ NEW_VERSION="$(node -p "require('./packages/docusaurus/package.json').version").
CONTAINER_NAME="verdaccio" CONTAINER_NAME="verdaccio"
EXTRA_OPTS="" 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 case "${o}" in
s) s)
EXTRA_OPTS="${EXTRA_OPTS} --skip-install" EXTRA_OPTS="${EXTRA_OPTS} --skip-install"
;; ;;
t)
EXTRA_OPTS="${EXTRA_OPTS} --typescript"
;;
*) *)
usage usage
;; ;;
@ -52,7 +55,7 @@ cd ..
npm_config_registry="$CUSTOM_REGISTRY_URL" npx create-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 # 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 # Remove Docker container
docker container stop $CONTAINER_NAME > /dev/null docker container stop $CONTAINER_NAME > /dev/null
fi fi