forked from melinath/django-daguerre
-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (109 loc) · 3.31 KB
/
ci.yml
File metadata and controls
117 lines (109 loc) · 3.31 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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: CI
on:
push:
pull_request:
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11", "3.12"]
django: ["3.2", "4.2", "5.2"]
db: ["sqlite3", "mysql", "postgres"]
exclude:
- python: "3.9"
django: "5.2"
db: "sqlite3"
- python: "3.9"
django: "5.2"
db: "mysql"
- python: "3.9"
django: "5.2"
db: "postgres"
- python: "3.11"
django: "3.2"
db: "sqlite3"
- python: "3.11"
django: "3.2"
db: "mysql"
- python: "3.11"
django: "3.2"
db: "postgres"
- python: "3.12"
django: "3.2"
db: "sqlite3"
- python: "3.12"
django: "3.2"
db: "mysql"
- python: "3.12"
django: "3.2"
db: "postgres"
services:
mysql:
image: mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
MYSQL_DATABASE: daguerre_test
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h localhost"
--health-interval=10s
--health-timeout=5s
--health-retries=5
postgres:
image: postgres:15
env:
POSTGRES_DB: daguerre_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=10s
--health-timeout=5s
--health-retries=5
env:
DB: ${{ matrix.db }}
DJANGO: ${{ matrix.django }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: pip
- name: Install client tools
if: matrix.db != 'sqlite3'
run: |
sudo apt-get update
sudo apt-get install -y mysql-client postgresql-client
- name: Install dependencies
run: |
echo "Django version: ${{ matrix.django }}"
pip install .
pip install -r test_project/requirements-${{ matrix.django }}.txt
pip install flake8
if [ "${{ matrix.db }}" = "mysql" ]; then pip install mysqlclient==1.4.6; fi
if [ "${{ matrix.db }}" = "postgres" ]; then pip install psycopg2-binary==2.8.4; fi
- name: Lint
run: flake8 --ignore=E501,E731,W504 daguerre
- name: Prepare databases
if: matrix.db != 'sqlite3'
run: |
if [ "${{ matrix.db }}" = "mysql" ]; then
until mysqladmin ping -h 127.0.0.1 --silent; do sleep 2; done
mysql -h 127.0.0.1 -e 'CREATE DATABASE IF NOT EXISTS daguerre_test;'
fi
if [ "${{ matrix.db }}" = "postgres" ]; then
until pg_isready -h 127.0.0.1 -U postgres; do sleep 2; done
psql -h 127.0.0.1 -U postgres -c 'drop database if exists daguerre_test;'
psql -h 127.0.0.1 -U postgres -c 'create database daguerre_test;'
fi
- name: Run tests
run: |
cd test_project
./manage.py test --verbosity=2 daguerre