From 64d9c9853848ce9f115ae0ea7e12187736e91180 Mon Sep 17 00:00:00 2001 From: Jai-JAP Date: Sat, 23 Dec 2023 14:29:51 +0530 Subject: [PATCH 1/9] Better crossbuild v3 + fixes - Build now uses a bare `debootstrap` as a build-sysroot instead of a `chroot` and use its libraries for cross compiling using `crossbuild-essential-*` package using `--sysroot` GCC/G++ flag and `PKG_CONFIG_PATH` to specify path to find `*.pc` files for target arch - Use node 18 (16 is EOL) - Fix a potential ambiguous case in scripts/vars.mjs --- .github/workflows/build.yml | 57 ++++++++++++++++++------------------- scripts/vars.mjs | 2 +- 2 files changed, 28 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5e8b28b6..f3918488 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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,13 @@ 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}} @@ -96,7 +96,7 @@ jobs: - name: Build packages without signing run: scripts/build-macos.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}} # DEBUG: electron-builder,electron-builder:* @@ -164,34 +164,31 @@ jobs: - name: Install deps (amd64) run: | sudo apt-get update - sudo apt-get install libarchive-tools zsh python3-distutils - - - name: Install npm_modules (amd64) - run: | - npm i -g yarn - yarn --network-timeout 1000000 - if: matrix.build-arch == 'x64' + sudo apt-get install libarchive-tools zsh crossbuild-essential-${{matrix.arch}} - 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 - + echo "CFLAGS=--sysroot=/build-sysroot/" >> $GITHUB_ENV + echo "CXXFLAGS=--sysroot=/build-sysroot/" >> $GITHUB_ENV + echo "LDFLAGS=--sysroot=/build-sysroot/" >> $GITHUB_ENV + [[ ${npm_config_arch} == 'arm' ]] && echo "npm_config_arch=armv7l" >> $GITHUB_ENV + if [[ ${{matrix.arch}} == 'armhf' ]]; then + echo "PKG_CONFIG_PATH=/build-sysroot/usr/lib/pkgconfig/:/build-sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig/" >> $GITHUB_ENV + elif [[ ${{matrix.arch}} == 'arm64' ]]; then + echo "PKG_CONFIG_PATH=/build-sysroot/usr/lib/pkgconfig/:/build-sysroot/usr/lib/aarch64-linux-gnu/pkgconfig/" >> $GITHUB_ENV + fi + 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 /build-sysroot/ http://ports.ubuntu.com/ubuntu-ports/ + sudo find /build-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' + - name: Install npm_modules (amd64) + run: | + npm i -g yarn node-gyp + npm prefix -g | $(npm config set node_gyp "$_/node_modules/node-gyp/bin/node-gyp.js") + yarn --network-timeout 1000000 --arch=${{matrix.build-arch}} --target-arch=${{matrix.build-arch}} + 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 @@ -349,7 +346,7 @@ jobs: - name: Installing Node uses: actions/setup-node@v3.7.0 with: - node-version: 16 + node-version: 18 - name: Update node-gyp run: | @@ -379,7 +376,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}} diff --git a/scripts/vars.mjs b/scripts/vars.mjs index 11ade76e..218402f8 100755 --- a/scripts/vars.mjs +++ b/scripts/vars.mjs @@ -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)) From 50c534789a1086af10bec6db34ba27845e448d39 Mon Sep 17 00:00:00 2001 From: Jai-JAP Date: Sat, 23 Dec 2023 14:44:59 +0530 Subject: [PATCH 2/9] Fix an error --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f3918488..b74c5f69 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -96,7 +96,7 @@ jobs: - name: Build packages without signing run: scripts/build-macos.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}} # DEBUG: electron-builder,electron-builder:* @@ -376,7 +376,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}} From 7af6a31f55dda63c79a8591521778fde0616dad0 Mon Sep 17 00:00:00 2001 From: Jai-JAP Date: Sat, 23 Dec 2023 14:55:22 +0530 Subject: [PATCH 3/9] Fix a few other errors & remove old code --- .github/workflows/build.yml | 56 +------------------------------------ 1 file changed, 1 insertion(+), 55 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b74c5f69..b10280b0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,7 +54,6 @@ jobs: - name: Install deps run: | sudo -H pip3 install setuptools - npm config set python python3 sudo npm i -g yarn yarn --network-timeout 1000000 env: @@ -185,7 +184,6 @@ jobs: - name: Install npm_modules (amd64) run: | npm i -g yarn node-gyp - npm prefix -g | $(npm config set node_gyp "$_/node_modules/node-gyp/bin/node-gyp.js") yarn --network-timeout 1000000 --arch=${{matrix.build-arch}} --target-arch=${{matrix.build-arch}} if: matrix.build-arch == 'x64' @@ -223,53 +221,6 @@ jobs: 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 @@ -348,15 +299,10 @@ jobs: with: node-version: 18 - - 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"} - - 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 From 9b985698ff0fc5d24e218992aff84c250ea8f17b Mon Sep 17 00:00:00 2001 From: Jai-JAP Date: Sat, 23 Dec 2023 15:02:20 +0530 Subject: [PATCH 4/9] Add caching of sysroot for hopefully more speedup --- .github/workflows/build.yml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b10280b0..db2ad0ce 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -160,6 +160,13 @@ jobs: with: node-version: 18 + - name: Download cached sysroot + uses: actions/cache@v3 + if: matrix.build-arch !='x64' + with: + key: sysroot-${{matrix.build-arch}} + path: /${{matrix.build-arch}}-sysroot + - name: Install deps (amd64) run: | sudo apt-get update @@ -167,18 +174,18 @@ jobs: - name: Setup Crossbuild (${{matrix.arch}}) run: | - echo "CFLAGS=--sysroot=/build-sysroot/" >> $GITHUB_ENV - echo "CXXFLAGS=--sysroot=/build-sysroot/" >> $GITHUB_ENV - echo "LDFLAGS=--sysroot=/build-sysroot/" >> $GITHUB_ENV + 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=/build-sysroot/usr/lib/pkgconfig/:/build-sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig/" >> $GITHUB_ENV + 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=/build-sysroot/usr/lib/pkgconfig/:/build-sysroot/usr/lib/aarch64-linux-gnu/pkgconfig/" >> $GITHUB_ENV + echo "PKG_CONFIG_PATH=/${{matrix.build-arch}}-sysroot/usr/lib/pkgconfig/:/${{matrix.build-arch}}-sysroot/usr/lib/aarch64-linux-gnu/pkgconfig/" >> $GITHUB_ENV fi 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 /build-sysroot/ http://ports.ubuntu.com/ubuntu-ports/ - sudo find /build-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' {} \; ; + 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' - name: Install npm_modules (amd64) From 59c5491432a9667310468565508fc88d92e5d844 Mon Sep 17 00:00:00 2001 From: Jai-JAP Date: Sat, 23 Dec 2023 15:06:23 +0530 Subject: [PATCH 5/9] Remove old code leftover --- .github/workflows/build.yml | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db2ad0ce..298b1252 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -176,13 +176,16 @@ jobs: 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 + 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 + 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' {} \; ; @@ -192,23 +195,6 @@ jobs: run: | npm i -g yarn node-gyp yarn --network-timeout 1000000 --arch=${{matrix.build-arch}} --target-arch=${{matrix.build-arch}} - 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: Webpack (${{matrix.arch}}) run: yarn run build --arch=${{matrix.build-arch}} --target_arch=${{matrix.build-arch}} From 7fbe3405fe4f6bc36523acdc3414bd054b644e42 Mon Sep 17 00:00:00 2001 From: Jai-JAP Date: Sat, 23 Dec 2023 15:11:30 +0530 Subject: [PATCH 6/9] Setup crossbuild only if cache not found --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 298b1252..c212e746 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -162,6 +162,7 @@ jobs: - name: Download cached sysroot uses: actions/cache@v3 + id: cache-sysroot if: matrix.build-arch !='x64' with: key: sysroot-${{matrix.build-arch}} @@ -189,7 +190,7 @@ jobs: 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' + if: matrix.build-arch != 'x64' && steps.cache-sysroot.outputs.cache-hit != 'true' - name: Install npm_modules (amd64) run: | From f0a83c68dc320225a057b7524d2c709d2c02c567 Mon Sep 17 00:00:00 2001 From: Jai-JAP Date: Sat, 23 Dec 2023 15:21:54 +0530 Subject: [PATCH 7/9] State that web resourses are built only on amd64 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c212e746..2c10c9e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -211,7 +211,7 @@ 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' From 9da21a82a80293ddb869d404a8a899fdae14fa04 Mon Sep 17 00:00:00 2001 From: Jai-JAP Date: Sat, 23 Dec 2023 17:59:25 +0530 Subject: [PATCH 8/9] Fix caching on build - Fix cache on x64 - Run tar as root --- .github/workflows/build.yml | 49 +++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2c10c9e2..a24156c3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -160,42 +160,49 @@ jobs: with: node-version: 18 + - name: Install dependencies + run: | + sudo apt-get update + 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: cache-sysroot + id: dl-cached-sysroot if: matrix.build-arch !='x64' with: key: sysroot-${{matrix.build-arch}} path: /${{matrix.build-arch}}-sysroot - - name: Install deps (amd64) + - name: Setup crossbuild sysroot run: | - sudo apt-get update - sudo apt-get install libarchive-tools zsh crossbuild-essential-${{matrix.arch}} + 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 Crossbuild (${{matrix.arch}}) + - 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 + 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 + [[ ${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 - - 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.cache-sysroot.outputs.cache-hit != 'true' + 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 node-gyp - yarn --network-timeout 1000000 --arch=${{matrix.build-arch}} --target-arch=${{matrix.build-arch}} + 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}} From dd9a13c91734f6ecfef43d6391608a6889afd135 Mon Sep 17 00:00:00 2001 From: Jai-JAP Date: Sat, 23 Dec 2023 18:08:41 +0530 Subject: [PATCH 9/9] Bump (Test caching)