mirror of
https://github.com/Eugeny/tabby
synced 2024-11-14 00:47:15 +00:00
Merge pull request #9355 from Jai-JAP/better-crossbuild-v3
Better crossbuild v3 + fixes
This commit is contained in:
commit
f523b114ca
2 changed files with 47 additions and 103 deletions
148
.github/workflows/build.yml
vendored
148
.github/workflows/build.yml
vendored
|
@ -13,11 +13,11 @@ jobs:
|
|||
- name: Installing Node
|
||||
uses: actions/setup-node@v3.7.0
|
||||
with:
|
||||
node-version: 16
|
||||
node-version: 18
|
||||
|
||||
- name: Install deps
|
||||
run: |
|
||||
npm i -g yarn@1.19.1
|
||||
npm i -g yarn
|
||||
cd app
|
||||
yarn
|
||||
cd ..
|
||||
|
@ -49,13 +49,12 @@ jobs:
|
|||
- name: Installing Node
|
||||
uses: actions/setup-node@v3.7.0
|
||||
with:
|
||||
node-version: 16
|
||||
node-version: 18
|
||||
|
||||
- name: Install deps
|
||||
run: |
|
||||
sudo -H pip3 install setuptools
|
||||
npm config set python python3
|
||||
sudo npm i -g yarn@1.22.1
|
||||
sudo npm i -g yarn
|
||||
yarn --network-timeout 1000000
|
||||
env:
|
||||
ARCH: ${{matrix.arch}}
|
||||
|
@ -161,52 +160,49 @@ jobs:
|
|||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Install deps (amd64)
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install libarchive-tools zsh python3-distutils
|
||||
sudo apt-get install libarchive-tools zsh crossbuild-essential-${{matrix.arch}}
|
||||
|
||||
- name: Setup tar to run as root
|
||||
run: sudo chmod u+s "$(command -v tar)"
|
||||
if: matrix.build-arch != 'x64'
|
||||
|
||||
- name: Download cached sysroot
|
||||
uses: actions/cache@v3
|
||||
id: dl-cached-sysroot
|
||||
if: matrix.build-arch !='x64'
|
||||
with:
|
||||
key: sysroot-${{matrix.build-arch}}
|
||||
path: /${{matrix.build-arch}}-sysroot
|
||||
|
||||
- name: Setup crossbuild sysroot
|
||||
run: |
|
||||
sudo apt-get update -y && sudo apt-get install debootstrap qemu-user-static binfmt-support -y
|
||||
sudo qemu-debootstrap --include=libfontconfig1-dev,libsecret-1-dev,libnss3,libatk1.0-0,libatk-bridge2.0-0,libgdk-pixbuf2.0-0,libgtk-3-0,libgbm1 --variant=buildd --exclude=snapd --components=main,restricted,universe,multiverse --extractor=dpkg-deb --arch ${{matrix.arch}} bionic /${{matrix.build-arch}}-sysroot/ http://ports.ubuntu.com/ubuntu-ports/
|
||||
sudo find /${{matrix.build-arch}}-sysroot -type l -lname '/*' -exec sh -c 'file="$0"; dir=$(dirname "$file"); target=$(readlink "$0"); prefix=$(dirname "$dir" | sed 's@[^/]*@\.\.@g'); newtarget="$prefix$target"; ln -snf $newtarget $file' {} \; ;
|
||||
if: matrix.build-arch != 'x64' && steps.dl-cached-sysroot.outputs.cache-hit != 'true'
|
||||
|
||||
- name: Setup env to use ${{matrix.build-arch}} sysroot
|
||||
run: |
|
||||
echo "CFLAGS=--sysroot=/${{matrix.build-arch}}-sysroot/" >> $GITHUB_ENV
|
||||
echo "CXXFLAGS=--sysroot=/${{matrix.build-arch}}-sysroot/" >> $GITHUB_ENV
|
||||
echo "LDFLAGS=--sysroot=/${{matrix.build-arch}}-sysroot/" >> $GITHUB_ENV
|
||||
|
||||
[[ ${npm_config_arch} == 'arm' ]] && echo "npm_config_arch=armv7l" >> $GITHUB_ENV
|
||||
|
||||
if [[ ${{matrix.arch}} == 'armhf' ]]; then
|
||||
echo "PKG_CONFIG_PATH=/${{matrix.build-arch}}-sysroot/usr/lib/pkgconfig/:/${{matrix.build-arch}}-sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig/" >> $GITHUB_ENV
|
||||
elif [[ ${{matrix.arch}} == 'arm64' ]]; then
|
||||
echo "PKG_CONFIG_PATH=/${{matrix.build-arch}}-sysroot/usr/lib/pkgconfig/:/${{matrix.build-arch}}-sysroot/usr/lib/aarch64-linux-gnu/pkgconfig/" >> $GITHUB_ENV
|
||||
fi
|
||||
if: matrix.build-arch != 'x64'
|
||||
|
||||
- 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
|
||||
|
||||
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'
|
||||
npm i -g yarn node-gyp
|
||||
yarn --network-timeout 1000000 --arch=${{matrix.build-arch}} --target-arch=${{matrix.build-arch}}
|
||||
|
||||
- name: Webpack (${{matrix.arch}})
|
||||
run: yarn run build --arch=${{matrix.build-arch}} --target_arch=${{matrix.build-arch}}
|
||||
|
@ -222,57 +218,10 @@ jobs:
|
|||
USE_HARD_LINKS: false
|
||||
# DEBUG: electron-builder,electron-builder:*
|
||||
|
||||
- name: Build web resources
|
||||
- name: Build web resources (amd64 only)
|
||||
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 == 'arm' && github.repository == 'Eugeny/tabby' && startsWith(github.ref, 'refs/tags')
|
||||
|
||||
- name: Upload symbols (amd64 only)
|
||||
run: |
|
||||
sudo npm install -g @sentry/cli --unsafe-perm
|
||||
|
@ -349,17 +298,12 @@ jobs:
|
|||
- name: Installing Node
|
||||
uses: actions/setup-node@v3.7.0
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Update node-gyp
|
||||
run: |
|
||||
npm install --global node-gyp@8.4.1
|
||||
npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
|
||||
node-version: 18
|
||||
|
||||
- name: Build
|
||||
shell: powershell
|
||||
run: |
|
||||
npm i -g yarn@1.19.1
|
||||
npm i -g yar node-gyp
|
||||
yarn --network-timeout 1000000
|
||||
yarn run build
|
||||
node scripts/prepackage-plugins.mjs
|
||||
|
@ -379,7 +323,7 @@ jobs:
|
|||
|
||||
- name: Build packages without signing
|
||||
run: node scripts/build-windows.mjs
|
||||
if: "!(github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')))"
|
||||
if: "! (github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')))"
|
||||
env:
|
||||
ARCH: ${{matrix.arch}}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ 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
|
||||
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))
|
||||
|
|
Loading…
Reference in a new issue