Skip to content

tests: Added e2e testing for projects endpoints. Added unit test for … #27

tests: Added e2e testing for projects endpoints. Added unit test for …

tests: Added e2e testing for projects endpoints. Added unit test for … #27

Workflow file for this run

name: API CI
on:
push:
branches:
- main
- develop
- tests
paths:
- "api/**"
- ".github/workflows/api-ci.yml"
pull_request:
branches:
- main
- develop
- tests
paths:
- "api/**"
- ".github/workflows/api-ci.yml"
defaults:
run:
working-directory: ./api
jobs:
linter:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
cache-dependency-path: package-lock.json
- name: Install dependencies
run: npm ci
- name: Run linter
run: npm run lint
unit-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
cache-dependency-path: package-lock.json
- name: Setup environment variables
run: |
echo "JWT_SECRET_VERIFY_EMAIL=test-EMAIL-secret" >> $GITHUB_ENV
echo "JWT_ACCESS_SECRET=test-ACCESS-secret" >> $GITHUB_ENV
echo "JWT_REFRESH_SECRET=test-REFRESH-secret" >> $GITHUB_ENV
echo "NODE_ENV=development" >> $GITHUB_ENV
- name: install dependencies
run: npm ci
- name: run unit tests
run: npm run test
e2e:
runs-on: ubuntu-latest
container:
image: node:20
services:
postgres-e2e:
image: postgres:13
ports:
- 5432:5432
env:
POSTGRES_DB: db_e2e
POSTGRES_USER: e2e
POSTGRES_PASSWORD: e2e123
redis-e2e:
image: redis:8
ports:
- 6380:6379
steps:
- name: Checkout
uses: actions/checkout@v2
- name: install dependencies
run: npm ci
- name: run e2e
run: npm run e2e:ci
env:
PORT: 3000
DATABASE_URL: postgres://e2e:e2e123@postgres-e2e:5432/db_e2e
JWT_SECRET_VERIFY_EMAIL: verify-email-test
JWT_ACCESS_SECRET: access-secret-test
JWT_REFRESH_SECRET: refresh-secret-test
REDIS_HOST: redis-e2e
REDIS_PORT: 6379
REDIS_PASSWORD: