Skip to content

Commit 4722bfc

Browse files
authored
Add linux-x64-musl, linux-arm-libc, linux-arm-musl builds (#7)
Add three new supported build targets: - linux-x64-musl - linux-arm-libc - linux-arm-musl To support the alternate libcs, I've added `--tag-libc` to all prebuildify invocations. [docs here](https://www.npmjs.com/package/prebuildify#options)
1 parent 3ad4e84 commit 4722bfc

File tree

6 files changed

+68
-8
lines changed

6 files changed

+68
-8
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
test

.github/workflows/publish.yml

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,46 @@ jobs:
4040
sudo apt-get update && \
4141
sudo apt-get install -y software-properties-common git build-essential clang libssl-dev libkrb5-dev libc++-dev wget python3
4242
npm ci
43-
npx prebuildify --napi --strip -t "$(node --version | tr -d 'v')"
43+
npx prebuildify --napi --strip --tag-libc -t "$(node --version | tr -d 'v')"
4444
- uses: actions/upload-artifact@v4
4545
with:
4646
name: prebuild-${{ runner.os }}-${{ runner.arch }}
47-
path: prebuilds
47+
path: ./prebuilds
48+
retention-days: 14
49+
50+
cross-compile:
51+
name: "cross compile linux/arm"
52+
runs-on: ubuntu-20.04
53+
steps:
54+
- uses: actions/checkout@v4
55+
- uses: docker/setup-qemu-action@v3
56+
- name: build linux glibc arm
57+
run: |
58+
docker build --platform=linux/arm64 --tag nodegit-linux-glibc-arm64 -f scripts/Dockerfile.debian .
59+
docker create --platform=linux/arm64 --name nodegit-linux-glibc-arm64 nodegit-linux-glibc-arm64
60+
docker cp "nodegit-linux-glibc-arm64:/app/prebuilds" .
61+
- name: build linux musl x64
62+
run: |
63+
docker build --platform=linux/amd64 --tag nodegit-linux-musl-amd64 -f scripts/Dockerfile.alpine .
64+
docker create --platform=linux/amd64 --name nodegit-linux-musl-amd64 nodegit-linux-musl-amd64
65+
docker cp "nodegit-linux-musl-amd64:/app/prebuilds" .
66+
- name: build linux musl arm
67+
run: |
68+
docker build --platform=linux/arm64 --tag nodegit-linux-musl-arm64 -f scripts/Dockerfile.alpine .
69+
docker create --platform=linux/arm64 --name nodegit-linux-musl-arm64 nodegit-linux-musl-arm64
70+
docker cp "nodegit-linux-musl-arm64:/app/prebuilds" .
71+
- name: "list the generated files"
72+
run: find prebuilds
73+
- uses: actions/upload-artifact@v4
74+
with:
75+
name: prebuild-linux-arm64
76+
path: ./prebuilds
4877
retention-days: 14
4978

5079
# https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions
5180
publish:
5281
runs-on: ubuntu-latest
53-
needs: [build]
82+
needs: [build, cross-compile]
5483
permissions:
5584
id-token: write
5685
steps:
@@ -71,13 +100,19 @@ jobs:
71100
- name: copy libs
72101
run: |
73102
set -x
103+
mkdir -p prebuilds/linux-arm64
104+
mkdir -p prebuilds/linux-x64
105+
mkdir -p prebuilds/darwin-arm64
74106
find ${{ steps.download.outputs.download-path }}
75-
mv ${{ steps.download.outputs.download-path }}/*/* ./prebuilds
107+
mv ${{ steps.download.outputs.download-path}}/prebuild-Linux-X64/linux-x64/* ./prebuilds/linux-x64/
108+
mv ${{ steps.download.outputs.download-path}}/prebuild-linux-arm64/linux-arm64/* ./prebuilds/linux-arm64/
109+
mv ${{ steps.download.outputs.download-path}}/prebuild-linux-arm64/linux-x64/* ./prebuilds/linux-x64/
110+
mv ${{ steps.download.outputs.download-path}}/prebuild-macOS-ARM64/darwin-arm64/* ./prebuilds/darwin-arm64/
76111
find ./prebuilds
77112
- name: npm install
78113
run: npm ci
79114
- name: publish
80115
run: |
81-
(cat "$NPM_CONFIG_USERCONFIG" || true) && echo "token: ${NODE_AUTH_TOKEN:0:10}" && npm publish --provenance --access public
116+
(cat "$NPM_CONFIG_USERCONFIG" || true) && npm publish --provenance --access public
82117
env:
83118
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@readme/nodegit",
33
"description": "Node.js libgit2 asynchronous native bindings",
4-
"version": "1.0.0",
4+
"version": "1.1.0-alpha.7",
55
"homepage": "http://nodegit.org",
66
"keywords": [
77
"libgit2",

scripts/Dockerfile.alpine

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM node:20.11.1-alpine3.19
2+
3+
RUN apk add build-base git krb5-dev libgit2-dev libssh-dev pkgconfig python3 tzdata
4+
5+
ADD . /app
6+
WORKDIR /app
7+
8+
RUN npm ci && \
9+
npx prebuildify --napi --strip --tag-libc -t "$(node --version | tr -d 'v')"

scripts/Dockerfile.debian

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM node:20.11.1-bullseye
2+
3+
ENV DEBIAN_FRONTEND noninteractive
4+
ENV LC_ALL en_US.UTF-8
5+
ENV LANG ${LC_ALL}
6+
7+
RUN apt-get update -y && \
8+
apt-get install -y software-properties-common git build-essential clang libssl-dev libkrb5-dev libc++-dev wget python3
9+
10+
ADD . /app
11+
WORKDIR /app
12+
13+
RUN npm ci && \
14+
npx prebuildify --napi --strip --tag-libc -t "$(node --version | tr -d 'v')"

0 commit comments

Comments
 (0)