Skip to content

Commit

Permalink
Update to use repo specific napi instead of npx (vercel#30914)
Browse files Browse the repository at this point in the history
* Update to use repo specific napi instead of npx

* download build cache

* test running musl build

* Ensure napi is available for build-native-dev

* install globally in docker

* re-add isRelease check
  • Loading branch information
ijjk authored Nov 3, 2021
1 parent 9439d27 commit a3a5926
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 360 deletions.
63 changes: 53 additions & 10 deletions .github/workflows/build_test_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,10 @@ jobs:
restore-keys: |
next-swc-cargo-cache-ubuntu-18.04
# since the repo's dependencies aren't installed we need
# to install napi globally
- run: npm i -g @napi-rs/[email protected]

- name: Build
if: ${{ steps.binary-cache.outputs.cache-hit != 'true' && steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
run: yarn build-native
Expand Down Expand Up @@ -674,9 +678,13 @@ jobs:
run: sudo sysctl -w net.link.generic.system.hwcksum_tx=0 && sudo sysctl -w net.link.generic.system.hwcksum_rx=0
if: ${{ matrix.os == 'macos-latest' }}

- uses: actions/checkout@v2
- uses: actions/cache@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
id: restore-build
with:
fetch-depth: 25
path: ./*
key: ${{ github.sha }}

- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change
- name: Setup node
Expand Down Expand Up @@ -756,7 +764,12 @@ jobs:
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 32
CARGO_PROFILE_RELEASE_LTO: 'false'
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}

- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change
Expand Down Expand Up @@ -812,7 +825,12 @@ jobs:
name: next-swc - windows-aarch64 - node@14
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}

- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change
Expand Down Expand Up @@ -859,7 +877,12 @@ jobs:
name: next-swc - linux-musl - node@lts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}

- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change
Expand Down Expand Up @@ -898,7 +921,7 @@ jobs:
- name: 'Build'
if: ${{ steps.binary-cache.outputs.cache-hit != 'true' && steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
run: |
docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd)/packages/next:/build -w /build builder sh -c "yarn build-native --release --target x86_64-unknown-linux-musl"
docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd)/packages/next:/build -w /build builder sh -c "npm i -g @napi-rs/[email protected] && yarn build-native --release --target x86_64-unknown-linux-musl"
- name: Upload artifact
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
Expand All @@ -915,7 +938,12 @@ jobs:
steps:
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset

- uses: actions/checkout@v2
- uses: actions/cache@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}

- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change
Expand Down Expand Up @@ -975,7 +1003,12 @@ jobs:
name: next-swc - aarch64-unknown-linux-musl - node@14
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}

- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change
Expand Down Expand Up @@ -1037,7 +1070,12 @@ jobs:
steps:
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset

- uses: actions/checkout@v2
- uses: actions/cache@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}

- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change
Expand Down Expand Up @@ -1097,7 +1135,12 @@ jobs:
name: next-swc - Android - aarch64
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}

- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pull_request_stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ jobs:
restore-keys: |
next-swc-cargo-cache-ubuntu-18.04
# since the repo's dependencies aren't installed we need
# to install napi globally
- run: npm i -g @napi-rs/[email protected]

- name: Build
if: ${{ steps.binary-cache.outputs.cache-hit != 'true' && steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
run: yarn build-native
Expand Down
4 changes: 2 additions & 2 deletions packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"types": "tsc --declaration --emitDeclarationOnly --declarationDir dist",
"typescript": "tsc --noEmit --declaration",
"ncc-compiled": "ncc cache clean && taskr ncc",
"build-native": "npx -p @napi-rs/[email protected] napi build --platform --cargo-cwd build/swc native"
"build-native": "napi build --platform --cargo-cwd build/swc native"
},
"taskr": {
"requires": [
Expand Down Expand Up @@ -153,7 +153,7 @@
"@babel/preset-typescript": "7.15.0",
"@babel/traverse": "7.15.0",
"@babel/types": "7.15.0",
"@napi-rs/cli": "1.1.0",
"@napi-rs/cli": "1.2.1",
"@next/polyfill-nomodule": "12.0.3-canary.3",
"@peculiar/webcrypto": "1.1.7",
"@taskr/clear": "1.1.0",
Expand Down
Loading

0 comments on commit a3a5926

Please sign in to comment.