Skip to content

Commit

Permalink
Build release type binary on PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Mar 29, 2022
1 parent cd82257 commit 4adebe2
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 40 deletions.
75 changes: 41 additions & 34 deletions .github/workflows/build_test_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ jobs:
testUnit:
name: Test Unit
runs-on: ubuntu-latest
needs: [build, build-native-dev]
needs: [build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
Expand All @@ -195,7 +195,7 @@ jobs:
- uses: actions/download-artifact@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
with:
name: next-swc-dev-binary
name: next-swc-test-binary
path: packages/next-swc/native

- run: node run-tests.js --type unit
Expand All @@ -204,7 +204,7 @@ jobs:
testDev:
name: Test Development
runs-on: ubuntu-latest
needs: [build, build-native-dev]
needs: [build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
Expand Down Expand Up @@ -235,7 +235,7 @@ jobs:
- uses: actions/download-artifact@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
with:
name: next-swc-dev-binary
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps
Expand All @@ -258,7 +258,7 @@ jobs:
testDevE2E:
name: Test Development (E2E)
runs-on: ubuntu-latest
needs: [build, build-native-dev]
needs: [build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
Expand Down Expand Up @@ -289,7 +289,7 @@ jobs:
- uses: actions/download-artifact@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
with:
name: next-swc-dev-binary
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps
Expand All @@ -312,7 +312,7 @@ jobs:
testProd:
name: Test Production
runs-on: ubuntu-latest
needs: [build, build-native-dev]
needs: [build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
Expand Down Expand Up @@ -343,7 +343,7 @@ jobs:
- uses: actions/download-artifact@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
with:
name: next-swc-dev-binary
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps
Expand All @@ -356,7 +356,7 @@ jobs:
testProdE2E:
name: Test Production (E2E)
runs-on: ubuntu-latest
needs: [build, build-native-dev]
needs: [build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
Expand Down Expand Up @@ -387,7 +387,7 @@ jobs:
- uses: actions/download-artifact@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
with:
name: next-swc-dev-binary
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps
Expand All @@ -400,7 +400,7 @@ jobs:
testIntegration:
name: Test Integration
runs-on: ubuntu-latest
needs: [build, build-native-dev]
needs: [build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
Expand Down Expand Up @@ -436,7 +436,7 @@ jobs:
- uses: actions/download-artifact@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
with:
name: next-swc-dev-binary
name: next-swc-test-binary
path: packages/next-swc/native

- run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps
Expand All @@ -458,7 +458,7 @@ jobs:
testElectron:
name: Test Electron
runs-on: ubuntu-latest
needs: [build, build-native-dev]
needs: [build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
Expand All @@ -480,7 +480,7 @@ jobs:
- uses: actions/download-artifact@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
with:
name: next-swc-dev-binary
name: next-swc-test-binary
path: packages/next-swc/native

- run: cd test/integration/with-electron/app && yarn
Expand Down Expand Up @@ -509,7 +509,7 @@ jobs:
testFirefox:
name: Test Firefox (production)
runs-on: ubuntu-latest
needs: [build, build-native-dev]
needs: [build, build-native-test]
env:
BROWSER_NAME: 'firefox'
NEXT_TELEMETRY_DISABLED: 1
Expand All @@ -529,7 +529,7 @@ jobs:
- uses: actions/download-artifact@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
with:
name: next-swc-dev-binary
name: next-swc-test-binary
path: packages/next-swc/native
- run: npx playwright install-deps && npx playwright install firefox
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
Expand All @@ -539,7 +539,7 @@ jobs:
testSafari:
name: Test Safari (production)
runs-on: ubuntu-latest
needs: [build, build-native-dev]
needs: [build, build-native-test]
env:
BROWSERSTACK: true
BROWSER_NAME: 'safari'
Expand Down Expand Up @@ -569,7 +569,7 @@ jobs:
- uses: actions/download-artifact@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
with:
name: next-swc-dev-binary
name: next-swc-test-binary
path: packages/next-swc/native

# TODO: use macos runner so that we can use playwright to test against
Expand All @@ -583,7 +583,7 @@ jobs:
testSafariOld:
name: Test Safari 10.1 (nav)
runs-on: ubuntu-latest
needs: [build, testSafari, build-native-dev]
needs: [build, testSafari, build-native-test]
env:
BROWSERSTACK: true
LEGACY_SAFARI: true
Expand Down Expand Up @@ -613,7 +613,7 @@ jobs:
- uses: actions/download-artifact@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
with:
name: next-swc-dev-binary
name: next-swc-test-binary
path: packages/next-swc/native

- run: '[[ -z "$BROWSERSTACK_ACCESS_KEY" ]] && echo "Skipping for PR" || npm i -g browserstack-local@1.4.0'
Expand All @@ -625,7 +625,7 @@ jobs:
testFirefoxNode17:
name: Test Firefox Node.js 17
runs-on: ubuntu-latest
needs: [build, testFirefox, build-native-dev]
needs: [build, testFirefox, build-native-test]
env:
BROWSER_NAME: 'firefox'
NEXT_TELEMETRY_DISABLED: 1
Expand All @@ -645,7 +645,7 @@ jobs:
- uses: actions/download-artifact@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
with:
name: next-swc-dev-binary
name: next-swc-test-binary
path: packages/next-swc/native
- run: npx playwright install-deps && npx playwright install firefox
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
Expand Down Expand Up @@ -696,7 +696,7 @@ jobs:
releaseStats:
name: Release Stats
runs-on: ubuntu-latest
needs: [publishRelease, build-native-dev]
needs: [publishRelease, build-native-test]
steps:
- name: Setup node
uses: actions/setup-node@v2
Expand All @@ -711,7 +711,7 @@ jobs:

- uses: actions/download-artifact@v2
with:
name: next-swc-dev-binary
name: next-swc-test-binary
path: packages/next-swc/native

- run: cp -r packages/next-swc/native .github/actions/next-stats-action/native
Expand All @@ -721,8 +721,8 @@ jobs:
env:
PR_STATS_COMMENT_TOKEN: ${{ secrets.PR_STATS_COMMENT_TOKEN }}

build-native-dev:
name: Build dev binary for tests
build-native-test:
name: Build native binary for tests and metrics
runs-on: ubuntu-18.04
steps:
# https://github.com/actions/virtual-environments/issues/1187
Expand Down Expand Up @@ -797,14 +797,14 @@ jobs:
- run: npm i -g @napi-rs/cli@2.4.4 turbo@1.0.28
- name: Build
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
run: turbo run build-native --cache-dir=".turbo"
run: turbo run build-native --cache-dir=".turbo" -- --release
env:
MACOSX_DEPLOYMENT_TARGET: '10.13'

- name: Upload artifact
uses: actions/upload-artifact@v2.2.4
with:
name: next-swc-dev-binary
name: next-swc-test-binary
path: packages/next-swc/native/next-swc.linux-x64-gnu.node

- name: Clear the cargo caches
Expand Down Expand Up @@ -835,7 +835,7 @@ jobs:
test-wasm:
name: Test the wasm build
runs-on: ubuntu-18.04
needs: [build, build-native-dev, build-wasm-dev]
needs: [build, build-native-test, build-wasm-dev]

steps:
- uses: actions/cache@v2
Expand All @@ -857,7 +857,7 @@ jobs:
- uses: actions/download-artifact@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
with:
name: next-swc-dev-binary
name: next-swc-test-binary
path: packages/next-swc/native

# node version needs to be 16+ to use --no-addons option
Expand Down Expand Up @@ -1199,44 +1199,51 @@ jobs:
name: wasm-dev-binary
path: packages/next-swc/crates/wasm/pkg-nodejs

releaseBuildPerformanceMetrics:
build-performance-metrics:
name: Performance Metrics for Release Build
runs-on: ubuntu-latest
needs: [publishRelease]
needs: [build, build-native-test]
steps:
- name: Setup node
uses: actions/setup-node@v2
if: ${{ steps.docs-change.outputs.docsChange != 'docs only change' }}
with:
node-version: 14

- uses: actions/cache@v2
id: restore-build
if: ${{ steps.docs-change.outputs.docsChange != 'docs only change' }}
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt }}

- name: Set Git Short sha Env
if: ${{ steps.docs-change.outputs.docsChange != 'docs only change' }}
run: echo "GIT_SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV

- name: Check Git Short sha Env
if: ${{ steps.docs-change.outputs.docsChange != 'docs only change' }}
run: echo ${GIT_SHORT_SHA}

- uses: actions/download-artifact@v2
if: ${{ steps.docs-change.outputs.docsChange != 'docs only change' }}
with:
name: next-swc-binaries
name: next-swc-test-binary
path: packages/next-swc/native

- name: Generate metrics data
if: ${{ steps.docs-change.outputs.docsChange != 'docs only change' }}
run: |
cp packages/next-swc/native/next-swc.linux-x64-gnu.node packages/next-swc/native
yarn --cwd bench/nested-deps install
node bench/nested-deps/bench.mjs build
- uses: datadog/agent-github-action@v1
if: ${{ steps.docs-change.outputs.docsChange != 'docs only change' }}
with:
api_key: ${{ secrets.DATA_DOG_API_KEY }}

- name: Sending metrics data to Datadog
if: ${{ steps.docs-change.outputs.docsChange != 'docs only change' }}
run: |
node scripts/trace-dd.mjs bench/nested-deps/.next/trace build ${GIT_SHORT_SHA} ./bench/nested-deps/next.config.js
env:
Expand Down
7 changes: 1 addition & 6 deletions bench/nested-deps/bench.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ import treeKill from 'tree-kill'
const ROOT_DIR = join(fileURLToPath(import.meta.url), '..', '..', '..')
const CWD = join(ROOT_DIR, 'bench', 'nested-deps')

const NEXT_BIN = join(
ROOT_DIR,
'node_modules',
'.bin',
`next${process.platform === 'win32' ? '.cmd' : ''}`
)
const NEXT_BIN = join(ROOT_DIR, 'packages', 'next', 'dist', 'bin', 'next')

const [, , command = 'all'] = process.argv

Expand Down

0 comments on commit 4adebe2

Please sign in to comment.