Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 22 additions & 57 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,90 +14,55 @@ on:
- ".github/workflows/backend-ci.yml"

jobs:
test:
name: Test Backend
ci:
name: Lint · TypeCheck · Test · Build
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 5

strategy:
matrix:
node-version: [18.x, 20.x]
env:
NODE_ENV: test
# SENTRY_DSN intentionally absent — every step must pass without it
SENTRY_DSN: ""

steps:
- name: Checkout code
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
- name: Setup Node.js 20
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: "20.x"
cache: "npm"
cache-dependency-path: backend/package-lock.json

- name: Install dependencies
working-directory: ./backend
run: npm ci

- name: Run linter
- name: Lint
working-directory: ./backend
run: npm run lint:check

- name: Check formatting
- name: Format check
working-directory: ./backend
run: npm run format:check

- name: Run tests
- name: TypeScript check — blocks PR on type errors
working-directory: ./backend
run: npx tsc --noEmit

- name: Unit tests
working-directory: ./backend
run: npm run test:ci

- name: Upload coverage reports
if: matrix.node-version == '20.x'
- name: Build
working-directory: ./backend
run: npm run build

- name: Upload coverage
uses: codecov/codecov-action@v4
with:
directory: ./backend/coverage
flags: backend
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}

build:
name: Build Backend
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "npm"
cache-dependency-path: backend/package-lock.json

- name: Install dependencies
working-directory: ./backend
run: npm ci

- name: Build project
working-directory: ./backend
run: npm run build

- name: Check for TypeScript errors
working-directory: ./backend
run: npx tsc --noEmit

status-check:
name: CI Status Check
runs-on: ubuntu-latest
needs: [test, build]
if: always()

steps:
- name: Check if all jobs passed
run: |
if [[ "${{ needs.test.result }}" == "failure" || "${{ needs.build.result }}" == "failure" ]]; then
echo "❌ CI checks failed"
exit 1
fi
echo "✅ All CI checks passed"
2 changes: 1 addition & 1 deletion backend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
project: "tsconfig.json",
project: "tsconfig.eslint.json",
tsconfigRootDir: __dirname,
sourceType: "module",
},
Expand Down
Loading
Loading