Skip to content

Commit ed46572

Browse files
authored
Merge pull request #1 from somewes/github-actions
github actions
2 parents b896121 + 403f475 commit ed46572

File tree

10 files changed

+125
-96
lines changed

10 files changed

+125
-96
lines changed

.github/workflows/tests.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# copied from django-cte
2+
name: db_mutex tests
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master,develop]
8+
9+
jobs:
10+
tests:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python: ['3.7', '3.8', '3.9']
16+
# Time to switch to pytest or nose2??
17+
# nosetests is broken on 3.10
18+
# AttributeError: module 'collections' has no attribute 'Callable'
19+
# https://github.com/nose-devs/nose/issues/1099
20+
django:
21+
- 'Django~=2.2.0'
22+
- 'Django~=3.0.0'
23+
- 'Django~=3.1.0'
24+
- 'Django~=3.2.0'
25+
- 'Django~=4.0.0'
26+
- 'Django~=4.1.0'
27+
experimental: [false]
28+
# include:
29+
# - python: '3.9'
30+
# django: 'https://github.com/django/django/archive/refs/heads/main.zip#egg=Django'
31+
# experimental: true
32+
# # NOTE this job will appear to pass even when it fails because of
33+
# # `continue-on-error: true`. Github Actions apparently does not
34+
# # have this feature, similar to Travis' allow-failure, yet.
35+
# # https://github.com/actions/toolkit/issues/399
36+
exclude:
37+
- python: '3.7'
38+
django: 'Django~=4.0.0'
39+
- python: '3.7'
40+
django: 'Django~=4.1.0'
41+
services:
42+
postgres:
43+
image: postgres:latest
44+
env:
45+
POSTGRES_DB: postgres
46+
POSTGRES_PASSWORD: postgres
47+
POSTGRES_USER: postgres
48+
ports:
49+
- 5432:5432
50+
options: >-
51+
--health-cmd pg_isready
52+
--health-interval 10s
53+
--health-timeout 5s
54+
--health-retries 5
55+
steps:
56+
- uses: actions/checkout@v2
57+
- uses: actions/setup-python@v2
58+
with:
59+
python-version: ${{ matrix.python }}
60+
- name: Setup
61+
run: |
62+
python --version
63+
pip install --upgrade pip wheel
64+
pip install -r requirements/requirements.txt
65+
pip install -r requirements/requirements-testing.txt
66+
pip install "${{ matrix.django }}"
67+
pip freeze
68+
- name: Run tests
69+
env:
70+
DB_SETTINGS: >-
71+
{
72+
"ENGINE":"django.db.backends.postgresql_psycopg2",
73+
"NAME":"db_mutex",
74+
"USER":"postgres",
75+
"PASSWORD":"postgres",
76+
"HOST":"localhost",
77+
"PORT":"5432"
78+
}
79+
run: |
80+
coverage run manage.py test db_mutex
81+
coverage report --fail-under=99
82+
continue-on-error: ${{ matrix.experimental }}
83+
- name: Check style
84+
run: flake8 db_mutex

.travis.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
include README.rst
22
include LICENSE
3+
recursive-include requirements *

db_mutex/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.0.0'
1+
__version__ = '3.0.0'

docs/release_notes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Release Notes
22
=============
33

4+
v3.0.0
5+
------
6+
* Django 3.2. 4.0, 4.1
7+
* python 3.9
8+
* drop python 3.6
9+
410
v2.0.0
511
------
612
* Django 3.0, 3.1
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
coverage
2-
coveralls
2+
#coveralls
33
django-dynamic-fixture
44
django-nose
55
freezegun
66
mock
77
psycopg2
8+
flake8

requirements/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Django>=2.2

settings.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import json
23

34
from django.conf import settings
45

@@ -12,28 +13,30 @@ def configure_settings():
1213
test_db = os.environ.get('DB', None)
1314
if test_db is None:
1415
db_config = {
15-
'ENGINE': 'django.db.backends.postgresql_psycopg2',
16-
'NAME': 'ambition_dev',
17-
'USER': 'ambition_dev',
18-
'PASSWORD': 'ambition_dev',
19-
'HOST': 'localhost'
20-
}
21-
elif test_db == 'postgres':
22-
db_config = {
23-
'ENGINE': 'django.db.backends.postgresql_psycopg2',
24-
'USER': 'postgres',
16+
'ENGINE': 'django.db.backends.postgresql',
2517
'NAME': 'db_mutex',
18+
'USER': 'postgres',
19+
'PASSWORD': '',
20+
'HOST': 'db',
2621
}
27-
elif test_db == 'sqlite':
22+
elif test_db == 'postgres':
2823
db_config = {
29-
'ENGINE': 'django.db.backends.sqlite3',
24+
'ENGINE': 'django.db.backends.postgresql',
3025
'NAME': 'db_mutex',
26+
'USER': 'postgres',
27+
'PASSWORD': '',
28+
'HOST': 'db',
3129
}
3230
else:
3331
raise RuntimeError('Unsupported test DB {0}'.format(test_db))
3432

33+
# Check env for db override (used for github actions)
34+
if os.environ.get('DB_SETTINGS'):
35+
db_config = json.loads(os.environ.get('DB_SETTINGS'))
36+
3537
settings.configure(
3638
TEST_RUNNER='django_nose.NoseTestSuiteRunner',
39+
SECRET_KEY='*',
3740
NOSE_ARGS=['--nocapture', '--nologcapture', '--verbosity=1'],
3841
MIDDLEWARE_CLASSES=(),
3942
DATABASES={

setup.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ def get_version():
1919
raise RuntimeError('Unable to find version string in {0}.'.format(VERSION_FILE))
2020

2121

22+
def get_lines(file_path):
23+
return open(file_path, 'r').read().split('\n')
24+
25+
26+
install_requires = get_lines('requirements/requirements.txt')
27+
tests_require = get_lines('requirements/requirements-testing.txt')
28+
29+
2230
setup(
2331
name='django-db-mutex',
2432
version=get_version(),
@@ -30,28 +38,23 @@ def get_version():
3038
packages=find_packages(),
3139
classifiers=[
3240
'Programming Language :: Python',
33-
'Programming Language :: Python :: 3.6',
3441
'Programming Language :: Python :: 3.7',
42+
'Programming Language :: Python :: 3.8',
43+
'Programming Language :: Python :: 3.9',
3544
'Intended Audience :: Developers',
3645
'License :: OSI Approved :: MIT License',
3746
'Operating System :: OS Independent',
3847
'Framework :: Django',
3948
'Framework :: Django :: 2.2',
4049
'Framework :: Django :: 3.0',
4150
'Framework :: Django :: 3.1',
51+
'Framework :: Django :: 3.2',
52+
'Framework :: Django :: 4.0',
53+
'Framework :: Django :: 4.1',
4254
],
4355
license='MIT',
44-
install_requires=[
45-
'Django>=2.2',
46-
],
47-
tests_require=[
48-
'psycopg2',
49-
'django-nose>=1.4',
50-
'mock',
51-
'coverage>=3.7.1',
52-
'freezegun>=0.3.2',
53-
'django-dynamic-fixture'
54-
],
56+
install_requires=install_requires,
57+
tests_require=tests_require,
5558
test_suite='run_tests.run_tests',
5659
include_package_data=True,
5760
zip_safe=False,

tox.ini

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)