Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed May 31, 2023
1 parent a89d58a commit 09f3cfa
Showing 1 changed file with 205 additions and 0 deletions.
205 changes: 205 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,211 @@ jobs:
afterBuild: rustup target add wasm32-unknown-unknown && curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh && node ./scripts/normalize-version-bump.js && turbo run build-wasm -- --target nodejs --features tracing/release_max_level_info && git checkout . && mv packages/next-swc/crates/wasm/pkg packages/next-swc/crates/wasm/pkg-nodejs && node ./scripts/setup-wasm.mjs && NEXT_TEST_MODE=start TEST_WASM=true node run-tests.js test/integration/production/test/index.test.js test/e2e/streaming-ssr/index.test.ts
secrets: inherit

# Build binaries for publishing
build-native:
strategy:
fail-fast: false
matrix:
settings:
# pnpm is aliased here temporarily until the build docker
# image is updated past Node.js v14.19 (current 14.18.1)
- host: macos-latest
target: 'x86_64-apple-darwin'
build: |
npm install -g @datadog/datadog-ci
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
turbo run build-native -- --target x86_64-apple-darwin --release
strip -x packages/next-swc/native/next-swc.*.node
export FILENAME=$(ls packages/next-swc/native/next-swc.*.node)
export BYTESIZE=$(stat -c %s $FILENAME)
datadog-ci metric --no-fail --level pipeline --metrics bytesize.turbopack.x86_64-apple-darwin:$BYTESIZE
- host: windows-latest
build: |
npm install -g @datadog/datadog-ci
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
turbo run build-native -- --target x86_64-pc-windows-msvc
export FILENAME=$(ls packages/next-swc/native/next-swc.*.node)
export BYTESIZE=$(stat -c %s $FILENAME)
datadog-ci metric --no-fail --level pipeline --metrics bytesize.turbopack.x86_64-pc-windows-msvc:$BYTESIZE
target: 'x86_64-pc-windows-msvc'
- host: windows-latest
build: |
npm install -g @datadog/datadog-ci
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
turbo run build-native-no-plugin -- --release --target i686-pc-windows-msvc
export FILENAME=$(ls packages/next-swc/native/next-swc.*.node)
export BYTESIZE=$(stat -c %s $FILENAME)
datadog-ci metric --no-fail --level pipeline --metrics bytesize.turbopack.i686-pc-windows-msvc:$BYTESIZE
target: 'i686-pc-windows-msvc'
- host: ubuntu-latest
target: 'x86_64-unknown-linux-gnu'
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2022-10-24-x64
build: >-
set -e &&
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add x86_64-unknown-linux-gnu &&
npm install -g @datadog/datadog-ci &&
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 -- --target x86_64-unknown-linux-gnu &&
strip packages/next-swc/native/next-swc.*.node &&
export FILENAME=$(ls packages/next-swc/native/next-swc.*.node) &&
export BYTESIZE=$(stat -c %s $FILENAME) &&
datadog-ci metric --no-fail --level pipeline --metrics bytesize.turbopack.x86_64-unknown-linux-gnu:$BYTESIZE
- host: ubuntu-latest
target: 'x86_64-unknown-linux-musl'
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2022-10-24-alpine
build: >-
set -e &&
apk add --no-cache libc6-compat &&
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add x86_64-unknown-linux-musl &&
npm install -g @datadog/datadog-ci &&
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 &&
turbo run build-native -- --target x86_64-unknown-linux-musl &&
strip packages/next-swc/native/next-swc.*.node &&
export FILENAME=$(ls packages/next-swc/native/next-swc.*.node) &&
export BYTESIZE=$(stat -c %s $FILENAME) &&
datadog-ci metric --no-fail --level pipeline --metrics bytesize.turbopack.x86_64-unknown-linux-musl:$BYTESIZE
- host: macos-latest
target: 'aarch64-apple-darwin'
build: |
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*;
export CC=$(xcrun -f clang);
export CXX=$(xcrun -f clang++);
SYSROOT=$(xcrun --sdk macosx --show-sdk-path);
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT";
npm install -g @datadog/datadog-ci
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
turbo run build-native -- --target aarch64-apple-darwin
strip -x packages/next-swc/native/next-swc.*.node
export FILENAME=$(ls packages/next-swc/native/next-swc.*.node)
export BYTESIZE=$(stat -c %s $FILENAME)
datadog-ci metric --no-fail --level pipeline --metrics bytesize.turbopack.aarch64-apple-darwin:$BYTESIZE
- host: ubuntu-latest
target: 'aarch64-unknown-linux-gnu'
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2022-10-24-aarch64
build: >-
set -e &&
export JEMALLOC_SYS_WITH_LG_PAGE=16 &&
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add aarch64-unknown-linux-gnu &&
npm install -g @datadog/datadog-ci &&
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 &&
export CC_aarch64_unknown_linux_gnu=/usr/aarch64-unknown-linux-gnu/bin/aarch64-unknown-linux-gnu-gcc &&
turbo run build-native -- --target aarch64-unknown-linux-gnu &&
llvm-strip -x packages/next-swc/native/next-swc.*.node &&
export FILENAME=$(ls packages/next-swc/native/next-swc.*.node) &&
export BYTESIZE=$(stat -c %s $FILENAME) &&
datadog-ci metric --no-fail --level pipeline --metrics bytesize.turbopack.aarch64-unknown-linux-gnu:$BYTESIZE
- host: ubuntu-latest
target: 'aarch64-unknown-linux-musl'
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2022-10-24-alpine
build: >-
set -e &&
apk add --no-cache libc6-compat &&
export JEMALLOC_SYS_WITH_LG_PAGE=16 &&
npm install -g @datadog/datadog-ci &&
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 &&
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add aarch64-unknown-linux-musl &&
turbo run build-native -- --target aarch64-unknown-linux-musl &&
llvm-strip -x packages/next-swc/native/next-swc.*.node
export FILENAME=$(ls packages/next-swc/native/next-swc.*.node)
export BYTESIZE=$(stat -c %s $FILENAME)
datadog-ci metric --no-fail --level pipeline --metrics bytesize.turbopack.aarch64-unknown-linux-musl:$BYTESIZE
- host: windows-latest
target: 'aarch64-pc-windows-msvc'
build: |
npm install -g @datadog/datadog-ci
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
turbo run build-native-no-plugin-woa-release -- --target aarch64-pc-windows-msvc
export FILENAME=$(ls packages/next-swc/native/next-swc.*.node)
export BYTESIZE=$(stat -c %s $FILENAME)
datadog-ci metric --no-fail --level pipeline --metrics bytesize.turbopack.aarch64-pc-windows-msvc:$BYTESIZE
# if: ${{ needs.build.outputs.isRelease == 'true' }}
needs: build
name: stable - ${{ matrix.settings.target }} - node@16
runs-on: ${{ matrix.settings.host }}
env:
TURBO_TEAM: 'vercel'
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: 'true'
DATADOG_API_KEY: ${{ secrets.DATA_DOG_API_KEY }}
steps:
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
if: ${{ matrix.settings.host == 'ubuntu-latest' }}
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
if: ${{ matrix.settings.host == 'ubuntu-latest' }}
- name: tune windows network
run: Disable-NetAdapterChecksumOffload -Name * -TcpIPv4 -UdpIPv4 -TcpIPv6 -UdpIPv6
if: ${{ matrix.settings.host == 'windows-latest' }}
- name: tune mac network
run: sudo sysctl -w net.link.generic.system.hwcksum_tx=0 && sudo sysctl -w net.link.generic.system.hwcksum_rx=0
if: ${{ matrix.settings.host == 'macos-latest' }}
# we use checkout here instead of the build cache since
# it can fail to restore in different OS'
- uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
if: ${{ !matrix.settings.docker }}
with:
node-version: ${{ env.NODE_LTS_VERSION }}
check-latest: true

- name: Install
uses: actions-rs/toolchain@v1
if: ${{ !matrix.settings.docker }}
with:
profile: minimal
override: true
toolchain: ${{ env.RUST_TOOLCHAIN }}
target: ${{ matrix.settings.target }}

- name: Cache cargo registry
uses: actions/cache@v3
timeout-minutes: 5
with:
path: ~/.cargo/registry
key: ${{ matrix.settings.target }}-cargo-registry

- name: Cache cargo index
uses: actions/cache@v3
timeout-minutes: 5
with:
path: ~/.cargo/git
key: ${{ matrix.settings.target }}-cargo-index

- name: normalize versions
run: node scripts/normalize-version-bump.js

- name: Setup toolchain
run: ${{ matrix.settings.setup }}
if: ${{ matrix.settings.setup }}
shell: bash

- name: Build in docker
uses: addnab/docker-run-action@v3
if: ${{ matrix.settings.docker }}
with:
image: ${{ matrix.settings.docker }}
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: ${{ matrix.settings.build }}

- name: 'Build'
run: ${{ matrix.settings.build }}
if: ${{ !matrix.settings.docker }}
shell: bash

test-dev:
name: test dev
needs: ['build']
Expand Down

0 comments on commit 09f3cfa

Please sign in to comment.