-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (71 loc) · 2 KB
/
tournament.yaml
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
name: Tournament Tests
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
jobs:
build:
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:16.0-bookworm
env:
POSTGRES_DB: ${{ secrets.DB_NAME }}
POSTGRES_USER: ${{ secrets.DB_USER }}
POSTGRES_PASSWORD: ${{ secrets.DB_PASSWORD }}
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Generate .env file
run: |
pip install cryptography python-dotenv
python common/src/generate_env.py
- name: Copy common
working-directory: tournament/src/
run: |
cp -r ../../common .
- name: Install dependencies
working-directory: tournament/
run: |
python -m pip install --upgrade pip
pip install flake8
pip install isort
pip install -r docker/requirements.txt
pip install -r src/common/docker/requirements.txt
- name: Run PEP8 check
working-directory: tournament/src/
run: |
flake8 . --max-line-length=120 --exclude=migrations
- name: Check imports
working-directory: tournament/src/
run: |
isort . --check-only
- name: Run Django migrations
working-directory: tournament/src/
env:
DB_NAME: ${{ secrets.DB_NAME }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
run: |
python manage.py makemigrations
python manage.py migrate
- name: Run unit tests
working-directory: tournament/src/
env:
DB_NAME: ${{ secrets.DB_NAME }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
run: |
python manage.py test