-
-
Notifications
You must be signed in to change notification settings - Fork 10
100 lines (90 loc) · 2.75 KB
/
django.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
91
92
93
94
95
96
97
98
99
100
name: Django CI
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
env:
DJANGO_FIELD_ENCRYPTION_KEY: v6AYhriFBEktgOrXXdKK0X4IU6noDCfSbqPxJ1fIoW0=
DJANGO_SECRET_KEY: django-insecure-@o-)qrym-cn6_*mx8dnmy#m4*$j%8wyy+l=)va&pe)9e7@o4i)
REDIS_URL: redis://localhost:6379
TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
DJANGO_SETTINGS_MODULE: botweb.settings.test
# right now, some tests rely on the ability to pull a valid user config from the ENV
# let's make sure `config` doesn't throw an exception in this case. Since the cassettes
# are recorded when there is a valid ENV-based user configuration we only need to worry
# about this in CI
USER_PREFERENCES: '{"livemode":true}'
USER_BINANCE_API_KEY: ""
USER_BINANCE_SECRET_KEY: ""
COINMARKETCAP_API_KEY: ""
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
postgres:
image: postgres
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9.13
# https://stackoverflow.com/questions/62977821/how-to-cache-poetry-install-for-github-actions
- name: Install poetry
uses: snok/[email protected]
with:
version: 1.1.14
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
# - name: lint
# run: |
# source .venv/bin/activate
# pylint **/*.py
- name: code formatting
run: |
set -eax
source .venv/bin/activate
black --version
black --check .
isort **/*.py -c -v
- name: Setup node.js (for pyright)
uses: actions/setup-node@v3
with:
node-version: "17"
- name: Run type checking
run: |
npm install --location=global pyright@latest
source .venv/bin/activate
pyright .
- name: Run DB migrations
run: |
source .venv/bin/activate
python manage.py migrate
- name: Run Tests
run: |
source .venv/bin/activate
pytest