-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (66 loc) · 2.49 KB
/
ci.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
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Continous Integration
on:
push:
branches:
- main
jobs:
# label of the container job
application-testing:
# containers must run in Linux based operating systems
runs-on: ubuntu-latest
# Docker Hub image that `postgres-job` executes in
container: node:latest
# service containers to run with `postgres-job`
services:
# label used to access the service container
postgres:
# Docker Hub image
image: postgres:latest
# service environment variables
# `POSTGRES_HOST` is `postgres`
env:
# optional (defaults to `postgres`)
POSTGRES_DB: ${{ secrets.PGDATABASE_TEST }}
# required
POSTGRES_PASSWORD: ${{ secrets.PGPASSWORD_TEST }}
# optional (defaults to `5432`)
POSTGRES_PORT: 5432
# optional (defaults to `postgres`)
POSTGRES_USER: ${{ secrets.PGUSER_TEST }}
ports:
# maps tcp port 5432 on service container to the host
- 5432:5432
# set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Install PostgreSQL client
run: |
apt-get update
apt-get install --yes postgresql-client
# Downloads a copy of the code in your repository before running CI tests
- name: Check out repository code
uses: actions/checkout@v2
# Performs a clean installation of all dependencies in the `package.json` file
# For more information, see https://docs.npmjs.com/cli/ci.html
- name: Install dependencies
run: npm install
- name: Databasbe Migration and Application Test
# Runs a script that creates a PostgreSQL table, populates
# the table with data, and then retrieves the data.
run: |
npm run migrate:test:prod up
npm run test
env:
CI: true
PGHOST_TEST: postgres
PGUSER_TEST: ${{ secrets.PGUSER_TEST }}
PGDATABASE_TEST: ${{ secrets.PGDATABASE_TEST }}
PGPASSWORD_TEST: ${{ secrets.PGPASSWORD_TEST }}
PGPORT_TEST: ${{ secrets.PGPORT_TEST }}
ACCESS_TOKEN_KEY: ${{ secrets.ACCESS_TOKEN_KEY }}
REFRESH_TOKEN_KEY: ${{ secrets.REFRESH_TOKEN_KEY }}
ACCCESS_TOKEN_AGE: ${{ secrets.ACCCESS_TOKEN_AGE }}