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.
This commit is contained in:
JJ Kasper 2022-11-19 18:09:47 -08:00 committed by GitHub
parent 0e65335aeb
commit f4b4c09f94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View file

@ -30,9 +30,12 @@ jobs:
# we build a dev binary for use in CI so skip downloading
# canary next-swc binaries in the monorepo
NEXT_SKIP_NATIVE_POSTINSTALL: 1
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
outputs:
docsChange: ${{ steps.docs-change.outputs.DOCS_CHANGE }}
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 }}
steps:
- name: Setup node
@ -56,6 +59,14 @@ jobs:
- 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}
- id: get-store-path
@ -1274,7 +1285,7 @@ jobs:
build: |
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
if: ${{ needs.build.outputs.isRelease == 'true' }}
if: ${{ needs.build.outputs.isRelease == 'true' || (needs.build.outputs.swcChange == 'yup' && needs.build.outputs.turboToken != 'empty') }}
needs: build
name: stable - ${{ matrix.settings.target }} - node@16
runs-on: ${{ matrix.settings.host }}
@ -1367,7 +1378,7 @@ jobs:
path: packages/next-swc/native/next-swc.*.node
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
name: stable - x86_64-unknown-freebsd - node@16
runs-on: macos-12
@ -1459,7 +1470,7 @@ jobs:
build-wasm:
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:
matrix:
target: [web, nodejs]

View file

@ -15,7 +15,7 @@ const CHANGE_ITEM_GROUPS = {
'CODE_OF_CONDUCT.md',
'readme.md',
],
'next-swc': ['packages/next-swc', '.github/workflows/build_test_deploy.yml'],
'next-swc': ['packages/next-swc'],
}
async function main() {