mirror of
https://github.com/Heretek-AI/GDevelop.git
synced 2026-07-21 17:45:25 -04:00
82beb6d5e1
BYOK tests mock the electron module and may need transitive dependencies (fs-extra) from electron-app/node_modules for module resolution.
142 lines
4.1 KiB
YAML
142 lines
4.1 KiB
YAML
# CI pipeline for BYOK fork of GDevelop
|
|
#
|
|
# Covers: dependency installation, linting, formatting, BYOK unit tests
|
|
# (Node native test runner), and structure checks. Runs on push/PR to
|
|
# main/master/milestone branches.
|
|
#
|
|
# The full GDevelop CI (Semaphore) builds C++ (GDevelop.js) and runs GDJS
|
|
# tests. This workflow is lighter — it covers the JS/Electron surface
|
|
# where BYOK changes live.
|
|
|
|
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
- "milestone/**"
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- master
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
NEWIDE_DIR: newIDE/app
|
|
ELECTRON_DIR: newIDE/electron-app
|
|
BYOK_DIR: newIDE/electron-app/app/byok
|
|
GDJS_DIR: GDJS
|
|
NODE_VERSION: "18"
|
|
|
|
jobs:
|
|
install:
|
|
name: Install dependencies
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
- name: Cache newIDE node_modules
|
|
id: cache-newide
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ env.NEWIDE_DIR }}/node_modules
|
|
key: newide-node-v3-${{ hashFiles(format('{0}/package-lock.json', env.NEWIDE_DIR)) }}
|
|
|
|
- name: Cache electron-app node_modules
|
|
id: cache-electron
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ env.ELECTRON_DIR }}/node_modules
|
|
key: electron-node-v1-${{ hashFiles(format('{0}/package-lock.json', env.ELECTRON_DIR)) }}
|
|
|
|
- name: Install newIDE dependencies
|
|
if: steps.cache-newide.outputs.cache-hit != 'true'
|
|
working-directory: ${{ env.NEWIDE_DIR }}
|
|
run: npm ci --ignore-scripts
|
|
|
|
- name: Install electron-app dependencies
|
|
if: steps.cache-electron.outputs.cache-hit != 'true'
|
|
working-directory: ${{ env.ELECTRON_DIR }}
|
|
run: npm ci --ignore-scripts
|
|
|
|
lint:
|
|
name: Lint and format
|
|
needs: install
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
- name: Restore newIDE node_modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ env.NEWIDE_DIR }}/node_modules
|
|
key: newide-node-v3-${{ hashFiles(format('{0}/package-lock.json', env.NEWIDE_DIR)) }}
|
|
|
|
- name: ESLint (newIDE)
|
|
working-directory: ${{ env.NEWIDE_DIR }}
|
|
run: npm run lint
|
|
|
|
- name: Prettier check (newIDE)
|
|
working-directory: ${{ env.NEWIDE_DIR }}
|
|
run: npm run check-format
|
|
|
|
byok-tests:
|
|
name: BYOK unit tests
|
|
needs: install
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
- name: Restore electron-app node_modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ env.ELECTRON_DIR }}/node_modules
|
|
key: electron-node-v1-${{ hashFiles(format('{0}/package-lock.json', env.ELECTRON_DIR)) }}
|
|
|
|
- name: Syntax-check all BYOK modules
|
|
working-directory: ${{ env.ELECTRON_DIR }}
|
|
run: |
|
|
failed=0
|
|
for f in app/byok/buildSystemPrompt.js app/byok/byokConfig.js \
|
|
app/byok/byokMain.js app/byok/callLLM.js \
|
|
app/byok/errors.js app/byok/requestStore.js \
|
|
app/byok/tests/buildSystemPrompt.test.js \
|
|
app/byok/tests/callLLM.test.js \
|
|
app/byok/tests/errors.test.js \
|
|
app/byok/tests/requestStore.test.js; do
|
|
if node -c "$f" 2>&1; then
|
|
echo " ✓ $f"
|
|
else
|
|
echo " ✗ $f (syntax error)"
|
|
failed=1
|
|
fi
|
|
done
|
|
exit $failed
|
|
|
|
- name: Run BYOK unit tests
|
|
working-directory: ${{ env.BYOK_DIR }}
|
|
run: |
|
|
node --test \
|
|
tests/errors.test.js \
|
|
tests/buildSystemPrompt.test.js \
|
|
tests/requestStore.test.js \
|
|
tests/callLLM.test.js
|