d3ro-voice/.gitlab-ci.yml
yunchan8804 9dc8b26c11 ci: lint/typecheck/unit-test를 manual 트리거로 — Docker runner 부재로 stuck 방지
main 푸시마다 자동으로 도는 구조였는데 사내 GitLab에 Docker runner 없어서 계속
pending으로 남음. 필요할 때 UI에서 수동 트리거. Docker runner 붙이면 rules 복원.
2026-04-15 23:11:38 +09:00

143 lines
5.6 KiB
YAML

stages:
- check
- test
- package
- release
variables:
NODE_VERSION: "20"
PYTHON_VERSION: "3.11"
OLLAMA_VERSION: "v0.5.7"
npm_config_cache: "$CI_PROJECT_DIR/.npm"
.node-cache: &node-cache
cache:
key:
files:
- package-lock.json
paths:
- .npm/
- node_modules/
# ────────────────────────────────────────────────────────────────────
# Docker 기반 검증 잡 — 사내 GitLab에 Docker runner가 없으므로 전부 manual.
# 필요 시 UI에서 수동 트리거. Docker runner 붙이면 rules를 auto로 복원.
# ────────────────────────────────────────────────────────────────────
lint:
stage: check
image: node:${NODE_VERSION}
<<: *node-cache
before_script:
- npm ci --ignore-scripts
script:
- npm run lint
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual
allow_failure: true
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
allow_failure: true
typecheck:
stage: check
image: node:${NODE_VERSION}
<<: *node-cache
before_script:
- npm ci --ignore-scripts
script:
- npm run typecheck
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual
allow_failure: true
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
allow_failure: true
unit-test:
stage: test
image: node:${NODE_VERSION}
<<: *node-cache
before_script:
- npm ci --ignore-scripts
script:
- npm run test:unit
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual
allow_failure: true
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
allow_failure: true
# ────────────────────────────────────────────────────────────────────
# Package Windows — 태그 푸시(v*) 또는 default 브랜치 수동 트리거 시 실행.
# self-hosted Windows runner (shell executor, powershell shell) 필요.
# 이 PC의 Node/Python/npm을 그대로 사용.
# ────────────────────────────────────────────────────────────────────
package-windows:
stage: package
tags:
- windows
- shell
before_script:
- node --version
- python --version
- npm ci
script:
# 1) Python sidecar 의존성 + PyInstaller 빌드
- python -m pip install --upgrade pip
- python -m pip install pyinstaller
- python -m pip install -r apps/desktop/sidecar/requirements.txt
- python apps/desktop/scripts/build-sidecar.py
# 2) SoX 다운로드
- powershell -ExecutionPolicy Bypass -File apps/desktop/scripts/download-sox.ps1
# 3) Ollama 다운로드
- powershell -ExecutionPolicy Bypass -File apps/desktop/scripts/download-ollama.ps1
# 4) electron-vite 빌드 + electron-builder NSIS 패키징
- npm run build --workspace=@d3ro/desktop
- npm run dist --workspace=@d3ro/desktop
artifacts:
name: "d3ro-voice-windows-${CI_COMMIT_SHORT_SHA}"
# win-unpacked/ (수GB)은 제외하고 최종 .exe 설치파일 + 메타만 업로드.
# expose_as는 와일드카드와 병행 불가라 제거. Artifacts 링크는 Job 페이지에서 접근.
paths:
- apps/desktop/release/*/*.exe
- apps/desktop/release/*/latest.yml
- apps/desktop/release/*/*.blockmap
expire_in: 90 days
rules:
- if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+/
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
allow_failure: true
# ────────────────────────────────────────────────────────────────────
# Release — 같은 Windows runner에서 GitLab API를 curl로 호출해 Release 생성.
# release-cli Docker 이미지 대신 shell+curl로 처리하여 Docker runner 불필요.
# ────────────────────────────────────────────────────────────────────
release-create:
stage: release
tags:
- windows
- shell
needs:
- job: package-windows
artifacts: false
script:
- |
$artifactUrl = "$env:CI_PROJECT_URL/-/jobs/artifacts/$env:CI_COMMIT_TAG/download?job=package-windows"
$description = "## D3RO Voice $env:CI_COMMIT_TAG`n`nWindows 설치 파일은 [package-windows 잡 artifacts]($artifactUrl)에서 받을 수 있습니다.`n`n- 기본 LLM 모델: ``gemma4:e4b`` (첫 실행 시 자동 다운로드, ~9.6GB)`n- Whisper 모델: ``large-v3`` (첫 전사 시 자동 다운로드, ~3GB)`n- 설치 마법사가 Visual C++ 재배포 패키지를 자동 다운로드/설치"
$body = @{
name = "D3RO Voice $env:CI_COMMIT_TAG"
tag_name = "$env:CI_COMMIT_TAG"
description = $description
} | ConvertTo-Json -Compress
Invoke-RestMethod `
-Uri "$env:CI_API_V4_URL/projects/$env:CI_PROJECT_ID/releases" `
-Method Post `
-Headers @{ "JOB-TOKEN" = "$env:CI_JOB_TOKEN" ; "Content-Type" = "application/json" } `
-Body $body
rules:
- if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+/