-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (75 loc) · 2.19 KB
/
tests.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
name: Python application
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build_phd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: build in docker
run: docker build -t phd .
- name: login to dockerhub
run: docker login -u ${{ secrets.dockerHubLogin }} -p ${{ secrets.dockerHubPassword }}
- name: add tag
run: docker tag phd:latest rokkerdenis/phd:latest
- name: push to dockerhub
run: docker push rokkerdenis/phd
build_mi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: build in docker
run: docker build -t mi -f ./pkg/mi/dockerfile .
- name: login to dockerhub
run: docker login -u ${{ secrets.dockerHubLogin }} -p ${{ secrets.dockerHubPassword }}
- name: add tag
run: docker tag mi:latest rokkerdenis/mi:latest
- name: push to dockerhub
run: docker push rokkerdenis/mi
tests:
runs-on: ubuntu-latest
needs: build_phd
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
web:
image: rokkerdenis/phd
env:
ADDR: ":3001"
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres?sslmode=disable
GLOBAL_SALT: asadfaksdfakjshdfkahsfkjahsdflkahdflashdfalh
MIN_LEN_FOR_NEW_PASSWORD: 1
TOKEN_TTL: 900h
ports:
- 3001:3001
steps:
- uses: actions/checkout@v2
- name: migrations
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable
run: ./bin/mi up
- name: Logs
run: docker logs "${{ job.services.web.id }}"
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r tests/requirements.txt
- name: Test with pytest
run: |
pytest -s