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

Update PR stats workflow #50853

Merged
merged 6 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions .github/actions/next-stats-action/src/prepare/repo-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ module.exports = (actionInfo) => {
}

if (pkg === 'next') {
console.log('using swc dep', {
nextSwcVersion,
nextSwcPkg: pkgDatas.get('@next/swc'),
})
if (nextSwcVersion) {
Object.assign(pkgData.dependencies, {
'@next/swc-linux-x64-gnu': nextSwcVersion,
Expand Down
24 changes: 11 additions & 13 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ env:
NODE_MAINTENANCE_VERSION: 16
NODE_LTS_VERSION: 18
TEST_CONCURRENCY: 6
# TODO: remove after testing
# NEXT_TEST_CONTINUE_ON_ERROR: 'true'

TURBO_TEAM: 'vercel'
TURBO_REMOTE_ONLY: 'true'
Expand All @@ -29,14 +27,14 @@ env:
jobs:
build:
name: build
uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
secrets: inherit

lint:
name: lint
needs: ['build']

uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
with:
afterBuild: pnpm lint-no-typescript && pnpm check-examples
secrets: inherit
Expand All @@ -45,7 +43,7 @@ jobs:
name: types and precompiled
needs: ['build']

uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
with:
afterBuild: pnpm types-and-precompiled
skipForDocsOnly: 'yes'
Expand All @@ -55,7 +53,7 @@ jobs:
name: test cargo unit
needs: ['build']

uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
skipInstallBuild: 'yes'
Expand All @@ -66,7 +64,7 @@ jobs:
name: rust check
needs: ['build']

uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
skipInstallBuild: 'yes'
Expand All @@ -76,7 +74,7 @@ jobs:
test-turbopack-dev:
name: test turbopack dev
needs: ['build']
uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/packages/next-swc/crates/next-dev-tests/tests-manifest.js" __INTERNAL_NEXT_DEV_TEST_TURBO_DEV=TRUE __INTERNAL_CUSTOM_TURBOPACK_BINDINGS="$(pwd)/packages/next-swc/native/next-swc.linux-x64-gnu.node" __INTERNAL_NEXT_DEV_TEST_TURBO_GLOB_MATCH="*" NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_MODE=dev node run-tests.js --type development --timings -c ${TEST_CONCURRENCY}
Expand All @@ -86,7 +84,7 @@ jobs:
name: test next-swc wasm
needs: ['build']

uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
afterBuild: rustup target add wasm32-unknown-unknown && curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh && node ./scripts/normalize-version-bump.js && turbo run build-wasm -- --target nodejs --features tracing/release_max_level_info && git checkout . && mv packages/next-swc/crates/wasm/pkg packages/next-swc/crates/wasm/pkg-nodejs && node ./scripts/setup-wasm.mjs && NEXT_TEST_MODE=start TEST_WASM=true node run-tests.js test/integration/production/test/index.test.js test/e2e/streaming-ssr/index.test.ts
Expand All @@ -100,7 +98,7 @@ jobs:
matrix:
group: [1, 2, 3]

uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
afterBuild: NEXT_TEST_MODE=dev node run-tests.js --timings -g ${{ matrix.group }}/3 -c ${TEST_CONCURRENCY} --test-pattern '^(development|e2e|unit)/.*\.test\.(js|jsx|ts|tsx)$'
Expand All @@ -114,7 +112,7 @@ jobs:
matrix:
group: [1, 2, 3]

uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
afterBuild: NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }}/3 -c ${TEST_CONCURRENCY} --test-pattern '^(production|e2e)/.*\.test\.(js|jsx|ts|tsx)$'
Expand All @@ -128,7 +126,7 @@ jobs:
matrix:
group: [1, 2, 3, 4, 5, 6]

uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
with:
nodeVersion: 16
skipForDocsOnly: 'yes'
Expand All @@ -139,7 +137,7 @@ jobs:
name: test firefox and safari
needs: ['build']

uses: vercel/next.js/.github/workflows/build_reusable.yml@canary
uses: ./.github/workflows/build_reusable.yml
with:
skipForDocsOnly: 'yes'
afterBuild: pnpm playwright install && BROWSER_NAME=firefox node run-tests.js test/integration/production/test/index.test.js && BROWSER_NAME=safari NEXT_TEST_MODE=start node run-tests.js -c 1 test/integration/production/test/index.test.js test/e2e/basepath.test.ts && BROWSER_NAME=safari DEVICE_NAME='iPhone XR' node run-tests.js -c 1 test/production/prerender-prefetch/index.test.ts
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/build_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ on:
required: false
description: 'if nextest rust dep is needed'
type: string
uploadSwcArtifact:
required: false
description: 'if swc artifact needs uploading'
type: string

env:
NAPI_CLI_VERSION: 2.14.7
Expand All @@ -32,8 +36,6 @@ env:
NODE_MAINTENANCE_VERSION: 16
NODE_LTS_VERSION: 18
TEST_CONCURRENCY: 6
# TODO: remove after testing
# NEXT_TEST_CONTINUE_ON_ERROR: 'true'

TURBO_TEAM: 'vercel'
TURBO_REMOTE_ONLY: 'true'
Expand Down Expand Up @@ -86,6 +88,13 @@ jobs:

- run: turbo run build-native-release --summarize -- --target x86_64-unknown-linux-gnu

- name: Upload next-swc artifact
if: ${{ inputs.uploadSwcArtifact == 'yes' }}
uses: actions/upload-artifact@v3
with:
name: next-swc-binary
path: packages/next-swc/native/next-swc.linux-x64-gnu.node

# undo normalize version changes for install/build
- run: git checkout .
if: ${{ inputs.skipInstallBuild != 'yes' }}
Expand Down
100 changes: 19 additions & 81 deletions .github/workflows/pull_request_stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,91 +9,29 @@ env:
TURBO_VERSION: 1.9.6
RUST_TOOLCHAIN: nightly-2023-03-09
PNPM_VERSION: 7.24.3
NODE_MAINTENANCE_VERSION: 16
NODE_LTS_VERSION: 18
TEST_CONCURRENCY: 6

TURBO_TEAM: 'vercel'
TURBO_REMOTE_ONLY: 'true'
NEXT_TELEMETRY_DISABLED: 1
# we build a dev binary for use in CI so skip downloading
# canary next-swc binaries in the monorepo
NEXT_SKIP_NATIVE_POSTINSTALL: 1
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }}
NEXT_TEST_JOB: 1

jobs:
build-native-dev:
name: Build dev binary for tests
runs-on: ubuntu-latest
steps:
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off

- uses: actions/checkout@v3
with:
fetch-depth: 25

- name: Check non-docs only change
run: echo "DOCS_CHANGE<<EOF" >> $GITHUB_OUTPUT; echo "$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')" >> $GITHUB_OUTPUT; echo 'EOF' >> $GITHUB_OUTPUT
id: docs-change

- name: Cache cargo registry
uses: actions/cache@v3
timeout-minutes: 5
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
path: ~/.cargo/registry
key: stable-ubuntu-latest-node@14-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo index
uses: actions/cache@v3
timeout-minutes: 5
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
path: ~/.cargo/git
key: stable-ubuntu-latest-node@14-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}

# We use week in the turbo cache key to keep the cache from infinitely growing
- id: get-week
run: echo "WEEK=$(date +%U)" >> $GITHUB_OUTPUT

- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v3
timeout-minutes: 5
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
path: .turbo
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}-
turbo-${{ github.job }}-canary-${{ steps.get-week.outputs.WEEK }}-

- name: Make more disk space
continue-on-error: true
run: sudo rm -rf /usr/local/lib/android

- 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 }} -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
with:
name: next-swc-dev-binary
path: packages/next-swc/native/next-swc.linux-x64-gnu.node

- name: Clear the cargo caches
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean
cargo-cache
build:
uses: ./.github/workflows/build_reusable.yml
secrets: inherit
with:
uploadSwcArtifact: 'yes'

stats:
name: PR Stats
needs: build-native-dev
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -107,7 +45,7 @@ jobs:
- uses: actions/download-artifact@v3
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
name: next-swc-dev-binary
name: next-swc-binary
path: packages/next-swc/native

- run: cp -r packages/next-swc/native .github/actions/next-stats-action/native
Expand Down