From cd47fcc30ec8cfd9ea35b940c406645b59a8ef40 Mon Sep 17 00:00:00 2001 From: David Konsumer Date: Wed, 8 Jun 2022 21:56:54 -0700 Subject: [PATCH 1/2] crossbuild for arm/arm64 --- .github/workflows/release.yml | 60 +++++++++++++++++++++++++++++++++++ tools/crossbuild.sh | 9 ++++++ 2 files changed, 69 insertions(+) create mode 100644 tools/crossbuild.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 41ad2fd..67e9150 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,6 +21,66 @@ jobs: body: This is an automated release for ${{ github.ref }}. It will be used to speed up `npm install`. env: GITHUB_TOKEN: ${{ github.token }} + linux-arm: + runs-on: ubuntu-latest + needs: create_release + steps: + - name: checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Cache Node Dependencies + id: cache + uses: actions/cache@v2 + with: + path: ./node_modules + key: modules-${{ hashFiles('package-lock.json') }} + - name: Install Node Dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: npm ci --ignore-scripts + - name: Build for arm + run: docker run --platform linux/arm -it --rm -v "${PWD}:/work" -w /work node ./tools/crossbuild.sh + - name: upload linux artifact + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ./build/Release/node-raylib.node + asset_name: node-raylib-4.0-linux-arm.node + asset_content_type: application/octet-stream + linux-arm64: + runs-on: ubuntu-latest + needs: create_release + steps: + - name: checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Cache Node Dependencies + id: cache + uses: actions/cache@v2 + with: + path: ./node_modules + key: modules-${{ hashFiles('package-lock.json') }} + - name: Install Node Dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: npm ci --ignore-scripts + - name: Build for arm + run: docker run --platform linux/arm64 -it --rm -v "${PWD}:/work" -w /work node ./tools/crossbuild.sh + - name: upload linux artifact + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ./build/Release/node-raylib.node + asset_name: node-raylib-4.0-linux-arm64.node + asset_content_type: application/octet-stream linux: runs-on: ubuntu-latest needs: create_release diff --git a/tools/crossbuild.sh b/tools/crossbuild.sh new file mode 100644 index 0000000..cc6f2d7 --- /dev/null +++ b/tools/crossbuild.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# this is used inside a docker (running with qemu binfmt) to easily crossbuild project +# run with docker run --platform linux/arm64 -it --rm -v "${PWD}:/work" -w /work node ./tools/crossbuild.sh + +apt update +apt install -y xorg-dev libglu1-mesa-dev +npm i +npm run compile \ No newline at end of file From c193e4036a9e9ea06c6fb01b731c4ee3cd302d17 Mon Sep 17 00:00:00 2001 From: David Konsumer Date: Wed, 8 Jun 2022 22:20:54 -0700 Subject: [PATCH 2/2] add crossbuild --- .github/workflows/release.yml | 6 ------ tools/crossbuild.sh | 6 +++--- 2 files changed, 3 insertions(+), 9 deletions(-) mode change 100644 => 100755 tools/crossbuild.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 67e9150..caef6d0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,9 +37,6 @@ jobs: with: path: ./node_modules key: modules-${{ hashFiles('package-lock.json') }} - - name: Install Node Dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: npm ci --ignore-scripts - name: Build for arm run: docker run --platform linux/arm -it --rm -v "${PWD}:/work" -w /work node ./tools/crossbuild.sh - name: upload linux artifact @@ -67,9 +64,6 @@ jobs: with: path: ./node_modules key: modules-${{ hashFiles('package-lock.json') }} - - name: Install Node Dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: npm ci --ignore-scripts - name: Build for arm run: docker run --platform linux/arm64 -it --rm -v "${PWD}:/work" -w /work node ./tools/crossbuild.sh - name: upload linux artifact diff --git a/tools/crossbuild.sh b/tools/crossbuild.sh old mode 100644 new mode 100755 index cc6f2d7..db8bc02 --- a/tools/crossbuild.sh +++ b/tools/crossbuild.sh @@ -3,7 +3,7 @@ # this is used inside a docker (running with qemu binfmt) to easily crossbuild project # run with docker run --platform linux/arm64 -it --rm -v "${PWD}:/work" -w /work node ./tools/crossbuild.sh -apt update -apt install -y xorg-dev libglu1-mesa-dev -npm i +apt-get update +apt-get install -y xorg-dev libglu1-mesa-dev cmake +npm ci npm run compile \ No newline at end of file