Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 19 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
branches: [ "main", "develop" ] # Or your primary branches
pull_request:
branches: [ "main", "develop" ]
workflow_dispatch:

jobs:
build-and-test:
Expand All @@ -16,45 +17,30 @@ jobs:
node-version: [18.x] # Specify Node.js versions to test against

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm" # Enable caching for npm dependencies
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm" # Enable caching for npm dependencies

- name: Install dependencies
- name: Run tests
run: npm test
run: npm ci # Use npm ci for cleaner installs in CI
- name: Install dependencies
run: npm ci

- name: TypeScript Compile Check (Lint placeholder)
run: npm run build:electron:main && npm run build:electron:preload && npx tsc --project src/renderer/tsconfig.json --noEmit
# This checks if main, preload, and renderer TypeScript code compiles without errors.
# Replace with actual linting command when a linter is added.
- name: Run tests
run: npm test

# Replace with `npm test` when Jest/React Testing Library tests are added.
- name: TypeScript compile check
run: npm run build:electron:main && npm run build:electron:preload && npx tsc --project src/renderer/tsconfig.json --noEmit

- name: Build application (compiles main, preload, renderer)
run: npm run build
# This script typically runs:
# - vite build (for renderer)
# - tsc (for main and preload)
- name: Build application
run: npm run build

- name: Package application (Linux AppImage example)
run: |
# Need to install dependencies for electron-builder to run on Linux
# sudo apt-get update
# sudo apt-get install -y --no-install-recommends libopenjp2-7 libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm1 libnss3 libasound2
# The above dependencies might be needed for a full AppImage build with GUI tests.
# For a headless build check or if runner has them, might not be needed.
# For now, we focus on the command itself.
npm run package -- --linux AppImage --dir # Build unpacked dir first to check
# npm run package -- --linux AppImage # Build the actual AppImage
# Note: Full GUI app packaging might be complex in headless CI environments
# without specific display servers (e.g., Xvfb). For now, this is a structural step.
- name: Package application (Linux AppImage)
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')
run: npm run package -- --linux AppImage --dir

# Optional: Upload build artifacts (e.g., the AppImage)
# - name: Upload Linux Build Artifact
Expand Down
9 changes: 6 additions & 3 deletions scripts/generate-licenses.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const fs = require('fs');
const path = require('path');
const util = require('util');
const checker = require('license-checker-rseidelsohn');

const init = util.promisify(checker.init);
const loadChecker = async () => {
const checkerModule = await import('license-checker-rseidelsohn');
return checkerModule.default || checkerModule;
};
const projectRoot = path.resolve(__dirname, '..');
const outputDir = path.join(projectRoot, 'build', 'licenses');
const outputFile = path.join(outputDir, 'THIRD_PARTY_LICENSES.txt');
Expand Down Expand Up @@ -43,6 +44,8 @@ function formatPackage(pkgName, info) {

async function main() {
const skipSelf = packageJson.name && packageJson.version ? `${packageJson.name}@${packageJson.version}` : null;
const checker = await loadChecker();
const init = util.promisify(checker.init);
const packages = await init({
start: projectRoot,
production: true,
Expand Down