Skip to content

Commit cd47fcc

Browse files
committed
crossbuild for arm/arm64
1 parent d0b723d commit cd47fcc

2 files changed

Lines changed: 69 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,66 @@ jobs:
2121
body: This is an automated release for ${{ github.ref }}. It will be used to speed up `npm install`.
2222
env:
2323
GITHUB_TOKEN: ${{ github.token }}
24+
linux-arm:
25+
runs-on: ubuntu-latest
26+
needs: create_release
27+
steps:
28+
- name: checkout
29+
uses: actions/checkout@v2
30+
with:
31+
fetch-depth: 0
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@v2
34+
- name: Cache Node Dependencies
35+
id: cache
36+
uses: actions/cache@v2
37+
with:
38+
path: ./node_modules
39+
key: modules-${{ hashFiles('package-lock.json') }}
40+
- name: Install Node Dependencies
41+
if: steps.cache.outputs.cache-hit != 'true'
42+
run: npm ci --ignore-scripts
43+
- name: Build for arm
44+
run: docker run --platform linux/arm -it --rm -v "${PWD}:/work" -w /work node ./tools/crossbuild.sh
45+
- name: upload linux artifact
46+
uses: actions/upload-release-asset@v1
47+
env:
48+
GITHUB_TOKEN: ${{ github.token }}
49+
with:
50+
upload_url: ${{ needs.create_release.outputs.upload_url }}
51+
asset_path: ./build/Release/node-raylib.node
52+
asset_name: node-raylib-4.0-linux-arm.node
53+
asset_content_type: application/octet-stream
54+
linux-arm64:
55+
runs-on: ubuntu-latest
56+
needs: create_release
57+
steps:
58+
- name: checkout
59+
uses: actions/checkout@v2
60+
with:
61+
fetch-depth: 0
62+
- name: Set up QEMU
63+
uses: docker/setup-qemu-action@v2
64+
- name: Cache Node Dependencies
65+
id: cache
66+
uses: actions/cache@v2
67+
with:
68+
path: ./node_modules
69+
key: modules-${{ hashFiles('package-lock.json') }}
70+
- name: Install Node Dependencies
71+
if: steps.cache.outputs.cache-hit != 'true'
72+
run: npm ci --ignore-scripts
73+
- name: Build for arm
74+
run: docker run --platform linux/arm64 -it --rm -v "${PWD}:/work" -w /work node ./tools/crossbuild.sh
75+
- name: upload linux artifact
76+
uses: actions/upload-release-asset@v1
77+
env:
78+
GITHUB_TOKEN: ${{ github.token }}
79+
with:
80+
upload_url: ${{ needs.create_release.outputs.upload_url }}
81+
asset_path: ./build/Release/node-raylib.node
82+
asset_name: node-raylib-4.0-linux-arm64.node
83+
asset_content_type: application/octet-stream
2484
linux:
2585
runs-on: ubuntu-latest
2686
needs: create_release

tools/crossbuild.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
# this is used inside a docker (running with qemu binfmt) to easily crossbuild project
4+
# run with docker run --platform linux/arm64 -it --rm -v "${PWD}:/work" -w /work node ./tools/crossbuild.sh
5+
6+
apt update
7+
apt install -y xorg-dev libglu1-mesa-dev
8+
npm i
9+
npm run compile

0 commit comments

Comments
 (0)