Skip to content

Commit

Permalink
github actions: build node addon on linux using zig
Browse files Browse the repository at this point in the history
  • Loading branch information
eilvelia committed May 27, 2024
1 parent 5e8b782 commit a3f7bf6
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions .github/workflows/publish-tdl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,21 @@ jobs:
with:
node-version: lts/*
cache: npm
- uses: goto-bus-stop/setup-zig@v2
- name: Install dependencies
run: npm install
- name: Clean old binaries
run: npm run clean -w tdl
- name: Prebuildify in docker
- name: Prebuildify (Linux via zig)
if: runner.os == 'Linux'
run: |
# docker run -u root -v $(pwd):/app ghcr.io/prebuild/centos7-devtoolset7:2 \
# npm run make-prebuild -w tdl -- --tag-libc
cat > prebuilt-node-addon.sh <<EOF
set -ex
yum update -y
yum install -y centos-release-scl
yum install -y devtoolset-9 make python3
yum install https://rpm.nodesource.com/pub_16.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y
yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1
source /opt/rh/devtoolset-9/enable
gcc --version
ldd --version
cd /app
npm run make-prebuild -w tdl -- --tag-libc
EOF
docker run -v $(pwd):/app centos:7 \
bash /app/prebuilt-node-addon.sh
CC="zig cc" CXX="zig c++ -target x86_64-linux-gnu.2.17" \
npm run make-prebuild -w tdl -- --arch x64 --tag-libc
ldd packages/tdl/prebuilds/*/*.node
du -hs packages/tdl/prebuilds/*/*.node
- name: Prebuildify
if: runner.os != 'Linux'
run: npm run make-prebuild -w tdl
run: npm run make-prebuild -w tdl -- --arch x64
- name: "Prebuildify: Crosscompile to arm64 Apple Silicon"
if: runner.os == 'macOS'
run: npm run make-prebuild -w tdl -- --arch arm64
Expand Down

0 comments on commit a3f7bf6

Please sign in to comment.