Skip to content

Commit 8f94308

Browse files
committed
Initial commit
1 parent 9a36a41 commit 8f94308

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2597
-4
lines changed
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- '*.*.*'
8+
9+
pull_request:
10+
branches:
11+
- main
12+
- '*.*.*'
13+
14+
release:
15+
types: [ published ]
16+
17+
jobs:
18+
19+
black:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Setup Python
25+
uses: actions/setup-python@master
26+
with:
27+
python-version: '3.13'
28+
29+
- name: Install packages
30+
run: pip install -r requirements_dev.txt
31+
32+
- name: Black
33+
run: |
34+
black --check -l 120 simple_oauth2/ tests/
35+
36+
isort:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- name: Setup Python
42+
uses: actions/setup-python@master
43+
with:
44+
python-version: '3.13'
45+
46+
- name: Install packages
47+
run: pip install -r requirements_dev.txt
48+
49+
- name: Isort
50+
run: |
51+
isort --check simple_oauth2/ tests/
52+
53+
pycodestyle:
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@v4
57+
58+
- name: Setup Python
59+
uses: actions/setup-python@master
60+
with:
61+
python-version: '3.13'
62+
63+
- name: Install packages
64+
run: pip install -r requirements_dev.txt
65+
66+
- name: Pycodestyle
67+
run: |
68+
pycodestyle simple_oauth2/ tests/
69+
70+
pydocstyle:
71+
runs-on: ubuntu-latest
72+
steps:
73+
- uses: actions/checkout@v4
74+
75+
- name: Setup Python
76+
uses: actions/setup-python@master
77+
with:
78+
python-version: '3.13'
79+
80+
- name: Install packages
81+
run: pip install -r requirements_dev.txt
82+
83+
- name: Pydocstyle
84+
run: |
85+
pydocstyle --count simple_oauth2/
86+
87+
mypy:
88+
runs-on: ubuntu-latest
89+
steps:
90+
- uses: actions/checkout@v4
91+
92+
- name: Setup Python
93+
uses: actions/setup-python@master
94+
with:
95+
python-version: '3.13'
96+
97+
- name: Install packages
98+
run: pip install -r requirements_dev.txt
99+
100+
- name: Mypy
101+
run: |
102+
mypy simple_oauth2 --disallow-untyped-def
103+
104+
bandit:
105+
runs-on: ubuntu-latest
106+
steps:
107+
- uses: actions/checkout@v4
108+
109+
- name: Setup Python
110+
uses: actions/setup-python@master
111+
with:
112+
python-version: '3.13'
113+
114+
- name: Install packages
115+
run: pip install -r requirements_dev.txt
116+
117+
- name: Bandit
118+
run: |
119+
bandit --ini=setup.cfg -ll 2> /dev/null
120+
121+
122+
test:
123+
needs: [black, isort, pycodestyle, pydocstyle, bandit]
124+
runs-on: ubuntu-latest
125+
strategy:
126+
matrix:
127+
python-version: [ '3.10', '3.11', '3.12', '3.13']
128+
django-version: [ 42, 51, 52 ]
129+
exclude:
130+
- python-version: 3.13
131+
django-version: 42
132+
133+
steps:
134+
- uses: actions/checkout@v4
135+
136+
- name: Setup Python
137+
uses: actions/setup-python@master
138+
with:
139+
python-version: ${{ matrix.python-version }}
140+
- name: Install Tox and any other packages
141+
run: |
142+
pip install tox
143+
- name: Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }},
144+
run: tox -e py-django${{ matrix.django-version }}
145+
146+
- name: Upload coverage to Codecov
147+
if: matrix.python-version == 3.13 && matrix.django-version == 52
148+
uses: codecov/codecov-action@v5
149+
with:
150+
file: ./coverage.xml
151+
token: ${{ secrets.CODECOV_TOKEN }}
152+
153+
publish:
154+
needs: test
155+
if: github.event_name == 'release' && github.event.action == 'published'
156+
runs-on: ubuntu-latest
157+
continue-on-error: true
158+
environment:
159+
name: pypi
160+
url: https://pypi.org/p/drf-simple-oauth2
161+
permissions:
162+
id-token: write
163+
164+
165+
steps:
166+
- uses: actions/checkout@master
167+
168+
- name: Set up Python 3.13
169+
uses: actions/setup-python@v4
170+
with:
171+
python-version: '3.13'
172+
173+
- name: Creating Built Distributions
174+
run: |
175+
pip install setuptools
176+
python setup.py sdist
177+
178+
- name: Publish distribution to PyPI
179+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# OS generated files
2+
.DS_Store
3+
4+
# IDEs and editors
5+
.vscode/
6+
.idea/
7+
18
# Byte-compiled / optimized / DLL files
29
__pycache__/
310
*.py[codz]
@@ -50,6 +57,7 @@ coverage.xml
5057
.hypothesis/
5158
.pytest_cache/
5259
cover/
60+
junit.xml
5361

5462
# Translations
5563
*.mo
@@ -182,9 +190,9 @@ cython_debug/
182190
.abstra/
183191

184192
# Visual Studio Code
185-
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
193+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186194
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187-
# and can be added to the global gitignore or merged into this file. However, if you prefer,
195+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
188196
# you could uncomment the following to ignore the entire vscode folder
189197
# .vscode/
190198

.gitlab-ci.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
image: docker:latest
2+
3+
services:
4+
- docker:dind
5+
6+
stages:
7+
- checks
8+
- test
9+
- build
10+
- deploy
11+
12+
variables:
13+
BUILD_TOOLS_PATH: /home/gitlab-runner/codoc-tools/docker_build
14+
DOCKERFILE_DIR_PATH: $GITLAB_PROJECT_DIR
15+
16+
################################################################################
17+
################################# TEMPLATES ####################################
18+
################################################################################
19+
20+
.checks: &checks
21+
stage: checks
22+
only:
23+
- merge_requests
24+
before_script:
25+
- python3.11 -m venv venv
26+
- source venv/bin/activate
27+
- python3.11 -m pip install -U pip setuptools wheel
28+
29+
.test: &test
30+
stage: test
31+
only:
32+
- merge_requests
33+
before_script:
34+
- python3.11 -m venv venv
35+
- source venv/bin/activate
36+
- python3.11 -m pip install -U pip setuptools wheel
37+
- python3.11 -m pip install -r requirements_dev.txt
38+
39+
################################################################################
40+
################################### CHECKS #####################################
41+
################################################################################
42+
43+
job:flake8:
44+
<<: *checks
45+
script:
46+
- python3.11 -m pip install flake8 flake8-junit-report
47+
- flake8 . --output-file=flake8.txt
48+
after_script:
49+
- flake8_junit flake8.txt flake8_junit.xml
50+
artifacts:
51+
reports:
52+
junit: flake8_junit.xml
53+
54+
job:isort:
55+
<<: *checks
56+
script:
57+
- python3.11 -m pip install "isort==5.10.1"
58+
- isort --check django_test/ {{ app_name }}/
59+
60+
job:black:
61+
<<: *checks
62+
script:
63+
- python3.11 -m pip install "black==22.3.0"
64+
- black --check --exclude="^.*\b((migrations))\b.*$" -l 120 test_project/ {{ app_name }}/
65+
66+
job:pydocstyle:
67+
<<: *checks
68+
script:
69+
- python3.11 -m pip install pydocstyle
70+
- ./bin/pydocstyle.sh
71+
72+
73+
################################################################################
74+
################################### TESTS ######################################
75+
################################################################################
76+
77+
job:unittest:
78+
<<: *test
79+
script:
80+
- python3.11 -m pytest --create-db -vvv -s --color=yes --durations=0 --durations-min=1.0 --cov=. --cov-report term
81+
artifacts:
82+
reports:
83+
junit: junit.xml
84+
coverage: '/TOTAL.*\s+(\d+%)$/'
85+
resource_group: {{ app_name }}_unittest

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Changelog
2+
=========
3+
4+
## 0.1.0 {% now "SHORT_DATE_FORMAT" %}

0 commit comments

Comments
 (0)