diff --git a/.github/workflows/CI-workflow.yml b/.github/workflows/CI-workflow.yml new file mode 100644 index 0000000..343a78c --- /dev/null +++ b/.github/workflows/CI-workflow.yml @@ -0,0 +1,115 @@ +name: CI workflow + +on: + pull_request: + branches: ['dev', 'main'] + paths-ignore: + - '*.md' + - 'docs/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + frontend: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'pnpm' + + - name: Install deps + run: pnpm install --frozen-lockfile + + - name: Lint + run: pnpm lint:frontend + + - name: Lint FSD + run: pnpm lint:fsd:frontend + + - name: Format + run: pnpm format:check:frontend + + - name: Typecheck + run: pnpm typecheck:frontend + + # - name: Unit tests + # run: pnpm test:frontend:ci + + - name: Build + run: pnpm build:frontend + + # - name: Build Storybook + # run: pnpm build-storybook + + backend: + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:16 + env: + POSTGRES_DB: test + POSTGRES_USER: test + POSTGRES_PASSWORD: test + ports: + - 5432:5432 + options: >- + --health-cmd="pg_isready" + --health-interval=10s + --health-timeout=5s + --health-retries=5 + + env: + DATABASE_URL: postgresql://test:test@localhost:5432/test + PORT: 3000 + JWT_SECRET: test + JWT_EXPIRES_IN: 7d + NODE_ENV: test + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'pnpm' + + - name: Install deps + run: pnpm install --frozen-lockfile + + - name: Prisma generate + run: pnpm prisma:generate:backend + + - name: Apply migrations (test DB) + run: pnpm prisma:migrate:deploy:backend + + - name: Lint + run: pnpm lint:backend + + - name: Format + run: pnpm format:check:backend + + - name: Typecheck + run: pnpm typecheck:backend + + - name: Unit tests + run: pnpm test:backend:ci + + - name: Build + run: pnpm build:backend diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml deleted file mode 100644 index 00aca52..0000000 --- a/.github/workflows/backend-ci.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: Backend CI - -on: - pull_request: - branches: ['dev', 'main'] - -jobs: - backend: - runs-on: ubuntu-latest - - services: - postgres: - image: postgres:16 - env: - POSTGRES_DB: test - POSTGRES_USER: test - POSTGRES_PASSWORD: test - ports: - - 5432:5432 - options: >- - --health-cmd="pg_isready" - --health-interval=10s - --health-timeout=5s - --health-retries=5 - - env: - DATABASE_URL: postgresql://test:test@localhost:5432/test - PORT: 3000 - JWT_SECRET: test - JWT_EXPIRES_IN: 7d - NODE_ENV: test - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup pnpm - uses: pnpm/action-setup@v3 - with: - version: 9 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'pnpm' - - - name: Install deps - run: pnpm install --frozen-lockfile - - - name: Prisma generate - run: pnpm prisma:generate:backend - - - name: Apply migrations (test DB) - run: pnpm prisma:migrate:deploy:backend - - - name: Lint - run: pnpm lint:backend - - - name: Format - run: pnpm format:check - - - name: Typecheck - run: pnpm typecheck:backend - - - name: Unit tests - run: pnpm test:backend:ci - - - name: Build - run: pnpm build:backend diff --git a/.github/workflows/frontend-ci.yml b/.github/workflows/frontend-ci.yml deleted file mode 100644 index 005065f..0000000 --- a/.github/workflows/frontend-ci.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Frontend CI - -on: - pull_request: - branches: ['dev', 'main'] - -jobs: - frontend: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup pnpm - uses: pnpm/action-setup@v3 - with: - version: 9 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'pnpm' - - - name: Install deps - run: pnpm install --frozen-lockfile - - - name: Lint - run: pnpm lint:frontend - - - name: Lint FSD - run: pnpm lint:fsd:frontend - - - name: Format - run: pnpm format:check - - - name: Typecheck - run: pnpm typecheck:frontend - - # - name: Unit tests - # run: pnpm test:frontend:ci - - - name: Build - run: pnpm build:frontend - - # - name: Build Storybook - # run: pnpm build-storybook diff --git a/package.json b/package.json index a7dfdbf..b35c261 100644 --- a/package.json +++ b/package.json @@ -13,16 +13,20 @@ "lint:fix": "pnpm run --recursive lint:fix", "format": "pnpm run --recursive format", "format:check": "pnpm run --recursive format:check", + "lint:frontend": "pnpm --filter @task-tracker/frontend lint", + "format:check:frontend": "pnpm --filter @task-tracker/frontend format:check", "lint:fsd:frontend": "pnpm --filter @task-tracker/frontend lint:fsd", - "typecheck:frontend": "pnpm --filter @task-tracker/frontend type-check", + "typecheck:frontend": "pnpm --filter @task-tracker/frontend typecheck", "build:frontend": "pnpm --filter @task-tracker/frontend build", + "dev:backend": "pnpm --filter @task-tracker/backend start:dev", "start:backend": "pnpm --filter @task-tracker/backend start:prod", "build:backend": "pnpm --filter @task-tracker/backend build", "lint:backend": "pnpm --filter @task-tracker/backend lint", + "format:check:backend": "pnpm --filter @task-tracker/backend format:check", "test:backend:ci": "pnpm --filter @task-tracker/backend test:ci", - "typecheck:backend": "pnpm --filter @task-tracker/backend type-check", + "typecheck:backend": "pnpm --filter @task-tracker/backend typecheck", "prisma:generate:backend": "pnpm --filter @task-tracker/backend prisma:generate", "prisma:migrate:deploy:backend": "pnpm --filter @task-tracker/backend prisma:migrate:deploy" },