Skip to content

Commit

Permalink
Run tests on openend PRs and master push
Browse files Browse the repository at this point in the history
  • Loading branch information
kviktor authored Apr 17, 2023
1 parent c56f9eb commit cbdd9ca
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[run]
branch = True
source = django_jsonform
omit = *tests*,__main__
58 changes: 58 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: django-jsonform tests

on:
pull_request:
push:
branches: master

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
django-version: ["2.2", "3.2", "4.1", "4.2", "main"]
exclude:
- django-version: 2.2
python-version: 3.10
- django-version: 2.2
python-version: 3.11
- django-version: 3.2
python-version: 3.11
- django-version: 4.1
python-version: 3.7
- django-version: 4.2
python-version: 3.7
- django-version: "main"
python-version: 3.7
- django-version: "main"
python-version: 3.8
- django-version: "main"
python-version: 3.9

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install Django ${{ matrix.django-version }}
run: python -m pip install django~=${{ matrix.django-version }}.0
if: matrix.django-version != 'main'
- name: Install Django main
run: python -m pip install https://github.com/django/django/archive/refs/heads/main.zip
if: matrix.django-version == 'main'
- name: Install library to run tests
run: python -m pip install -e .
- name: Verify versions
run: |
python --version
python -c "import django ; print(django.VERSION)"
- name: Run tests
run: |
python -m pip install coverage
coverage run tests/__main__.py
coverage report -m
1 change: 0 additions & 1 deletion tests/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import sys
import unittest
import django
import django_settings


TEST_DIR = os.path.dirname(os.path.abspath(__file__))
Expand Down
9 changes: 9 additions & 0 deletions tests/django_settings.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
SECRET_KEY = "secret for test"

ROOT_URLCONF='django_jsonform.urls'

INSTALLED_APPS=[
'django_jsonform',
]

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ":memory:",
},
}

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
Expand Down

0 comments on commit cbdd9ca

Please sign in to comment.