mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 02:08:36 +02:00
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
This commit is contained in:
parent
991c1b2832
commit
4809a1aab1
2 changed files with 73 additions and 6 deletions
73
.github/workflows/tests-e2e.yml
vendored
73
.github/workflows/tests-e2e.yml
vendored
|
@ -55,14 +55,13 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node: ['14']
|
|
||||||
nodeLinker: [pnp, node-modules]
|
nodeLinker: [pnp, node-modules]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Use Node.js ${{ matrix.node }}
|
- name: Use Node.js 16
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node }}
|
node-version: '16'
|
||||||
cache: yarn
|
cache: yarn
|
||||||
- name: Installation
|
- name: Installation
|
||||||
run: yarn
|
run: yarn
|
||||||
|
@ -97,3 +96,71 @@ jobs:
|
||||||
working-directory: ../test-website
|
working-directory: ../test-website
|
||||||
env:
|
env:
|
||||||
CI: true
|
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
|
||||||
|
|
|
@ -17,10 +17,10 @@ usage() { echo "Usage: $0 [-n] [-s]" 1>&2; exit 1; }
|
||||||
while getopts ":ns" o; do
|
while getopts ":ns" o; do
|
||||||
case "${o}" in
|
case "${o}" in
|
||||||
n)
|
n)
|
||||||
EXTRA_OPTS="--use-npm"
|
EXTRA_OPTS="${EXTRA_OPTS} --use-npm"
|
||||||
;;
|
;;
|
||||||
s)
|
s)
|
||||||
EXTRA_OPTS="--skip-install"
|
EXTRA_OPTS="${EXTRA_OPTS} --skip-install"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage
|
usage
|
||||||
|
@ -52,7 +52,7 @@ git diff --name-only -- '*.json' | sed 's, ,\\&,g' | xargs git checkout --
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
# Build skeleton website with new version
|
# 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
|
# Stop Docker container
|
||||||
if [[ -z "${KEEP_CONTAINER:-}" ]] && ( $(docker container inspect "$CONTAINER_NAME" > /dev/null 2>&1) ); then
|
if [[ -z "${KEEP_CONTAINER:-}" ]] && ( $(docker container inspect "$CONTAINER_NAME" > /dev/null 2>&1) ); then
|
||||||
|
|
Loading…
Add table
Reference in a new issue