feat(crypto-node): prebuilts for arm
This commit is contained in:
parent
d84a946411
commit
03a156e9a8
2 changed files with 23 additions and 9 deletions
22
.github/workflows/node-prebuilt.yaml
vendored
22
.github/workflows/node-prebuilt.yaml
vendored
|
@ -17,17 +17,31 @@ jobs:
|
|||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ubuntu-latest, windows-latest, macos-latest]
|
||||
platform:
|
||||
- ubuntu-20.04
|
||||
- macos-13
|
||||
- macos-14
|
||||
- windows-2022
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.commit }}
|
||||
- if: matrix.platform == 'macos-latest'
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18.x
|
||||
- if: ${{ startsWith(matrix.platform, 'windows') }}
|
||||
run: pip.exe install setuptools
|
||||
- if: ${{ !startsWith(matrix.platform, 'windows') && !startsWith(matrix.platform, 'macos') }}
|
||||
run: python3 -m pip install setuptools
|
||||
- if: ${{ startsWith(matrix.platform, 'macos') }}
|
||||
run: python3 -m pip install --break-system-packages setuptools
|
||||
- uses: ./.github/actions/init
|
||||
- name: 'Build'
|
||||
run: pnpx prebuildify@6.0.0 --napi --strip
|
||||
run: npx -y prebuildify@6.0.1 --napi --strip
|
||||
working-directory: packages/crypto-node
|
||||
- if: ${{ !startsWith(matrix.platform, 'macos') }}
|
||||
name: 'Build (arm64)'
|
||||
run: npx -y prebuildify@6.0.1 --napi --strip --arch arm64
|
||||
working-directory: packages/crypto-node
|
||||
- name: 'Upload'
|
||||
uses: actions/upload-artifact@v4
|
||||
|
|
|
@ -7,10 +7,11 @@ const { Readable } = require('stream')
|
|||
const git = require('../../scripts/git-utils')
|
||||
|
||||
const GITHUB_TOKEN = process.env.GITHUB_TOKEN
|
||||
const SKIP_PREBUILT = process.env.BUILD_FOR_DOCS === '1'
|
||||
let SKIP_PREBUILT = process.env.BUILD_FOR_DOCS === '1'
|
||||
|
||||
if (!GITHUB_TOKEN && !SKIP_PREBUILT) {
|
||||
throw new Error('GITHUB_TOKEN is required to publish crypto-node')
|
||||
console.warn('GITHUB_TOKEN is required to publish crypto-node, skipping prebuilt artifacts')
|
||||
SKIP_PREBUILT = true
|
||||
}
|
||||
|
||||
const GITHUB_HEADERS = {
|
||||
|
@ -36,7 +37,6 @@ async function findArtifactsByHash(hash) {
|
|||
|
||||
if (parts[0] === 'prebuilt' &&
|
||||
PLATFORMS.includes(parts[1]) &&
|
||||
parts[2] === 'latest' &&
|
||||
parts[3] === hash) {
|
||||
return artifacts
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ async function runWorkflow(commit, hash) {
|
|||
|
||||
// wait for the workflow to finish
|
||||
// github api is awesome and doesn't return the run id, so let's just assume it's the last one
|
||||
await new Promise((resolve) => setTimeout(resolve, 5000))
|
||||
const runsRes = await fetch(`${API_PREFIX}/runs`, {
|
||||
headers: GITHUB_HEADERS,
|
||||
}).then((r) => r.json())
|
||||
|
@ -93,7 +94,6 @@ async function runWorkflow(commit, hash) {
|
|||
|
||||
if (parts[0] !== 'prebuilt' ||
|
||||
!PLATFORMS.includes(parts[1]) ||
|
||||
parts[2] !== 'latest' ||
|
||||
parts[3] !== hash) {
|
||||
throw new Error(`Invalid artifact name: ${it.name}`)
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ async function extractArtifacts(artifacts) {
|
|||
fs.mkdirSync(path.join(__dirname, 'dist/prebuilds'), { recursive: true })
|
||||
await Promise.all(
|
||||
artifacts.map(async (it) => {
|
||||
const platform = it.name.split('-')[1]
|
||||
const platform = it.name.split('-').slice(1, 3).join('-')
|
||||
|
||||
const res = await fetch(it.archive_download_url, {
|
||||
headers: GITHUB_HEADERS,
|
||||
|
|
Loading…
Reference in a new issue