This repository has been archived by the owner on Aug 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
71 lines (66 loc) · 1.67 KB
/
ci.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
name: Django CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.11.1]
services:
maria105:
image: mariadb:10.5.18
env:
DB_DATABASE: python_blogs
DB_USER: root
DB_PASSWORD:
ports: ['3306:3306']
steps:
- uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Copy settings
run: |
cp settings_local.py.template settings_local.py
- name: Set up MySql
run: |
sudo service mysql start
sudo mysql -uroot -proot -e 'CREATE DATABASE python_blogs;'
- name: Run Migrations
run: |
python manage.py migrate
python manage.py loaddata data.json
env:
DBENGINE: django.db.backends.mysql
DBNAME: python_blogs
DBUSER: root
DBPASSWORD:
DBHOST: 127.0.0.1
DBPORT: $
- name: Run Tests
run: |
python manage.py test
env:
DBENGINE: django.db.backends.mysql
DBNAME: python_blogs
DBUSER: root
DBPASSWORD:
DBHOST: 127.0.0.1
DBPORT: $