-
Notifications
You must be signed in to change notification settings - Fork 15
72 lines (64 loc) · 2.19 KB
/
ci.yml
File metadata and controls
72 lines (64 loc) · 2.19 KB
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: Plio CI
on:
pull_request:
push:
branches: [master]
jobs:
pre-commit:
name: Pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.0
test:
name: Test cases
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
# Maps port 6379 on service container to the host
- 6379:6379
# Set health checks to wait until redis has started
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
# Creates a postgres docker where migrations will run.
db:
image: postgres:12.3-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: github_actions_testing
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
# Install Python. This matches the Python version in Dockerfile.
- 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 requirements.txt
- name: Run Test Cases
env:
DB_HOST: 127.0.0.1
DB_PORT: 5432
DB_NAME: github_actions_testing
DB_USER: postgres
DB_PASSWORD: postgres
SECRET_KEY: wpurj&oym6m@kcp(m&z(q-g0bo-r*+!f_&j(94di8j&_j4m%2s # random secret key
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_STORAGE_BUCKET_NAME: ${{ secrets.AWS_STORAGE_BUCKET_NAME }}
REDIS_HOSTNAME: 127.0.0.1
REDIS_PORT: 6379
# command to run tests and generate coverage metrics
run: coverage run manage.py test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1