evdboom_Bindery/.github/workflows/ci.yml
Erik van der Boom 288b491cc4 feat: add authoring tools for notes, characters, and arcs
- Introduced commands for managing notes: list, get, create, and append.
- Added character management commands: list, get, create, and update.
- Implemented arc management commands: list, get, create, and update.
- Enhanced AI setup to include new character and arc functionalities.
- Updated package.json to reflect new commands and tools.
- Improved workspace settings handling for story, notes, and arc folders.
- Added input validation and prompts for user interactions in commands.
2026-05-29 00:03:54 +02:00

199 lines
8 KiB
YAML

name: CI
on:
pull_request:
branches: ['**']
permissions:
contents: read
jobs:
test:
name: Test & build check
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: package-lock.json
# ── Workspace install ─────────────────────────────────────────────────────
- name: Install all workspace dependencies
run: npm ci
# ── bindery-core ──────────────────────────────────────────────────────────
- name: Build bindery-core
run: npm run build --workspace=bindery-core
- name: Test bindery-core
run: npm run test:ci --workspace=bindery-core
- name: Upload bindery-core test results
if: always()
uses: actions/upload-artifact@v7
with:
name: bindery-core-test-results-${{ matrix.os }}
path: bindery-core/test-results.json
# ── bindery-merge ─────────────────────────────────────────────────────────
- name: Build bindery-merge
run: npm run build --workspace=bindery-merge
- name: Test bindery-merge
run: npm run test:ci --workspace=bindery-merge
- name: Upload bindery-merge test results
if: always()
uses: actions/upload-artifact@v7
with:
name: bindery-merge-test-results-${{ matrix.os }}
path: bindery-merge/test-results.json
# ── MCP server ────────────────────────────────────────────────────────────
- name: Compile mcp-ts
run: npm run compile --workspace=mcp-ts
- name: Run mcp-ts tests
run: npm run test:ci --workspace=mcp-ts
- name: Upload mcp-ts test results
if: always()
uses: actions/upload-artifact@v7
with:
name: mcp-test-results-${{ matrix.os }}
path: mcp-ts/test-results.json
# ── VS Code extension ─────────────────────────────────────────────────────
- name: Compile vscode-ext
run: npm run compile --workspace=vscode-ext
- name: Bundle mcp-ts into extension
if: matrix.os == 'ubuntu-latest'
run: |
mkdir -p vscode-ext/mcp-ts/out
npx --yes esbuild@0.28.0 mcp-ts/out/tools.js --bundle --platform=node --format=cjs --target=node18 --outfile=vscode-ext/mcp-ts/out/tools.js
npx --yes esbuild@0.28.0 mcp-ts/out/index.js --bundle --platform=node --format=cjs --target=node18 --outfile=vscode-ext/mcp-ts/out/index.js
- name: VSIX packaging smoke check
if: matrix.os == 'ubuntu-latest'
run: |
cd vscode-ext
npx --yes @vscode/vsce@3.7.1 package --no-dependencies -o bindery-ci-smoke.vsix
- name: Run vscode-ext tests
run: npm run test:ci --workspace=vscode-ext
- name: Upload vscode-ext test results
if: always()
uses: actions/upload-artifact@v7
with:
name: vscode-ext-test-results-${{ matrix.os }}
path: vscode-ext/test-results.json
# ── Obsidian plugin ───────────────────────────────────────────────────────
- name: Compile obsidian-plugin
run: npm run compile --workspace=obsidian-plugin
- name: Bundle obsidian-plugin (validates release artefact is producible)
run: npm run bundle --workspace=obsidian-plugin
- name: Run obsidian-plugin tests
run: npm run test:ci --workspace=obsidian-plugin
- name: Upload obsidian-plugin test results
if: always()
uses: actions/upload-artifact@v7
with:
name: obsidian-plugin-test-results-${{ matrix.os }}
path: obsidian-plugin/test-results.json
- name: Obsidian version sync smoke check
shell: bash
run: |
# Happy path: valid stable version
node scripts/sync-obsidian-version.mjs 99.99.99
node -e "const m=JSON.parse(require('fs').readFileSync('manifest.json','utf8')); if(m.version!=='99.99.99') process.exit(1);"
node -e "const m=JSON.parse(require('fs').readFileSync('obsidian-plugin/manifest.json','utf8')); if(m.version!=='99.99.99') process.exit(1);"
node -e "const v=JSON.parse(require('fs').readFileSync('obsidian-plugin/versions.json','utf8')); if(!v['99.99.99']) process.exit(1);"
# Re-running with same version should overwrite (idempotent update)
node scripts/sync-obsidian-version.mjs 99.99.99
node -e "const v=JSON.parse(require('fs').readFileSync('obsidian-plugin/versions.json','utf8')); if(!v['99.99.99']) process.exit(1);"
# Happy path: pre-release semver
node scripts/sync-obsidian-version.mjs 99.99.99-beta.1
node -e "const v=JSON.parse(require('fs').readFileSync('obsidian-plugin/versions.json','utf8')); if(!v['99.99.99-beta.1']) process.exit(1);"
# Non-happy path: various invalid version formats must exit non-zero
for bad in bad-version 1.2 1.2.3.4 1.2.3-; do
if node scripts/sync-obsidian-version.mjs "$bad" 2>/dev/null; then
echo "ERROR: script should have failed for version: $bad"
exit 1
fi
done
# Restore files modified by the smoke test
git checkout -- manifest.json obsidian-plugin/manifest.json obsidian-plugin/versions.json
# ── Job: Coverage gates ──────────────────────────────────────────────────────
# Runs coverage-with-thresholds on ubuntu only (one platform is enough — coverage
# numbers don't depend on OS, and per-OS coverage runs would triple CI time).
coverage:
name: Coverage (v8)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install all workspace dependencies
run: npm ci
- name: Build bindery-core
run: npm run build --workspace=bindery-core
- name: Tool parity guard
run: node scripts/check-tool-parity.mjs
- name: Command parity guard
run: node scripts/check-command-parity.mjs
- name: bindery-core coverage
run: npm run test:coverage --workspace=bindery-core
- name: mcp-ts coverage
run: npm run compile --workspace=mcp-ts && npm run test:coverage --workspace=mcp-ts
- name: bindery-merge coverage
run: npm run compile --workspace=bindery-merge && npm run test:coverage --workspace=bindery-merge
- name: vscode-ext coverage
run: npm run compile --workspace=vscode-ext && npm run test:coverage --workspace=vscode-ext
- name: obsidian-plugin coverage
run: npm run compile --workspace=obsidian-plugin && npm run test:coverage --workspace=obsidian-plugin
- name: Upload coverage reports
if: always()
uses: actions/upload-artifact@v7
with:
name: coverage
path: |
bindery-core/coverage/
bindery-merge/coverage/
mcp-ts/coverage/
vscode-ext/coverage/
obsidian-plugin/coverage/