-
-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #459 from zeromq/gh
- Loading branch information
Showing
7 changed files
with
128 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: CI | ||
on: | ||
pull_request: | ||
push: | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
Build: | ||
if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-20.04 | ||
- macos-latest | ||
- windows-latest | ||
node_version: | ||
- 14 | ||
node_arch: | ||
- x64 | ||
include: | ||
- os: windows-latest | ||
node_version: 14 | ||
node_arch: x86 | ||
# - os: macos-11.0 | ||
# node_version: 15 | ||
# node_arch: arm64 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node_version }} | ||
architecture: ${{ matrix.node_arch }} | ||
|
||
- name: Install Dependencies and Build | ||
run: npm install | ||
|
||
- name: Prebuild | ||
run: npm run prebuild | ||
env: | ||
ARCH: ${{ matrix.node_arch }} | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: ./prebuilds | ||
|
||
Skip: | ||
if: contains(github.event.head_commit.message, '[skip ci]') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Skip CI 🚫 | ||
run: echo skip ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* eslint-disable @typescript-eslint/camelcase */ | ||
|
||
import {spawnSync} from "child_process" | ||
|
||
main().catch(e => { | ||
throw e | ||
}) | ||
|
||
async function main() { | ||
console.log("Building distribution binary...") | ||
|
||
const prebuildArch = getNodearch(process.env.ARCH) | ||
|
||
if (process.env.TRIPLE) { | ||
const TRIPLE = process.env.TRIPLE | ||
|
||
const GCC = process.env.GCC | ||
process.env.CC = `${TRIPLE}-gcc-${GCC}` | ||
process.env.CXX = `${TRIPLE}-g++-${GCC}` | ||
|
||
const STRIP = `${TRIPLE}-strip` | ||
process.env.PREBUILD_STRIP_BIN = STRIP | ||
|
||
process.env.npm_config_arch = prebuildArch | ||
process.env.npm_config_target_arch = prebuildArch | ||
process.env.PREBUILD_arch = prebuildArch | ||
|
||
process.env.ZMQ_BUILD_OPTIONS = `--host=${TRIPLE}` | ||
} | ||
|
||
let prebuildScript = `prebuildify --napi --arch=${prebuildArch} -t 12.0.0 -t electron@9.4.4 --strip` | ||
|
||
if (process.platform == "linux") { | ||
prebuildScript = `${prebuildScript} --tag-libc` | ||
} | ||
if (process.env.ALPINE_CHROOT) { | ||
prebuildScript = `/alpine/enter-chroot ${prebuildScript}` | ||
} | ||
|
||
spawnSync(prebuildScript, { | ||
shell: true, | ||
stdio: "inherit", | ||
encoding: "utf8", | ||
}) | ||
} | ||
|
||
function getNodearch(arch: string | undefined): string { | ||
if (!arch) { | ||
return process.arch | ||
} | ||
if (arch === "x86") { | ||
return "ia32" | ||
} else { | ||
return arch | ||
} | ||
} |