Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross Compile linux armhf/arm64 artifacts #8613

Merged
merged 47 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
4d9486e
Update build.yml
Jai-JAP Jun 19, 2023
a8b84d1
Update build.yml
Jai-JAP Jun 19, 2023
40c5659
Update build.yml
Jai-JAP Jun 19, 2023
f373cd9
Update build.yml
Jai-JAP Jun 19, 2023
682f1a9
Update build.yml
Jai-JAP Jun 19, 2023
5d2e458
Update build.yml
Jai-JAP Jun 19, 2023
ef195c4
Update build.yml
Jai-JAP Jun 19, 2023
b5a6606
Update build.yml
Jai-JAP Jun 19, 2023
3dc8593
Update build.yml
Jai-JAP Jun 21, 2023
07497ac
Update package.json
Jai-JAP Jun 21, 2023
6bbe3b8
Update pty.ts
Jai-JAP Jun 21, 2023
f6d406e
Update webpack.config.main.mjs
Jai-JAP Jun 21, 2023
8164682
Update sentry-upload.mjs
Jai-JAP Jun 21, 2023
549954d
Update build.yml
Jai-JAP Jun 21, 2023
23fba79
Update build.yml
Jai-JAP Jun 21, 2023
9a3f1a6
Update build.yml
Jai-JAP Jun 21, 2023
018a994
Update build.yml
Jai-JAP Jun 21, 2023
a53feb3
Update build.yml
Jai-JAP Jun 21, 2023
d10926b
Update build.yml
Jai-JAP Jun 21, 2023
75a3e89
Update build.yml
Jai-JAP Jun 21, 2023
2f82fb0
Update build.yml
Jai-JAP Jun 21, 2023
b1ac07e
Update build.yml
Jai-JAP Jun 23, 2023
cbabc1c
Update build.yml
Jai-JAP Jun 23, 2023
4a23ace
Update vars.mjs
Jai-JAP Jun 23, 2023
f56c1bb
Update build.yml
Jai-JAP Jun 23, 2023
c8ef454
Update build.yml
Jai-JAP Jun 23, 2023
f60966b
Update build.yml
Jai-JAP Jun 23, 2023
b0fc771
Update build.yml
Jai-JAP Jun 23, 2023
e771570
Update build.yml
Jai-JAP Jun 23, 2023
89b48f1
Update build.yml
Jai-JAP Jun 24, 2023
4b9769b
Update build.yml
Jai-JAP Jun 24, 2023
2fb7d12
Update build.yml
Jai-JAP Jun 24, 2023
5232e08
Update build.yml
Jai-JAP Jun 24, 2023
4f06e53
Update build.yml
Jai-JAP Jun 24, 2023
eeca05a
Update build.yml
Jai-JAP Jun 24, 2023
556299c
Update build.yml
Jai-JAP Jun 24, 2023
d9e659e
Update build.yml
Jai-JAP Jun 24, 2023
130d22a
Update build.yml
Jai-JAP Jun 24, 2023
f2871de
Update build.yml
Jai-JAP Jun 24, 2023
629c17a
Update build.yml
Jai-JAP Jun 24, 2023
61f6399
Merge branch 'Eugeny:master' into master
Jai-JAP Jun 24, 2023
c28a087
Update HACKING.md
Jai-JAP Jun 24, 2023
7b9af38
Update build.yml
Jai-JAP Jun 24, 2023
1b1c068
Update build.yml
Jai-JAP Jun 25, 2023
75a3439
Update build.yml
Jai-JAP Jun 25, 2023
86948d1
Update build.yml
Jai-JAP Jun 25, 2023
a07e7dd
Update build-linux.mjs
Jai-JAP Jun 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
205 changes: 128 additions & 77 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,101 +131,146 @@ jobs:
needs: Lint
strategy:
matrix:
build-arch: [ x64, arm64, armv7l ]
include:
- build-arch: x64
arch: amd64
- build-arch: arm64
arch: arm64
triplet: aarch64-linux-gnu-
- build-arch: arm
arch: armhf
triplet: arm-linux-gnueabihf-
env:
CC: ${{matrix.triplet}}gcc
CXX: ${{matrix.triplet}}g++
ARCH: ${{matrix.build-arch}}
npm_config_arch: ${{matrix.build-arch}}
npm_config_target_arch: ${{matrix.build-arch}}

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up multiarch/qemu-user-static
run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
if: matrix.build-arch != 'x64'

- name: Install Node (x64)

- name: Install Node
uses: actions/setup-node@v3.6.0
with:
node-version: 16
if: matrix.build-arch == 'x64'
node-version: 18

- name: Install deps (x64)
- name: Install deps (amd64)
run: |
sudo apt-get update
sudo apt-get install libarchive-tools zsh
sudo apt-get install libarchive-tools zsh

- name: Install npm_modules (amd64)
run: |
npm i -g yarn
yarn --network-timeout 1000000
if: matrix.build-arch == 'x64'

- name: Setup Crossbuild (${{matrix.arch}})
run: |
sudo apt-get update -y && sudo apt-get install schroot sbuild debootstrap -y
sudo debootstrap --include=git,curl,gnupg,ca-certificates,crossbuild-essential-${{matrix.arch}},python-dev,python3-dev,libarchive-tools,cmake --variant=buildd --exclude=snapd --components=main,restricted,universe,multiverse --extractor=dpkg-deb bionic /build-chroot/
echo 'deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse' | sudo tee /build-chroot/etc/apt/sources.list >/dev/null
echo 'deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports bionic main restricted universe multiverse' | sudo tee -a /build-chroot/etc/apt/sources.list >/dev/null
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee /build-chroot/etc/apt/trusted.gpg.d/nodesource.gpg >/dev/null
echo 'deb http://deb.nodesource.com/node_16.x bionic main' | sudo tee /build-chroot/etc/apt/sources.list.d/nodesource.list >/dev/null
echo "[build-chroot]
description=Ubuntu 18.04 Build chroot
type=directory
directory=/build-chroot
root-groups=root,sudo
profile=buildd
personality=linux
union-type=overlay" | sudo tee /etc/schroot/chroot.d/build-chroot.pref >/dev/null
echo "/home /home none rw,bind 0 0" | sudo tee -a /etc/schroot/buildd/fstab >/dev/null

- name: Webpack (x64)
run: yarn run build
if: matrix.build-arch == 'x64'
if: matrix.build-arch != 'x64'

- name: Prepackage plugins (x64)
run: scripts/prepackage-plugins.mjs
if: ${{matrix.build-arch == 'x64'}}
- name: Install node_modules & CrossBuild native modules for ${{matrix.arch}}
run: |
sudo schroot -c build-chroot -u root -- bash -c "apt-get update -y
dpkg --add-architecture ${{matrix.arch}}
apt-get install -y nodejs libfontconfig-dev:${{matrix.arch}} libsecret-1-dev:${{matrix.arch}} libnss3:${{matrix.arch}} libatk1.0-0:${{matrix.arch}} libatk-bridge2.0-0:${{matrix.arch}} libgdk-pixbuf2.0-0:${{matrix.arch}} libgtk-3-0:${{matrix.arch}} libgbm1:${{matrix.arch}}
export CC=${{matrix.triplet}}gcc CXX=${{matrix.triplet}}g++ LD=${{matrix.triplet}}ld
if [[ ${{matrix.arch}} == 'arm64' ]]; then
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/aarch64-linux-gnu/pkgconfig/
elif [[ ${{matrix.arch}} == 'armhf' ]]; then
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/arm-linux-gnueabihf/pkgconfig/
fi
export ARCH=${{matrix.build-arch}} npm_config_arch=${{matrix.build-arch}} npm_config_target_arch=${{matrix.build-arch}}
npm i -g yarn
yarn --network-timeout 1000000 --arch=${{matrix.build-arch}} --target_arch=${{matrix.build-arch}}"
if: matrix.build-arch != 'x64'

- name: Build packages (x64)
- name: Webpack (${{matrix.arch}})
run: yarn run build --arch=${{matrix.build-arch}} --target_arch=${{matrix.build-arch}}

- name: Prepackage plugins (${{matrix.arch}})
run: scripts/prepackage-plugins.mjs

- name: Build packages (${{matrix.arch}})
run: scripts/build-linux.mjs
if: ${{matrix.build-arch == 'x64'}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
USE_HARD_LINKS: false
# DEBUG: electron-builder,electron-builder:*

- name: Build web resources
run: zsh -c 'tar czf tabby-web.tar.gz (tabby-*|web)/dist'
if: matrix.build-arch == 'x64'

- name: Install deps and Build (arm64)
uses: docker://multiarch/ubuntu-core:arm64-bionic
with:
args: >
bash -c
"apt update && apt install curl lsb-release gnupg -y &&
curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&
apt install make build-essential git ruby libarchive-tools nodejs rpm libsecret-1-dev libfontconfig1-dev -y &&
git config --global --add safe.directory /github/workspace &&
gem install public_suffix -v 4.0.7 &&
gem install fpm --no-document &&
npm i -g yarn &&
cd /github/workspace &&
yarn --network-timeout 1000000 &&
yarn run build &&
scripts/prepackage-plugins.mjs &&
USE_SYSTEM_FPM=true scripts/build-linux.mjs"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
USE_HARD_LINKS: false
if: matrix.build-arch == 'arm64' && github.repository == 'Eugeny/tabby' && startsWith(github.ref, 'refs/tags')

- name: Install deps and Build (armv7l)
uses: docker://multiarch/ubuntu-core:armhf-bionic
with:
args: >
bash -c
"apt update && apt install curl lsb-release gnupg -y &&
curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&
apt install make build-essential git ruby libarchive-tools nodejs rpm libsecret-1-dev libfontconfig1-dev -y &&
git config --global --add safe.directory /github/workspace &&
gem install public_suffix -v 4.0.7 &&
gem install fpm --no-document &&
npm i -g yarn &&
cd /github/workspace &&
sed -i '/ \"electron\":/c\ \"electron\": \"17.0.0\",' package.json &&
yarn --network-timeout 1000000 &&
yarn run build &&
scripts/prepackage-plugins.mjs &&
USE_SYSTEM_FPM=true scripts/build-linux.mjs"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
USE_HARD_LINKS: false
if: matrix.build-arch == 'armv7l' && github.repository == 'Eugeny/tabby' && startsWith(github.ref, 'refs/tags')

- name: Upload symbols
# - name: Install deps and Build (arm64)
# uses: docker://multiarch/ubuntu-core:arm64-bionic
# with:
# args: >
# bash -c
# "apt update && apt install curl lsb-release gnupg -y &&
# curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&
# apt install make build-essential git ruby libarchive-tools nodejs rpm libsecret-1-dev libfontconfig1-dev -y &&
# git config --global --add safe.directory /github/workspace &&
# gem install public_suffix -v 4.0.7 &&
# gem install fpm --no-document &&
# npm i -g yarn &&
# cd /github/workspace &&
# yarn --network-timeout 1000000 &&
# yarn run build &&
# scripts/prepackage-plugins.mjs &&
# USE_SYSTEM_FPM=true scripts/build-linux.mjs"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
# USE_HARD_LINKS: false
# if: matrix.build-arch == 'arm64' && github.repository == 'Eugeny/tabby' && startsWith(github.ref, 'refs/tags')

# - name: Install deps and Build (armv7l)
# uses: docker://multiarch/ubuntu-core:armhf-bionic
# with:
# args: >
# bash -c
# "apt update && apt install curl lsb-release gnupg -y &&
# curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&
# apt install make build-essential git ruby libarchive-tools nodejs rpm libsecret-1-dev libfontconfig1-dev -y &&
# git config --global --add safe.directory /github/workspace &&
# gem install public_suffix -v 4.0.7 &&
# gem install fpm --no-document &&
# npm i -g yarn &&
# cd /github/workspace &&
# sed -i '/ \"electron\":/c\ \"electron\": \"17.0.0\",' package.json &&
# yarn --network-timeout 1000000 &&
# yarn run build &&
# scripts/prepackage-plugins.mjs &&
# USE_SYSTEM_FPM=true scripts/build-linux.mjs"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
# USE_HARD_LINKS: false
# if: matrix.build-arch == 'arm' && github.repository == 'Eugeny/tabby' && startsWith(github.ref, 'refs/tags')

- name: Upload symbols (amd64 only)
run: |
sudo npm install -g @sentry/cli --unsafe-perm
./scripts/sentry-upload.mjs
Expand All @@ -245,31 +290,37 @@ jobs:
dir: 'dist'

- uses: actions/upload-artifact@master
name: Upload DEB
name: Upload AppImage (${{matrix.arch}})
with:
name: Linux AppImage (${{matrix.arch}})
path: dist/*.AppImage

- uses: actions/upload-artifact@master
name: Upload DEB (${{matrix.arch}})
with:
name: Linux DEB (${{matrix.build-arch}})
name: Linux DEB (${{matrix.arch}})
path: dist/*.deb

- uses: actions/upload-artifact@master
name: Upload RPM
name: Upload RPM (${{matrix.arch}})
with:
name: Linux RPM (${{matrix.build-arch}})
name: Linux RPM (${{matrix.arch}})
path: dist/*.rpm

- uses: actions/upload-artifact@master
name: Upload Pacman Package
name: Upload Pacman Package (${{matrix.arch}})
with:
name: Linux Pacman (${{matrix.build-arch}})
name: Linux Pacman (${{matrix.arch}})
path: dist/*.pacman

- uses: actions/upload-artifact@master
name: Upload Linux tarball
name: Upload Linux tarball (${{matrix.arch}})
with:
name: Linux tarball (${{matrix.build-arch}})
name: Linux tarball (${{matrix.arch}})
path: dist/*.tar.gz

- uses: actions/upload-artifact@master
name: Upload web tarball
name: Upload web tarball (amd64 only)
with:
name: Web tarball
path: tabby-web.tar.gz
Expand Down
2 changes: 0 additions & 2 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ First, from within the `tabby` directory install the dependencies via yarn:
yarn
```

**Note: For compiling for Linux armv7l, you need to downgrade electron to 17.0.0 in package.json present in root directory of tabby source**

```
# Linux (Debian/Ubuntu here as an example)
sudo apt install libfontconfig-dev libsecret-1-dev libarchive-tools libnss3 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm1 cmake
Expand Down
2 changes: 1 addition & 1 deletion app/lib/pty.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as nodePTY from '@tabby-gang/node-pty'
import * as nodePTY from 'node-pty'
import { v4 as uuidv4 } from 'uuid'
import { ipcMain } from 'electron'
import { Application } from './app'
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"dependencies": {
"@electron/remote": "2.0.10",
"@tabby-gang/node-pty": "^0.11.0-beta.203",
"node-pty": "^0.11.0-beta32",
"any-promise": "^1.3.0",
"electron-config": "2.0.0",
"electron-debug": "^3.2.0",
Expand Down
2 changes: 1 addition & 1 deletion app/webpack.config.main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const config = {
mz: 'commonjs mz',
npm: 'commonjs npm',
'node:os': 'commonjs os',
'@tabby-gang/node-pty': 'commonjs @tabby-gang/node-pty',
'node-pty': 'commonjs node-pty',
path: 'commonjs path',
util: 'commonjs util',
'source-map-support': 'commonjs source-map-support',
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-linux.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ process.env.ARCH = (process.env.ARCH || process.arch) === 'arm' ? 'armv7l' : pro

builder({
dir: true,
linux: ['deb', 'tar.gz', 'rpm', 'pacman'],
linux: ['deb', 'tar.gz', 'rpm', 'pacman', 'appimage'],
armv7l: process.env.ARCH === 'armv7l',
arm64: process.env.ARCH === 'arm64',
config: {
Expand Down
2 changes: 1 addition & 1 deletion scripts/sentry-upload.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sh.exec(`${sentryCli} releases new ${vars.version}`)
if (process.platform === 'darwin') {
for (const path of [
'app/node_modules/@serialport/bindings/build/Release/bindings.node',
'app/node_modules/@tabby-gang/node-pty/build/Release/pty.node',
'app/node_modules/node-pty/build/Release/pty.node',
'app/node_modules/fontmanager-redux/build/Release/fontmanager.node',
'app/node_modules/macos-native-processlist/build/Release/native.node',
]) {
Expand Down
10 changes: 6 additions & 4 deletions scripts/vars.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import * as fs from 'fs'
import * as semver from 'semver'
import * as childProcess from 'child_process'

process.env.ARCH = ((process.env.ARCH || process.arch) === 'arm') ? 'armv7l' : process.env.ARCH || process.arch

import * as url from 'url'
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))

Expand Down Expand Up @@ -58,21 +60,21 @@ export const keygenConfig = {
win32: {
x64: 'f481b9d6-d5da-4970-b926-f515373e986f',
arm64: '950999b9-371c-419b-b291-938c5e4d364c',
}[process.env.ARCH ?? process.arch],
}[process.env.ARCH],
darwin: {
arm64: '98fbadee-c707-4cd6-9d99-56683595a846',
x86_64: 'f5a48841-d5b8-4b7b-aaa7-cf5bffd36461',
x64: 'f5a48841-d5b8-4b7b-aaa7-cf5bffd36461',
}[process.env.ARCH ?? process.arch],
}[process.env.ARCH],
linux: {
x64: '7bf45071-3031-4a26-9f2e-72604308313e',
arm64: '39e3c736-d4d4-4fbf-a201-324b7bab0d17',
armv7l: '50ae0a82-7f47-4fa4-b0a8-b0d575ce9409',
armhf: '7df5aa12-04ab-4075-a0fe-93b0bbea9643',
}[process.env.ARCH ?? process.arch],
}[process.env.ARCH],
}[process.platform],
}

if (!keygenConfig.product) {
throw new Error(`Unrecognized platform ${process.platform}/${process.env.ARCH ?? process.arch}`)
throw new Error(`Unrecognized platform ${process.platform}/${process.env.ARCH}`)
}