Skip to content

fix: apply post-merge review follow-up #184

fix: apply post-merge review follow-up

fix: apply post-merge review follow-up #184

Workflow file for this run

name: Backend CI
on:
push:
paths:
- 'backend/**'
- '.github/workflows/**'
pull_request:
paths:
- 'backend/**'
- '.github/workflows/**'
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run linter
working-directory: backend
env:
DATABASE_HOST: localhost
DATABASE_PORT: 5432
DATABASE_USER: test
DATABASE_PASSWORD: test
DATABASE_NAME: station_test
JWT_SECRET: test-secret-key-for-ci
run: pnpm run lint
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run unit tests
working-directory: backend
env:
NODE_ENV: test
DATABASE_HOST: localhost
DATABASE_PORT: 5432
DATABASE_USER: test
DATABASE_PASSWORD: test
DATABASE_NAME: station_test
JWT_SECRET: test-secret-key-for-ci
run: pnpm test --coverage --passWithNoTests
- name: Upload coverage reports
uses: codecov/codecov-action@v3
with:
files: ./backend/coverage/lcov.info
flags: backend
fail_ci_if_error: false
e2e-tests:
name: E2E Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: station_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run E2E tests
working-directory: backend
env:
NODE_ENV: test
DATABASE_HOST: localhost
DATABASE_PORT: 5432
DATABASE_USER: test
DATABASE_PASSWORD: test
DATABASE_NAME: station_test
JWT_SECRET: test-secret-key-for-ci
run: pnpm run test:e2e
build:
name: Build
runs-on: ubuntu-latest
needs: [lint, unit-tests]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build application
working-directory: backend
env:
DATABASE_HOST: localhost
DATABASE_PORT: 5432
DATABASE_USER: test
DATABASE_PASSWORD: test
DATABASE_NAME: station_test
JWT_SECRET: test-secret-key-for-ci
run: pnpm run build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: backend-dist
path: backend/dist
retention-days: 7