-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (55 loc) · 1.39 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: CI-CD
on:
push:
branches: [ master ]
pull_request:
branches: [ master, development ]
workflow_dispatch:
jobs:
build_test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USERNAME: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test-db
ports:
- 5432:5432
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v2
- name: setup node
uses: actions/setup-node@master
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: |
npm install
npm ci
- name: Connect to PostgreSQL and run migrations
run: |
npm install -g sequelize-cli
npm run db:migrate
npm run db:seed:all
env:
NODE_ENV: test
POSTGRES_USERNAME: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_TEST_HOST: localhost
POSTGRES_PORT: 5432
- name: Run linter and tests
run: |
npm run lint
npm run test
env:
NODE_ENV: test
TOKEN_KEY: test
POSTGRES_USERNAME: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_TEST_HOST: localhost
POSTGRES_PORT: 5432
EVENTS_SERVICE_URL: https://fake.url