GitNexus/.github/workflows/desktop-packaging.yml
Sparsh 610a102397 feat: add validation job to GitHub Actions for desktop packaging
- Introduced a new job `validate` in the GitHub Actions workflow to validate the desktop package.
- Added steps for checking out the repository, setting up Node.js, installing dependencies, type checking, and running unit tests.
- Updated the `package` job to depend on the `validate` job.

chore: update package-lock.json and package.json for vitest integration

- Added `vitest` as a development dependency in `package.json`.
- Updated `typecheck` script to include a new TypeScript configuration for vitest.
- Updated `package-lock.json` to reflect the new dependencies.

refactor: modularize runtime path handling in main process

- Created a new module `runtime-paths.ts` to handle static path normalization and request handling.
- Refactored `main.ts` to utilize the new `normalizeStaticPath`, `getRequestedPath`, and `getPackagedRendererEntry` functions.

test: add unit tests for runtime path utilities

- Implemented tests for `normalizeStaticPath`, `getRequestedPath`, and `getPackagedRendererEntry` using Vitest.
- Ensured coverage for directory traversal attempts and null-byte paths.

chore: configure Vitest for testing

- Added `vitest.config.ts` for Vitest configuration.
- Created `tsconfig.vitest.json` to include types for Vitest in TypeScript compilation.

Co-authored-by: Copilot <copilot@github.com>
2026-04-24 13:45:23 +05:30

137 lines
4 KiB
YAML

name: Desktop Packaging
on:
pull_request:
paths:
- .github/workflows/desktop-packaging.yml
- gitnexus-desktop/**
workflow_dispatch:
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
validate:
name: Validate desktop package
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 20
cache: npm
cache-dependency-path: gitnexus-desktop/package-lock.json
- name: Install desktop dependencies
run: npm ci
working-directory: gitnexus-desktop
- name: Typecheck desktop package
run: npm run typecheck
working-directory: gitnexus-desktop
- name: Run desktop unit tests
run: npm test
working-directory: gitnexus-desktop
package:
name: Build ${{ matrix.label }}
runs-on: ${{ matrix.os }}
timeout-minutes: 90
needs: validate
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
label: Windows NSIS
command: npm run build:win
artifact_name: gitnexus-desktop-windows
artifact_paths: |
gitnexus-desktop/release/*/GitNexus Desktop Setup *.exe
gitnexus-desktop/release/*/win-unpacked/**
- os: macos-latest
label: macOS DMG
command: npm run build:mac
artifact_name: gitnexus-desktop-macos
artifact_paths: |
gitnexus-desktop/release/*/*.dmg
gitnexus-desktop/release/*/mac*/**
- os: ubuntu-latest
label: Linux AppImage
command: npm run build:linux
artifact_name: gitnexus-desktop-linux
artifact_paths: |
gitnexus-desktop/release/*/*.AppImage
gitnexus-desktop/release/*/linux-unpacked/**
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 20
cache: npm
cache-dependency-path: |
gitnexus-shared/package-lock.json
gitnexus/package-lock.json
gitnexus-web/package-lock.json
gitnexus-desktop/package-lock.json
- name: Install shared dependencies
run: npm ci
working-directory: gitnexus-shared
- name: Build shared package
run: npm run build
working-directory: gitnexus-shared
- name: Install GitNexus dependencies
run: npm ci
working-directory: gitnexus
- name: Install web dependencies
run: npm ci
working-directory: gitnexus-web
- name: Install desktop dependencies
run: npm ci
working-directory: gitnexus-desktop
- name: Build unpacked desktop bundle
run: npm run build:dir
working-directory: gitnexus-desktop
env:
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
- name: Start Xvfb
if: matrix.os == 'ubuntu-latest'
run: |
Xvfb :99 -screen 0 1024x768x24 &
echo "DISPLAY=:99" >> "$GITHUB_ENV"
- name: Smoke test unpacked desktop bundle
run: node scripts/smoke-unpacked.mjs
working-directory: gitnexus-desktop
- name: Build desktop package
run: ${{ matrix.command }}
working-directory: gitnexus-desktop
env:
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
- name: Upload desktop artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_paths }}
if-no-files-found: error
retention-days: 14