Skip to content

Commit

Permalink
Build desktop-native in alpine container
Browse files Browse the repository at this point in the history
  • Loading branch information
quexten committed Dec 20, 2024
1 parent 69d42a7 commit 0f3adf4
Showing 1 changed file with 40 additions and 20 deletions.
60 changes: 40 additions & 20 deletions .github/workflows/build-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0f3adf4

Please sign in to comment.