Skip to content

Commit

Permalink
Merge branch 'canary' into fix/add-additional-worker-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ztanner committed Aug 26, 2023
2 parents f547edc + f2766b9 commit a27dd47
Show file tree
Hide file tree
Showing 164 changed files with 4,166 additions and 4,018 deletions.
40 changes: 17 additions & 23 deletions .github/actions/next-stats-action/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,8 @@ const addComment = require('./add-comment')
const actionInfo = require('./prepare/action-info')()
const { mainRepoDir, diffRepoDir } = require('./constants')
const loadStatsConfig = require('./prepare/load-stats-config')
const {
cloneRepo,
checkoutRef,
mergeBranch,
getCommitId,
linkPackages,
getLastStable,
} = require('./prepare/repo-setup')(actionInfo)
const { cloneRepo, mergeBranch, getCommitId, linkPackages, getLastStable } =
require('./prepare/repo-setup')(actionInfo)

const allowedActions = new Set(['synchronize', 'opened'])

Expand Down Expand Up @@ -108,22 +102,22 @@ if (!allowedActions.has(actionInfo.actionName) && !actionInfo.isRelease) {
if (!actionInfo.skipClone) {
const usePnpm = await fs.pathExists(path.join(dir, 'pnpm-lock.yaml'))

let buildCommand = `cd ${dir}${
!statsConfig.skipInitialInstall
? usePnpm
? // --no-frozen-lockfile is used here to tolerate lockfile
// changes from merging latest changes
` && pnpm install --no-frozen-lockfile && pnpm run build`
: ' && yarn install --network-timeout 1000000'
: ''
}`

if (statsConfig.initialBuildCommand) {
buildCommand += ` && ${statsConfig.initialBuildCommand}`
if (!statsConfig.skipInitialInstall) {
await exec.spawnPromise(
`cd ${dir}${
usePnpm
? // --no-frozen-lockfile is used here to tolerate lockfile
// changes from merging latest changes
` && pnpm install --no-frozen-lockfile`
: ' && yarn install --network-timeout 1000000'
}`
)

await exec.spawnPromise(
statsConfig.initialBuildCommand ||
`cd ${dir} && ${usePnpm ? 'pnpm build' : 'echo built'}`
)
}
// allow high timeout for install + building all packages
// in case of noisy environment slowing down initial repo build
await exec(buildCommand, false, { timeout: 10 * 60 * 1000 })
}

await fs
Expand Down
14 changes: 14 additions & 0 deletions .github/actions/next-stats-action/src/util/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,18 @@ exec.spawn = function spawn(command = '', opts = {}) {
return child
}

exec.spawnPromise = function spawnPromise(command = '', opts = {}) {
return new Promise((resolve, reject) => {
const child = exec.spawn(command)
child.on('exit', (code, signal) => {
if (code || signal) {
return reject(
new Error(`bad exit code/signal code: ${code} signal: ${signal}`)
)
}
resolve()
})
})
}

module.exports = exec
34 changes: 16 additions & 18 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
target: 'x86_64-apple-darwin'
build: |
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && corepack enable
turbo run build-native-release --remote-cache-timeout 90 --summarize -- --target x86_64-apple-darwin --release
turbo run build-native-release -vvv --remote-cache-timeout 90 --summarize -- --target x86_64-apple-darwin --release
strip -x packages/next-swc/native/next-swc.*.node
- host:
Expand All @@ -102,7 +102,7 @@ jobs:
SYSROOT=$(xcrun --sdk macosx --show-sdk-path);
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT";
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && corepack enable
turbo run build-native-release --remote-cache-timeout 90 --summarize -- --target aarch64-apple-darwin
turbo run build-native-release -vvv --remote-cache-timeout 90 --summarize -- --target aarch64-apple-darwin
strip -x packages/next-swc/native/next-swc.*.node
- host:
Expand All @@ -113,7 +113,7 @@ jobs:
build: |
corepack enable
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}"
turbo run build-native-release --remote-cache-timeout 90 --summarize -- --target x86_64-pc-windows-msvc
turbo run build-native-release -vvv --remote-cache-timeout 90 --summarize -- --target x86_64-pc-windows-msvc
target: 'x86_64-pc-windows-msvc'

- host:
Expand All @@ -124,7 +124,7 @@ jobs:
build: |
corepack enable
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}"
turbo run build-native-no-plugin --remote-cache-timeout 90 --summarize -- --release --target i686-pc-windows-msvc
turbo run build-native-no-plugin -vvv --remote-cache-timeout 90 --summarize -- --release --target i686-pc-windows-msvc
target: 'i686-pc-windows-msvc'

- host:
Expand All @@ -136,7 +136,7 @@ jobs:
build: |
corepack enable
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}"
turbo run build-native-no-plugin-woa-release --remote-cache-timeout 90 --summarize -- --target aarch64-pc-windows-msvc
turbo run build-native-no-plugin-woa-release -vvv --remote-cache-timeout 90 --summarize -- --target aarch64-pc-windows-msvc
- host:
- 'self-hosted'
Expand Down Expand Up @@ -229,6 +229,7 @@ jobs:
name: stable - ${{ matrix.settings.target }} - node@16
runs-on: ${{ matrix.settings.host }}
timeout-minutes: 30
steps:
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
Expand Down Expand Up @@ -367,7 +368,7 @@ jobs:
run: node scripts/normalize-version-bump.js

- name: Build
run: turbo run build-wasm --remote-cache-timeout 90 --summarize -- --target ${{ matrix.target }} --features tracing/release_max_level_info
run: turbo run build-wasm -vvv --remote-cache-timeout 90 --summarize -- --target ${{ matrix.target }} --features tracing/release_max_level_info

- name: Add target to folder name
run: '[[ -d "packages/next-swc/crates/wasm/pkg" ]] && mv packages/next-swc/crates/wasm/pkg packages/next-swc/crates/wasm/pkg-${{ matrix.target }} || ls packages/next-swc/crates/wasm'
Expand Down Expand Up @@ -504,21 +505,17 @@ jobs:
releaseStats:
name: Release Stats
runs-on: ubuntu-latest
runs-on:
- 'self-hosted'
- 'linux'
- 'x64'
- 'metal'
timeout-minutes: 25
needs: [publishRelease]
steps:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_LTS_VERSION }}
check-latest: true

- uses: actions/cache@v3
timeout-minutes: 5
id: restore-build
- uses: actions/checkout@v3
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
fetch-depth: 25

- uses: actions/download-artifact@v3
with:
Expand All @@ -531,6 +528,7 @@ jobs:
- uses: ./.github/actions/next-stats-action
env:
PR_STATS_COMMENT_TOKEN: ${{ secrets.PR_STATS_COMMENT_TOKEN }}
NEXT_SKIP_NATIVE_POSTINSTALL: 1

upload_turbopack_bytesize:
name: Upload Turbopack Bytesize trace to Datadog
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
- run: node scripts/normalize-version-bump.js
name: normalize versions

- run: turbo run build-native-release --remote-cache-timeout 90 --summarize -- --target x86_64-unknown-linux-gnu
- run: turbo run build-native-release -vvv --remote-cache-timeout 90 --summarize -- --target x86_64-unknown-linux-gnu
if: ${{ inputs.skipNativeBuild != 'yes' && steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}

- name: Upload next-swc artifact
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/pull_request_stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ jobs:
stats:
name: PR Stats
needs: build
runs-on: ubuntu-latest
timeout-minutes: 25
runs-on:
- 'self-hosted'
- 'linux'
- 'x64'
- 'metal'
steps:
- uses: actions/checkout@v3
with:
Expand Down

0 comments on commit a27dd47

Please sign in to comment.