Build test binary in Docker image (#43745)

<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
This commit is contained in:
LongYinan 2022-12-06 13:17:03 +08:00 committed by GitHub
parent fa42c3461f
commit cbf87e1ebf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -923,13 +923,6 @@ jobs:
node-version: 16 node-version: 16
check-latest: true check-latest: true
- name: Install
uses: actions-rs/toolchain@v1
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
profile: minimal
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Cache cargo registry - name: Cache cargo registry
uses: actions/cache@v3 uses: actions/cache@v3
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }} if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
@ -976,14 +969,20 @@ jobs:
restore-keys: | restore-keys: |
next-swc-cargo-cache-dev-ubuntu-latest next-swc-cargo-cache-dev-ubuntu-latest
# since the repo's dependencies aren't installed we need - name: Build in docker
# to install napi globally uses: addnab/docker-run-action@v3
- run: npm i -g @napi-rs/cli@${{ env.NAPI_CLI_VERSION }} turbo@${{ env.TURBO_VERSION }} pnpm@${PNPM_VERSION} with:
- name: Build image: ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2022-10-24-x64
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }} options: -e RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} -e NAPI_CLI_VERSION=${{ env.NAPI_CLI_VERSION }} -e TURBO_VERSION=${{ env.TURBO_VERSION }} -e TURBO_TEAM=vercel -e TURBO_TOKEN=${{ secrets.TURBO_TOKEN }} -e TURBO_REMOTE_ONLY=true -v ${{ env.HOME }}/.cargo/git:/root/.cargo/git -v ${{ env.HOME }}/.cargo/registry:/root/.cargo/registry -v ${{ github.workspace }}:/build -w /build
run: turbo run build-native --cache-dir=".turbo" -- --release run: |
env: set -e &&
MACOSX_DEPLOYMENT_TARGET: '10.13' rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add x86_64-unknown-linux-gnu &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi &&
unset CC_x86_64_unknown_linux_gnu && unset CC &&
turbo run build-native --cache-dir=".turbo" -- --release --target x86_64-unknown-linux-gnu &&
strip packages/next-swc/native/next-swc.*.node
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3