Skip to content

Commit 6c6eddf

Browse files
committed
GitHub python test
1 parent 65b4d56 commit 6c6eddf

File tree

4 files changed

+601
-444
lines changed

4 files changed

+601
-444
lines changed

.github/workflows/python-package.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
env:
13+
DJANGO_SETTINGS_MODULE=tests.settings
14+
15+
16+
jobs:
17+
build:
18+
19+
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
python-version: ["3.9", "3.10"]
24+
django-version: ["3.2.18", "4.0.10", "4.1.7"]
25+
database: ["sqlite:memory:", "postgres://:@:/django-shared-property"]
26+
27+
steps:
28+
- uses: actions/checkout@v3
29+
- name: Set up Python ${{ matrix.python-version }}
30+
uses: actions/setup-python@v3
31+
with:
32+
python-version: ${{ matrix.python-version }}
33+
- name: Install dependencies
34+
run: |
35+
python -m pip install --upgrade pip poetry flake8
36+
poetry run pip install django=="${{ matrix.django-version }}"
37+
poetry install --with dev,test
38+
- name: Lint with flake8
39+
run: |
40+
# stop the build if there are Python syntax errors or undefined names
41+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
42+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
43+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
44+
- name: Test with pytest
45+
run: |
46+
DATABASE_URL=${{ matrix.database }} poetry run pytest --cov=src/django_shared_property -s tests/tests/

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
python 3.11.1 3.10.9 3.9.16
2+
poetry 1.3.2

0 commit comments

Comments
 (0)