Skip to content

Commit c12fe0f

Browse files
authored
Merge pull request #156 from RobLoach/crossbuild
Crossbuild
2 parents d0b723d + c193e40 commit c12fe0f

2 files changed

Lines changed: 63 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,60 @@ 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: Build for arm
41+
run: docker run --platform linux/arm -it --rm -v "${PWD}:/work" -w /work node ./tools/crossbuild.sh
42+
- name: upload linux artifact
43+
uses: actions/upload-release-asset@v1
44+
env:
45+
GITHUB_TOKEN: ${{ github.token }}
46+
with:
47+
upload_url: ${{ needs.create_release.outputs.upload_url }}
48+
asset_path: ./build/Release/node-raylib.node
49+
asset_name: node-raylib-4.0-linux-arm.node
50+
asset_content_type: application/octet-stream
51+
linux-arm64:
52+
runs-on: ubuntu-latest
53+
needs: create_release
54+
steps:
55+
- name: checkout
56+
uses: actions/checkout@v2
57+
with:
58+
fetch-depth: 0
59+
- name: Set up QEMU
60+
uses: docker/setup-qemu-action@v2
61+
- name: Cache Node Dependencies
62+
id: cache
63+
uses: actions/cache@v2
64+
with:
65+
path: ./node_modules
66+
key: modules-${{ hashFiles('package-lock.json') }}
67+
- name: Build for arm
68+
run: docker run --platform linux/arm64 -it --rm -v "${PWD}:/work" -w /work node ./tools/crossbuild.sh
69+
- name: upload linux artifact
70+
uses: actions/upload-release-asset@v1
71+
env:
72+
GITHUB_TOKEN: ${{ github.token }}
73+
with:
74+
upload_url: ${{ needs.create_release.outputs.upload_url }}
75+
asset_path: ./build/Release/node-raylib.node
76+
asset_name: node-raylib-4.0-linux-arm64.node
77+
asset_content_type: application/octet-stream
2478
linux:
2579
runs-on: ubuntu-latest
2680
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-get update
7+
apt-get install -y xorg-dev libglu1-mesa-dev cmake
8+
npm ci
9+
npm run compile

0 commit comments

Comments
 (0)