Unverified Commit f4b4c09f authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Eagerly build swc binaries on change (#43142)

This is a follow-up to leveraging the turbo remote cache and this now
eagerly updates the cache on merge to canary when swc files changed so
that it doesn't have to wait for a publish to update.
parent 0e65335a
...@@ -30,9 +30,12 @@ jobs: ...@@ -30,9 +30,12 @@ jobs:
# we build a dev binary for use in CI so skip downloading # we build a dev binary for use in CI so skip downloading
# canary next-swc binaries in the monorepo # canary next-swc binaries in the monorepo
NEXT_SKIP_NATIVE_POSTINSTALL: 1 NEXT_SKIP_NATIVE_POSTINSTALL: 1
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
outputs: outputs:
docsChange: ${{ steps.docs-change.outputs.DOCS_CHANGE }} docsChange: ${{ steps.docs-change.outputs.DOCS_CHANGE }}
isRelease: ${{ steps.check-release.outputs.IS_RELEASE }} isRelease: ${{ steps.check-release.outputs.IS_RELEASE }}
swcChange: ${{ steps.swc-change.outputs.SWC_CHANGE }}
turboToken: ${{ steps.turbo-token.outputs.TURBO_TOKEN }}
weekNum: ${{ steps.get-week.outputs.WEEK }} weekNum: ${{ steps.get-week.outputs.WEEK }}
steps: steps:
- name: Setup node - name: Setup node
...@@ -56,6 +59,14 @@ jobs: ...@@ -56,6 +59,14 @@ jobs:
- run: echo ${{steps.docs-change.outputs.DOCS_CHANGE}} - run: echo ${{steps.docs-change.outputs.DOCS_CHANGE}}
- run: echo "::set-output name=SWC_CHANGE::$(node scripts/run-for-change.js --type next-swc --exec echo 'yup')"
id: swc-change
- run: echo "::set-output name=TURBO_TOKEN::$(echo ${TURBO_TOKEN:-empty})"
id: turbo-token
- run: echo ${{steps.swc-change.outputs.SWC_CHANGE}}
- run: npm i -g pnpm@${PNPM_VERSION} - run: npm i -g pnpm@${PNPM_VERSION}
- id: get-store-path - id: get-store-path
...@@ -1274,7 +1285,7 @@ jobs: ...@@ -1274,7 +1285,7 @@ jobs:
build: | build: |
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}" npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
turbo run build-native-no-plugin -- --release --target aarch64-pc-windows-msvc --cargo-flags=--no-default-features turbo run build-native-no-plugin -- --release --target aarch64-pc-windows-msvc --cargo-flags=--no-default-features
if: ${{ needs.build.outputs.isRelease == 'true' }} if: ${{ needs.build.outputs.isRelease == 'true' || (needs.build.outputs.swcChange == 'yup' && needs.build.outputs.turboToken != 'empty') }}
needs: build needs: build
name: stable - ${{ matrix.settings.target }} - node@16 name: stable - ${{ matrix.settings.target }} - node@16
runs-on: ${{ matrix.settings.host }} runs-on: ${{ matrix.settings.host }}
...@@ -1367,7 +1378,7 @@ jobs: ...@@ -1367,7 +1378,7 @@ jobs:
path: packages/next-swc/native/next-swc.*.node path: packages/next-swc/native/next-swc.*.node
build-native-freebsd: build-native-freebsd:
if: ${{ needs.build.outputs.isRelease == 'true' }} if: ${{ needs.build.outputs.isRelease == 'true' || (needs.build.outputs.swcChange == 'yup' && needs.build.outputs.turboToken != 'empty') }}
needs: build needs: build
name: stable - x86_64-unknown-freebsd - node@16 name: stable - x86_64-unknown-freebsd - node@16
runs-on: macos-12 runs-on: macos-12
...@@ -1459,7 +1470,7 @@ jobs: ...@@ -1459,7 +1470,7 @@ jobs:
build-wasm: build-wasm:
needs: build needs: build
if: ${{ needs.build.outputs.isRelease == 'true' }} if: ${{ needs.build.outputs.isRelease == 'true' || (needs.build.outputs.swcChange == 'yup' && needs.build.outputs.turboToken != 'empty') }}
strategy: strategy:
matrix: matrix:
target: [web, nodejs] target: [web, nodejs]
......
...@@ -15,7 +15,7 @@ const CHANGE_ITEM_GROUPS = { ...@@ -15,7 +15,7 @@ const CHANGE_ITEM_GROUPS = {
'CODE_OF_CONDUCT.md', 'CODE_OF_CONDUCT.md',
'readme.md', 'readme.md',
], ],
'next-swc': ['packages/next-swc', '.github/workflows/build_test_deploy.yml'], 'next-swc': ['packages/next-swc'],
} }
async function main() { async function main() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment