diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..90ad520 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,45 @@ +name: CI +on: + push: + branches: [main] + pull_request: + branches: [main] + +env: + NODE_VERSION: 20 + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: npm + - run: npm ci + - run: npm run lint + - run: npx prettier --check "**/*.{ts,tsx}" + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: npm + - run: npm ci + - run: npm run test:backend + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: npm + - run: npm ci + - run: npm run build:backend + - run: npm run build:frontend diff --git a/apps/backend/.eslintrc.js b/apps/backend/.eslintrc.js new file mode 100644 index 0000000..d700315 --- /dev/null +++ b/apps/backend/.eslintrc.js @@ -0,0 +1,23 @@ +module.exports = { + parser: '@typescript-eslint/parser', + parserOptions: { + project: 'tsconfig.json', + tsconfigRootDir: __dirname, + sourceType: 'module', + }, + plugins: ['@typescript-eslint/eslint-plugin'], + extends: [ + 'plugin:@typescript-eslint/recommended', + ], + root: true, + env: { + node: true, + jest: true, + }, + ignorePatterns: ['.eslintrc.js'], + rules: { + '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-require-imports': 'off', + }, +}; diff --git a/apps/backend/src/modules/candles/dto/candles-query.dto.ts b/apps/backend/src/modules/candles/dto/candles-query.dto.ts index d853b37..56f6642 100644 --- a/apps/backend/src/modules/candles/dto/candles-query.dto.ts +++ b/apps/backend/src/modules/candles/dto/candles-query.dto.ts @@ -1,5 +1,5 @@ import { ApiProperty } from '@nestjs/swagger'; -import { IsString, IsEnum, IsDateString } from 'class-validator'; +import { IsEnum, IsDateString } from 'class-validator'; export enum CandleInterval { HOUR = '1h', diff --git a/apps/backend/src/modules/securities/securities.controller.ts b/apps/backend/src/modules/securities/securities.controller.ts index d07b06e..63612e0 100644 --- a/apps/backend/src/modules/securities/securities.controller.ts +++ b/apps/backend/src/modules/securities/securities.controller.ts @@ -1,5 +1,5 @@ import { Controller, Get, Query, ValidationPipe } from '@nestjs/common'; -import { ApiTags, ApiOperation, ApiQuery } from '@nestjs/swagger'; +import { ApiTags, ApiOperation } from '@nestjs/swagger'; import { SecuritiesService } from './securities.service'; import { SearchQueryDto, SecurityType } from './dto/search-query.dto'; diff --git a/docs/superpowers/plans/2026-06-13-cicd-implementation.md b/docs/superpowers/plans/2026-06-13-cicd-implementation.md new file mode 100644 index 0000000..c94e210 --- /dev/null +++ b/docs/superpowers/plans/2026-06-13-cicd-implementation.md @@ -0,0 +1,110 @@ +# CI/CD Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Add Gitea Actions CI pipeline with lint, test, and build for the MoexVibe monorepo. + +**Architecture:** Single `.gitea/workflows/ci.yml` file with three parallel jobs (lint, test, build) triggered on push/PR to main. One script addition to root `package.json` for format checking. + +**Tech Stack:** Gitea Actions (GitHub Actions-compatible YAML), Node.js 20, npm workspaces + +--- + +### Task 1: Add `format:check` script to root package.json + +**Files:** +- Modify: `package.json` (root) + +- [ ] **Step 1: Read root package.json** + +- [ ] **Step 2: Add format:check script** + +Edit `package.json`: add `"format:check": "prettier --check \"**/*.{ts,tsx}\""` to the `scripts` section, after `format`. + +- [ ] **Step 3: Verify the script runs** + +Run: `npm run format:check` +Expected: exits 0 (all files already formatted) or lists formatting errors + +- [ ] **Step 4: Commit** + +```bash +git add package.json +git commit -m "ci: add format:check script for CI pipeline" +``` + +--- + +### Task 2: Create Gitea Actions workflow + +**Files:** +- Create: `.gitea/workflows/ci.yml` + +- [ ] **Step 1: Create workflow directory** + +Run: `mkdir -p .gitea/workflows` + +- [ ] **Step 2: Create ci.yml with full pipeline** + +Create `.gitea/workflows/ci.yml`: + +```yaml +name: CI +on: + push: + branches: [main] + pull_request: + branches: [main] + +env: + NODE_VERSION: 20 + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: npm + - run: npm ci + - run: npm run lint + - run: npx prettier --check "**/*.{ts,tsx}" + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: npm + - run: npm ci + - run: npm run test:backend + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: npm + - run: npm ci + - run: npm run build:backend + - run: npm run build:frontend +``` + +- [ ] **Step 3: Commit** + +```bash +git add .gitea/workflows/ci.yml +git commit -m "ci: add Gitea Actions pipeline with lint, test, build" +``` + +--- + +### Verification + +После пуша в `main` (или создания PR) проверить на https://git.ksv741.keenetic.pro/moex/moex-vibe/actions что pipeline запустился и все 3 job'а зелёные. diff --git a/docs/superpowers/specs/2026-06-13-cicd-design.md b/docs/superpowers/specs/2026-06-13-cicd-design.md new file mode 100644 index 0000000..b6a5233 --- /dev/null +++ b/docs/superpowers/specs/2026-06-13-cicd-design.md @@ -0,0 +1,46 @@ +# CI/CD Pipeline for MoexVibe + +**Date:** 2026-06-13 +**Status:** Approved + +## Overview + +Continuous Integration pipeline using Gitea Actions (GitHub Actions-compatible format) for the MoexVibe monorepo. + +## Triggers + +- `push` to `main` branch +- `pull_request` into `main` branch + +## Pipeline Structure + +Three parallel jobs with no interdependencies: + +| Job | Commands | Cache | +|---|---|---| +| `lint` | `npm ci` → `npm run lint` → `npx prettier --check "**/*.{ts,tsx}"` | npm | +| `test` | `npm ci` → `npm run test:backend` | npm | +| `build` | `npm ci` → `npm run build:backend` → `npm run build:frontend` | npm | + +## Runtime + +- `runs-on: ubuntu-latest` (Gitea Actions runner) +- Node.js 20 +- npm cache via `actions/setup-node` with `cache: 'npm'` + +## Configuration File + +`.gitea/workflows/ci.yml` + +## Project Changes + +1. Create `.gitea/workflows/ci.yml` +2. Add `"format:check": "prettier --check \"**/*.{ts,tsx}\""` script to root `package.json` + +## Explicitly Excluded + +- Deployment (not required) +- Docker image building +- Artifact publishing +- Frontend tests (none exist in project) +- Frontend lint (no config exists) diff --git a/package.json b/package.json index e2cd67a..36aee0e 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "build:frontend": "npm run build -w apps/frontend", "test:backend": "npm run test -w apps/backend", "lint": "npm run lint -w apps/backend", - "format": "prettier --write \"**/*.{ts,tsx}\"" + "format": "prettier --write \"**/*.{ts,tsx}\"", + "format:check": "prettier --check \"**/*.{ts,tsx}\"" }, "devDependencies": { "prettier": "^3.0.0"