Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test binary generation and update test config #43790

Merged
merged 11 commits into from Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
100 changes: 13 additions & 87 deletions .github/workflows/build_test_deploy.yml
Expand Up @@ -624,30 +624,20 @@ jobs:
BROWSER_NAME: 'firefox'
NEXT_TELEMETRY_DISABLED: 1
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: 16
check-latest: true

- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}

- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npx playwright install-deps && npx playwright install firefox
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: node run-tests.js test/integration/production/test/index.test.js
if: ${{needs.build.outputs.docsChange == 'nope'}}
# test rsc hydration on firefox due to limited support of TransformStream api
- run: npm i -g pnpm@${PNPM_VERSION}

- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.22.2-focal /bin/bash -c "cd /work && ls && curl https://install-node.vercel.app/v16 | FORCE=1 bash && node -v && npm i -g pnpm@${PNPM_VERSION} && xvfb-run node run-tests.js test/integration/production/test/index.test.js >> /proc/1/fd/1"
if: ${{needs.build.outputs.docsChange == 'nope'}}

testSafari:
Expand All @@ -660,13 +650,6 @@ jobs:
NEXT_TEST_MODE: 'start'
NEXT_TELEMETRY_DISABLED: 1
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: 16
check-latest: true

# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
Expand All @@ -684,16 +667,7 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: npx playwright install-deps && npx playwright install webkit
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: node run-tests.js -c 1 test/integration/production/test/index.test.js test/e2e/basepath.test.ts
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: DEVICE_NAME='iPhone XR' node run-tests.js -c 1 test/production/prerender-prefetch/index.test.ts
- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.22.2-focal /bin/bash -c "cd /work && ls && curl https://install-node.vercel.app/v16 | FORCE=1 bash && node -v && npm i -g pnpm@${PNPM_VERSION} && node run-tests.js -c 1 test/integration/production/test/index.test.js test/e2e/basepath.test.ts && DEVICE_NAME='iPhone XR' node run-tests.js -c 1 test/production/prerender-prefetch/index.test.ts >> /proc/1/fd/1"
if: ${{needs.build.outputs.docsChange == 'nope'}}

testSafariOld:
Expand Down Expand Up @@ -752,28 +726,20 @@ jobs:
BROWSER_NAME: 'firefox'
NEXT_TELEMETRY_DISABLED: 1
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: 18
check-latest: true
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}

- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: npx playwright install-deps && npx playwright install firefox
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: node run-tests.js test/integration/production/test/index.test.js

- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.22.2-focal /bin/bash -c "cd /work && ls && curl https://install-node.vercel.app/v18 | FORCE=1 bash && node -v && npm i -g pnpm@${PNPM_VERSION} && xvfb-run node run-tests.js test/integration/production/test/index.test.js >> /proc/1/fd/1"
if: ${{needs.build.outputs.docsChange == 'nope'}}

publishRelease:
Expand Down Expand Up @@ -831,12 +797,6 @@ jobs:
VERCEL_TEST_TEAM: 'vtest314-next-e2e-tests'
NEXT_TEST_MODE: deploy
steps:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true

- uses: actions/cache@v3
id: restore-build
with:
Expand All @@ -849,17 +809,10 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g pnpm@${PNPM_VERSION}
name: Install pnpm

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
timeout-minutes: 10
name: Install playwright dependencies

- run: RESET_VC_PROJECT=true node scripts/reset-vercel-project.mjs
name: Reset test project

- run: node run-tests.js --type e2e
- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.22.2-focal /bin/bash -c "cd /work && ls && curl https://install-node.vercel.app/v${{ matrix.node }} | FORCE=1 bash && node -v && npm i -g pnpm@${PNPM_VERSION} && xvfb-run node run-tests.js --type e2e >> /proc/1/fd/1"
name: Run test/e2e (deploy)

- name: Upload test trace
Expand Down Expand Up @@ -916,13 +869,6 @@ jobs:
- run: echo "::set-output name=DOCS_CHANGE::$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')"
id: docs-change

- name: Setup node
uses: actions/setup-node@v3
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
node-version: 16
check-latest: true

- name: Cache cargo registry
uses: actions/cache@v3
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
Expand Down Expand Up @@ -971,21 +917,23 @@ jobs:

- name: Build in docker
uses: addnab/docker-run-action@v3
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2022-10-24-x64
options: -e RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} -e NAPI_CLI_VERSION=${{ env.NAPI_CLI_VERSION }} -e TURBO_VERSION=${{ env.TURBO_VERSION }} -e TURBO_TEAM=vercel -e TURBO_TOKEN=${{ secrets.TURBO_TOKEN }} -e TURBO_REMOTE_ONLY=true -v ${{ env.HOME }}/.cargo/git:/root/.cargo/git -v ${{ env.HOME }}/.cargo/registry:/root/.cargo/registry -v ${{ github.workspace }}:/build -w /build
options: -e RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} -e NAPI_CLI_VERSION=${{ env.NAPI_CLI_VERSION }} -e TURBO_VERSION=${{ env.TURBO_VERSION }} -v ${{ env.HOME }}/.cargo/git:/root/.cargo/git -v ${{ env.HOME }}/.cargo/registry:/root/.cargo/registry -v ${{ github.workspace }}:/build -w /build
run: |
set -e &&
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add x86_64-unknown-linux-gnu &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi &&
unset CC_x86_64_unknown_linux_gnu && unset CC &&
turbo run build-native --cache-dir=".turbo" -- --release --target x86_64-unknown-linux-gnu &&
turbo run build-native --cache-dir=".turbo" -- --target x86_64-unknown-linux-gnu &&
strip packages/next-swc/native/next-swc.*.node

- name: Upload artifact
uses: actions/upload-artifact@v3
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
name: next-swc-test-binary
path: packages/next-swc/native/next-swc.linux-x64-gnu.node
Expand Down Expand Up @@ -1049,29 +997,7 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

# node version needs to be 16+ to use --no-addons option
- name: Setup node
if: ${{needs.build.outputs.docsChange == 'nope'}}
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
timeout-minutes: 10
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: node ./scripts/setup-wasm.mjs
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: TEST_WASM=true xvfb-run node run-tests.js test/integration/production/test/index.test.js
if: ${{needs.build.outputs.docsChange == 'nope'}}

# test wasm parsing for runtime in page config
- run: TEST_WASM=true xvfb-run node run-tests.js test/e2e/streaming-ssr/index.test.ts
- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.22.2-focal /bin/bash -c "cd /work && ls && curl https://install-node.vercel.app/v16 | FORCE=1 bash && node -v && node ./scripts/setup-wasm.mjs && npm i -g pnpm@${PNPM_VERSION} && TEST_WASM=true xvfb-run node run-tests.js test/integration/production/test/index.test.js test/e2e/streaming-ssr/index.test.ts >> /proc/1/fd/1"
if: ${{needs.build.outputs.docsChange == 'nope'}}

# Build binaries for publishing
Expand Down
40 changes: 14 additions & 26 deletions .github/workflows/pull_request_stats.yml
Expand Up @@ -27,20 +27,6 @@ jobs:
run: echo "::set-output name=DOCS_CHANGE::$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')"
id: docs-change

- name: Setup node
uses: actions/setup-node@v3
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
node-version: 16
check-latest: true

- name: Install
uses: actions-rs/toolchain@v1
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
profile: minimal
toolchain: nightly-2022-11-04

- name: Cache cargo registry
uses: actions/cache@v1
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
Expand Down Expand Up @@ -82,19 +68,21 @@ jobs:
restore-keys: |
next-swc-cargo-cache-ubuntu-latest

# since the repo's dependencies aren't installed we need
# to install napi globally
- run: npm i -g @napi-rs/cli@${NAPI_CLI_VERSION}
- run: npm i -g turbo@${TURBO_VERSION} pnpm@${PNPM_VERSION}

- name: Build
- name: Build in docker
uses: addnab/docker-run-action@v3
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
run: turbo run build-native --cache-dir=".turbo"
env:
MACOSX_DEPLOYMENT_TARGET: '10.13'
TURBO_TOKEN: ${{secrets.TURBO_TOKEN}}
TURBO_TEAM: nextjs
TURBO_PROJECT: nextjs
with:
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2022-10-24-x64
options: -e RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} -e NAPI_CLI_VERSION=${{ env.NAPI_CLI_VERSION }} -e TURBO_VERSION=${{ env.TURBO_VERSION }} -v ${{ env.HOME }}/.cargo/git:/root/.cargo/git -v ${{ env.HOME }}/.cargo/registry:/root/.cargo/registry -v ${{ github.workspace }}:/build -w /build
run: |
set -e &&
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add x86_64-unknown-linux-gnu &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi &&
unset CC_x86_64_unknown_linux_gnu && unset CC &&
turbo run build-native --cache-dir=".turbo" -- --target x86_64-unknown-linux-gnu &&
strip packages/next-swc/native/next-swc.*.node

- name: Upload artifact
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion test/integration/production/test/index.test.js
Expand Up @@ -37,7 +37,7 @@ let app
const context = {}

if (process.env.TEST_WASM) {
jest.setTimeout(120 * 1000)
jest.setTimeout(240 * 1000)
}

describe('Production Usage', () => {
Expand Down