From 0f3adf4f3aa2af227ccb9b2d5a0ce788ed6a282c Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Fri, 20 Dec 2024 13:00:02 +0100 Subject: [PATCH] Build desktop-native in alpine container --- .github/workflows/build-desktop.yml | 60 +++++++++++++++++++---------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-desktop.yml b/.github/workflows/build-desktop.yml index bc9bdec396a..5907480c9ab 100644 --- a/.github/workflows/build-desktop.yml +++ b/.github/workflows/build-desktop.yml @@ -138,6 +138,42 @@ jobs: NODE_VERSION=${NODE_NVMRC/v/''} echo "node_version=$NODE_VERSION" >> $GITHUB_OUTPUT + linux-desktop-native: + name: Desktop Native Linux Build + runs-on: ubuntu-24.04 + container: + image: alpine:3.20 + needs: setup + defaults: + run: + needs: linux-desktop-native + steps: + - name: Check out repo + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Set up environment + run: | + apk add --no-cache \ + build-base \ + rustup \ + npm + echo 1 | rustup-init --default-toolchain stable --target x86_64-unknown-linux-musl + - name: NPM install + run: cd ../../../ && npm install + - name: Build Native Module + env: + PKG_CONFIG_ALL_STATIC: true + TARGET: musl + run: | + source $HOME/.cargo/env + node build.js release + - name: Upload Native Module + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + sudo apt-get -y install pkg-config libxss-dev rpm flatpak flatpak-builder + name: desktop_napi-linux-x86_64-unknown-linux-musl + path: apps/desktop/desktop_native/napi/desktop_napi.linux-x64-musl.node + linux: name: Linux Build # Note, before updating the ubuntu version of the workflow, ensure the snap base image @@ -206,27 +242,11 @@ jobs: ls -l ../ npm link ../sdk-internal - - name: Cache Native Module - uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 - id: cache + - name: Download napi module + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: - path: | - apps/desktop/desktop_native/napi/*.node - apps/desktop/desktop_native/dist/* - ${{ env.RUNNER_TEMP }}/.cargo/registry - ${{ env.RUNNER_TEMP }}/.cargo/git - key: rust-${{ runner.os }}-${{ hashFiles('apps/desktop/desktop_native/**/*') }} - - - name: Build Native Module - if: steps.cache.outputs.cache-hit != 'true' - working-directory: apps/desktop/desktop_native - env: - PKG_CONFIG_ALLOW_CROSS: true - PKG_CONFIG_ALL_STATIC: true - TARGET: musl - run: | - rustup target add x86_64-unknown-linux-musl - node build.js cross-platform + name: desktop_napi-linux-x86_64-unknown-linux-musl + path: apps/desktop/desktop_native/napi/desktop_napi.linux-x64-musl.node - name: Build application run: npm run dist:lin