feat: add setup-project action for common CI setup steps

Introduced a new GitHub Action to streamline project setup in CI workflows. This action handles Node.js setup, dependency installation, and native module rebuilding, replacing repetitive steps in multiple workflow files. Updated e2e-tests, pr-check, and test workflows to utilize the new action, enhancing maintainability and reducing duplication.
This commit is contained in:
Kacper
2025-12-18 20:59:33 +01:00
parent 1a83c9b256
commit 419e954230
4 changed files with 77 additions and 92 deletions

View File

@@ -17,37 +17,11 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
- name: Setup project
uses: ./.github/actions/setup-project
with:
node-version: "22"
cache: "npm"
cache-dependency-path: package-lock.json
- name: Configure Git for HTTPS
# Convert SSH URLs to HTTPS for git dependencies (e.g., @electron/node-gyp)
# This is needed because SSH authentication isn't available in CI
run: git config --global url."https://github.com/".insteadOf "git@github.com:"
- name: Install dependencies
# Use npm install instead of npm ci to correctly resolve platform-specific
# optional dependencies (e.g., @tailwindcss/oxide, lightningcss binaries)
# Skip scripts to avoid electron-builder install-app-deps which uses too much memory
run: npm install --ignore-scripts
- name: Install Linux native bindings
# Workaround for npm optional dependencies bug (npm/cli#4828)
# Explicitly install Linux bindings needed for build tools
run: |
npm install --no-save --force --ignore-scripts \
@rollup/rollup-linux-x64-gnu@4.53.3 \
@tailwindcss/oxide-linux-x64-gnu@4.1.17
- name: Rebuild native modules
# Rebuild node-pty and other native modules needed for server
# This is separate from electron-builder install-app-deps to avoid OOM
run: npm rebuild node-pty
working-directory: apps/server
check-lockfile: "true"
rebuild-node-pty-path: "apps/server"
- name: Run server tests with coverage
run: npm run test:server:coverage