Skip to content

Commit

Permalink
rebuild node-pty on chroot for linux arm builds
Browse files Browse the repository at this point in the history
add linux armhf builds
  • Loading branch information
LabhanshAgrawal committed Jun 14, 2023
1 parent 5ec276e commit 20de964
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 29 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,71 @@ jobs:
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock', 'app/yarn.lock') }}

build-linux-arm:
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- name: armv7l
cpu: cortex-a8
image: raspios_lite:latest
- name: arm64
cpu: cortex-a53
image: raspios_lite_arm64:latest
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock', 'app/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
run: yarn install
- name: Compile
run: yarn run build
- name: rebuild node-pty
uses: pguyot/arm-runner-action@v2.5.2
with:
image_additional_mb: 2000
base_image: ${{ matrix.image }}
cpu: ${{ matrix.cpu }}
shell: bash
copy_artifact_path: target/node_modules/node-pty
copy_artifact_dest: target/node_modules
commands: |
wget https://nodejs.org/dist/v18.16.0/node-v18.16.0-linux-${{ matrix.name }}.tar.xz
tar -xJf node-v18.16.0-linux-${{ matrix.name }}.tar.xz
sudo cp node-v18.16.0-linux-${{ matrix.name }}/* /usr/local/ -R
npm run rebuild-node-pty
- name: chown node-pty
run: |
sudo chown -R $USER:$USER target/node_modules/node-pty
- name: Prepare v8 snapshot
if: matrix.name == 'armv7l'
run: |
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y libpcre2-8-0=10.34-7 --allow-downgrades
sudo apt install -y libglib2.0-0:i386 libexpat1:i386
npm_config_arch=armv7l yarn run v8-snapshot:arch
- name: Build
run: yarn run electron-builder -l deb rpm AppImage --${{ matrix.name }} -c electron-builder-linux-ci.json
- name: Archive Build Artifacts
uses: LabhanshAgrawal/upload-artifact@v3
with:
path: |
dist/*.snap
dist/*.AppImage
dist/*.deb
dist/*.rpm
6 changes: 6 additions & 0 deletions electron-builder-linux-ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "http://json.schemastore.org/electron-builder",
"extends": "electron-builder.json",
"afterSign": null,
"npmRebuild": false
}
31 changes: 4 additions & 27 deletions electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,10 @@
"linux": {
"category": "TerminalEmulator",
"target": [
{
"target": "deb",
"arch": [
"x64",
"arm64"
]
},
{
"target": "AppImage",
"arch": [
"x64",
"arm64"
]
},
{
"target": "rpm",
"arch": [
"x64",
"arm64"
]
},
{
"target": "snap",
"arch": [
"x64"
]
}
"deb",
"AppImage",
"rpm",
"snap"
]
},
"win": {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
"start": "echo 'please run `yarn run dev` in one tab and then `yarn run app` in another one'",
"app": "cross-env ELECTRONMON_LOGLEVEL=error electronmon target",
"dev": "concurrently -n \"Webpack,TypeScript\" -c \"cyan.bold,blue.bold\" \"webpack -w\" \"tsc --build -v --pretty --watch --preserveWatchOutput\" -k",
"build": "cross-env NODE_ENV=production webpack && tsc -b -v",
"build": "cross-env NODE_ENV=production webpack && tsc -b -v && cross-env BABEL_ENV=production babel target/renderer/bundle.js --out-file target/renderer/bundle.js --no-comments --minified",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.json",
"test": "yarn run lint && yarn run test:unit",
"test:unit": "ava",
"test:unit:watch": "yarn run test:unit -- --watch",
"test:e2e": "ava --config ava-e2e.config.js",
"postinstall": "yarn run v8-snapshot && webpack --config-name hyper-app && electron-builder install-app-deps && yarn run rebuild-node-pty && cpy --cwd=target node_modules \"../app/\" && husky install && yarn run generate-schema",
"rebuild-node-pty": "electron-rebuild -f -o node-pty -m target",
"dist": "yarn run build && cross-env BABEL_ENV=production babel target/renderer/bundle.js --out-file target/renderer/bundle.js --no-comments --minified && electron-builder",
"dist": "yarn run build && electron-builder",
"clean": "node ./bin/rimraf-standalone.js node_modules && node ./bin/rimraf-standalone.js ./app/node_modules && node ./bin/rimraf-standalone.js ./app/renderer",
"v8-snapshot": "cross-env npm_config_arch=x64 yarn run v8-snapshot:arch && cross-env npm_config_arch=arm64 yarn run v8-snapshot:arch",
"v8-snapshot:arch": "yarn run mk-snapshot && yarn run cp-snapshot",
Expand Down

0 comments on commit 20de964

Please sign in to comment.