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 17, 2022
1 parent 7d5d975 commit 08fbea5
Showing 1 changed file with 46 additions and 34 deletions.
80 changes: 46 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 All @@ -231,7 +231,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 @@ -254,7 +254,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 All @@ -281,7 +281,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 @@ -304,7 +304,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 All @@ -331,7 +331,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 @@ -344,7 +344,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 All @@ -371,7 +371,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 @@ -384,7 +384,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 @@ -420,7 +420,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 @@ -442,7 +442,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 @@ -464,7 +464,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 @@ -493,7 +493,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 @@ -513,7 +513,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 @@ -523,7 +523,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 @@ -553,7 +553,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 @@ -567,7 +567,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 @@ -597,7 +597,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 @@ -609,7 +609,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 @@ -629,7 +629,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 @@ -680,7 +680,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 @@ -695,7 +695,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 @@ -705,8 +705,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 @@ -781,14 +781,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 @@ -819,7 +819,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 @@ -841,7 +841,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 @@ -1183,44 +1183,56 @@ 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-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: Generate metrics diff
if: ${{ needs.build.outputs.isRelease != 'true' && steps.docs-change.outputs.docsChange != 'docs only change' }}
run: |
echo "Generating metrics diff add comments to PRs?"
- name: Sending metrics data to Datadog
if: ${{ needs.build.outputs.isRelease == 'true' }}
run: |
node scripts/trace-dd.mjs bench/nested-deps/.next/trace build ${GIT_SHORT_SHA} ./bench/nested-deps/next.config.js
env:
Expand Down

0 comments on commit 08fbea5

Please sign in to comment.