stages: - check - test - build - release variables: NODE_VERSION: "20" npm_config_cache: "$CI_PROJECT_DIR/.npm" # Node.js 캐시 .node-cache: &node-cache cache: key: files: - package-lock.json paths: - .npm/ - node_modules/ # ── Check Stage ────────────────────────────────────────── 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" - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH 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" - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # ── Test Stage ─────────────────────────────────────────── 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" - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # ── Build Stage ────────────────────────────────────────── build: stage: build image: node:${NODE_VERSION} <<: *node-cache before_script: - npm ci script: - npm run build artifacts: paths: - out/ expire_in: 1 day rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # ── Release Stage (태그 푸시 시만 실행) ────────────────── package-windows: stage: release tags: - windows # Windows 러너 필요 (native 모듈 빌드) before_script: - npm ci script: - npm run build - npm run dist artifacts: paths: - release/ expire_in: 30 days rules: - if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+/ # Docker 러너에서 Windows 빌드가 불가한 경우 아래 대안 사용: # Wine + electron-builder --linux 크로스빌드 또는 # Windows self-hosted runner 등록