-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (81 loc) · 2.96 KB
/
backend.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: My Emotions BackEnd CI
on:
push:
paths:
- 'packages/backend/**'
- 'docker/backend/Dockerfile'
- '.github/workflows/backend.yml'
- '!README.md'
jobs:
build_and_test:
runs-on: ubuntu-18.04
services:
postgres:
image: postgis/postgis:9.5-2.5-alpine
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: my_emotions_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Dependencies on The Root
run: yarn install
- name: Unit Tests
working-directory: ./packages/backend
env:
CI: true
run: yarn run test
- name: e2e Tests
working-directory: ./packages/backend
env:
CI: true
POSTGRES_DB: my_emotions_test
run: yarn run test:e2e --no-cache
build_and_push_docker:
runs-on: ubuntu-18.04
needs: [build_and_test]
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Build My Emotions BackEnd Image
run: docker build -t atahani/my-emotions-backend -f docker/backend/Dockerfile .
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: atahani
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Push Image To docker hub
run: docker push atahani/my-emotions-backend