-
Notifications
You must be signed in to change notification settings - Fork 6
90 lines (83 loc) · 2.48 KB
/
main-test.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
90
name: Main test
on:
push:
branches: [ stag, main ]
pull_request:
branches: [ stag ]
jobs:
build:
runs-on: ubuntu-latest
# NOTE: keep in sync with other workflows
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
rabbitmq:
image: rabbitmq
env:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
ports:
- 5672:5672
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('dev-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
sudo apt-get install -y redis-tools
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
- name: Run unit test and e2e test
env:
PGPASSWORD: postgres
SERVER_HOST: http://dev.cha.fan:8080
SERVER_NAME: dev.cha.fan
PROJECT_NAME: Chafan Dev
BACKEND_CORS_ORIGINS: '[]'
SECRET_KEY: chafandev
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/chafan_dev
REDIS_URL: redis://localhost:6379
FIRST_SUPERUSER: admin@cha.fan
FIRST_SUPERUSER_PASSWORD: superuser
USERS_OPEN_REGISTRATION: True
RABBITMQ_URL: amqp://guest:guest@localhost:5672/%2f
EMAILS_FROM_EMAIL: contact@cha.fan
EMAILS_ENABLED: True
CREATE_SITE_FORCE_NEED_APPROVAL: False
ENV: dev
run: |
PYTHONPATH=$PWD make check
psql -h localhost -p 5432 -U postgres -c 'create database chafan_dev;'
PYTHONPATH=$PWD alembic upgrade head
PYTHONPATH=$PWD python scripts/initial_data.py
PYTHONPATH=$PWD scripts/run-unit-tests.sh