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

Update to use repo specific napi instead of npx (#30914)

* 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
parent 9439d271
...@@ -598,6 +598,10 @@ jobs: ...@@ -598,6 +598,10 @@ jobs:
restore-keys: | restore-keys: |
next-swc-cargo-cache-ubuntu-18.04 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/cli@1.2.1
- name: Build - name: Build
if: ${{ steps.binary-cache.outputs.cache-hit != 'true' && steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} if: ${{ steps.binary-cache.outputs.cache-hit != 'true' && steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
run: yarn build-native run: yarn build-native
...@@ -674,9 +678,13 @@ jobs: ...@@ -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 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' }} 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: 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') - run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change id: docs-change
- name: Setup node - name: Setup node
...@@ -756,7 +764,12 @@ jobs: ...@@ -756,7 +764,12 @@ jobs:
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 32 CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 32
CARGO_PROFILE_RELEASE_LTO: 'false' CARGO_PROFILE_RELEASE_LTO: 'false'
steps: 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') - run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change id: docs-change
...@@ -812,7 +825,12 @@ jobs: ...@@ -812,7 +825,12 @@ jobs:
name: next-swc - windows-aarch64 - node@14 name: next-swc - windows-aarch64 - node@14
runs-on: windows-latest runs-on: windows-latest
steps: 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') - run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change id: docs-change
...@@ -859,7 +877,12 @@ jobs: ...@@ -859,7 +877,12 @@ jobs:
name: next-swc - linux-musl - node@lts name: next-swc - linux-musl - node@lts
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: 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') - run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change id: docs-change
...@@ -898,7 +921,7 @@ jobs: ...@@ -898,7 +921,7 @@ jobs:
- name: 'Build' - name: 'Build'
if: ${{ steps.binary-cache.outputs.cache-hit != 'true' && steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} if: ${{ steps.binary-cache.outputs.cache-hit != 'true' && steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
run: | 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/cli@1.2.1 && yarn build-native --release --target x86_64-unknown-linux-musl"
- name: Upload artifact - name: Upload artifact
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
...@@ -915,7 +938,12 @@ jobs: ...@@ -915,7 +938,12 @@ jobs:
steps: steps:
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset - 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') - run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change id: docs-change
...@@ -975,7 +1003,12 @@ jobs: ...@@ -975,7 +1003,12 @@ jobs:
name: next-swc - aarch64-unknown-linux-musl - node@14 name: next-swc - aarch64-unknown-linux-musl - node@14
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
steps: 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') - run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change id: docs-change
...@@ -1037,7 +1070,12 @@ jobs: ...@@ -1037,7 +1070,12 @@ jobs:
steps: steps:
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset - 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') - run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change id: docs-change
...@@ -1097,7 +1135,12 @@ jobs: ...@@ -1097,7 +1135,12 @@ jobs:
name: next-swc - Android - aarch64 name: next-swc - Android - aarch64
runs-on: macos-latest runs-on: macos-latest
steps: 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') - run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change id: docs-change
......
...@@ -68,6 +68,10 @@ jobs: ...@@ -68,6 +68,10 @@ jobs:
restore-keys: | restore-keys: |
next-swc-cargo-cache-ubuntu-18.04 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/cli@1.2.1
- name: Build - name: Build
if: ${{ steps.binary-cache.outputs.cache-hit != 'true' && steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} if: ${{ steps.binary-cache.outputs.cache-hit != 'true' && steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }}
run: yarn build-native run: yarn build-native
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
"types": "tsc --declaration --emitDeclarationOnly --declarationDir dist", "types": "tsc --declaration --emitDeclarationOnly --declarationDir dist",
"typescript": "tsc --noEmit --declaration", "typescript": "tsc --noEmit --declaration",
"ncc-compiled": "ncc cache clean && taskr ncc", "ncc-compiled": "ncc cache clean && taskr ncc",
"build-native": "npx -p @napi-rs/cli@1.2.1 napi build --platform --cargo-cwd build/swc native" "build-native": "napi build --platform --cargo-cwd build/swc native"
}, },
"taskr": { "taskr": {
"requires": [ "requires": [
...@@ -153,7 +153,7 @@ ...@@ -153,7 +153,7 @@
"@babel/preset-typescript": "7.15.0", "@babel/preset-typescript": "7.15.0",
"@babel/traverse": "7.15.0", "@babel/traverse": "7.15.0",
"@babel/types": "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", "@next/polyfill-nomodule": "12.0.3-canary.3",
"@peculiar/webcrypto": "1.1.7", "@peculiar/webcrypto": "1.1.7",
"@taskr/clear": "1.1.0", "@taskr/clear": "1.1.0",
......
This diff is collapsed.
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