Skip to content

Commit db253a0

Browse files
committed
CI/CD github action workflow
1 parent 411ac89 commit db253a0

File tree

7 files changed

+1882
-31
lines changed

7 files changed

+1882
-31
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

.eslintrc

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": [
5+
"@typescript-eslint"
6+
],
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/eslint-recommended",
10+
"plugin:@typescript-eslint/recommended"
11+
],
12+
"rules": {
13+
"@typescript-eslint/interface-name-prefix": "off",
14+
"@typescript-eslint/explicit-function-return-type": "off",
15+
"@typescript-eslint/explicit-module-boundary-types": "off",
16+
"@typescript-eslint/no-explicit-any": "off",
17+
"@typescript-eslint/no-unused-vars": "off"
18+
}
19+
}

.github/workflows/ci.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: CI/CD pipeline
2+
3+
on: push
4+
5+
jobs:
6+
backend:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
12+
services:
13+
postgres:
14+
image: postgres
15+
env:
16+
POSTGRES_USER: test
17+
POSTGRES_PASSWORD: password123
18+
POSTGRES_DB: testdb
19+
ports:
20+
- 5432:5432
21+
22+
env:
23+
JWT_SECRET_KEY: 5OQ1ZE9FJiP0d3PKTnOT
24+
DATABASE_URL: postgresql://test:password123@localhost:5432/testdb?schema=public
25+
26+
steps:
27+
- name: Notify Trigger
28+
run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event on branch ${{ github.ref }}."
29+
30+
- name: Checkout Repository
31+
uses: actions/checkout@v2
32+
33+
- name: Setup Node.js
34+
uses: actions/setup-node@v2
35+
36+
- name: Cache Dependencies
37+
uses: actions/cache@v2
38+
id: backend-npm-cache
39+
with:
40+
path: "node_modules"
41+
key: client-npm-${{ hashFiles('package.json') }}
42+
43+
- name: Install Dependencies
44+
run: npm install
45+
if: steps.backend-npm-cache.outputs.cache-hit != 'true'
46+
47+
- name: Run Linter
48+
run: npm run lint
49+
50+
- name: Run Typecheck
51+
run: npm run typecheck
52+
53+
- name: Execute Migrations
54+
run: npx prisma migrate deploy
55+
56+
- name: Run Test
57+
run: npm run test
58+
59+
- name: Display Job Status
60+
run: echo "🍏 This job's status is ${{ job.status }}."

README.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ npm install @faker-js/faker tap ts-mock-imports
2121

2222
```
2323
npm install -D ts-node ts-node-dev typescript @types/node dotenv nodemon @types/bcrypt
24-
24+
npm install -D eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
2525
npm install -D @types/tap sinon
2626
```
2727

@@ -63,10 +63,16 @@ To run database directly inside container, please follow below steps:
6363

6464
- To change environment variables, please use [.env](.env.example) file
6565

66-
- Run docker container
66+
- Run db docker container and app
67+
68+
```base
69+
npm run start
70+
```
71+
72+
- Run database docker container
6773

6874
```bash
69-
npm run start:docker
75+
npm run start:db
7076
```
7177

7278
- To stop docker container

0 commit comments

Comments
 (0)