Skip to content

Commit dc43262

Browse files
samamorganjheld
authored andcommitted
Modernize Package
1 parent c2aa54c commit dc43262

Some content is hidden

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

66 files changed

+2866
-1473
lines changed

.github/workflows/build.yml

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

.github/workflows/cd.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Publish Python 🐍 package 📦 to PyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
jobs:
10+
get-package-version:
11+
name: Get ${{ github.ref_name }} package version
12+
runs-on: ubuntu-latest
13+
outputs:
14+
package-version: ${{ steps.package-version.outputs.package-version }}
15+
version-compairson: ${{ steps.semver.outputs.comparison-result}}
16+
steps:
17+
- name: Checkout ${{ github.repository }}
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Python
21+
uses: actions/setup-python@v5
22+
23+
- name: Install Poetry
24+
uses: snok/install-poetry@v1
25+
with:
26+
virtualenvs-create: true
27+
virtualenvs-in-project: true
28+
installer-parallel: true
29+
30+
- name: Get package version
31+
id: package-version
32+
run: echo "package-version=v$(poetry version --short)" >> $GITHUB_OUTPUT
33+
34+
- name: Get release version
35+
id: release-version
36+
uses: pozetroninc/github-action-get-latest-release@master
37+
with:
38+
repository: ${{ github.repository }}
39+
40+
- name: Analyze semver
41+
id: semver
42+
uses: madhead/semver-utils@latest
43+
with:
44+
lenient: false
45+
version: ${{ steps.package-version.outputs.package-version }}
46+
compare-to: ${{ steps.release-version.outputs.release }}
47+
48+
- name: Check pre-release
49+
if: ${{ steps.semver.outputs.prerelease != '' }}
50+
run: |
51+
echo "Checking if version is a pre-release"
52+
echo "::error::Skipping pre-release version: ${{ steps.package-version.outputs.package-version}}"
53+
exit 1
54+
55+
deploy:
56+
name: Deploy Python 🐍 distributions 📦 to PyPI
57+
needs: [get-package-version]
58+
runs-on: ubuntu-latest
59+
if: ${{ needs.get-package-version.outputs.version-compairson != '=' }}
60+
61+
steps:
62+
- name: Checkout ${{ github.repository }}
63+
uses: actions/checkout@v3
64+
65+
- name: Build and publish to PyPI
66+
uses: JRubics/[email protected]
67+
with:
68+
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
69+
70+
- name: Create release ${{ needs.get-package-version.outputs.package-version }}
71+
uses: ncipollo/release-action@v1
72+
with:
73+
commit: ${{ github.ref_name }}
74+
tag: ${{ needs.get-package-version.outputs.package-version }}
75+
generateReleaseNotes: true
76+
artifacts: |
77+
dist/*.whl
78+
dist/*.tar.gz

.github/workflows/ci.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: CI
2+
3+
on: [pull_request, workflow_dispatch]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
get-python-versions:
11+
name: Get Python versions
12+
runs-on: ubuntu-latest
13+
outputs:
14+
python-matrix: ${{ steps.get-python-versions-action.outputs.latest-python-versions }}
15+
steps:
16+
- name: Get Python version matrix
17+
uses: snok/latest-python-versions@v1
18+
id: get-python-versions-action
19+
with:
20+
min-version: 3.8
21+
22+
ci:
23+
name: CI
24+
needs: [get-python-versions]
25+
runs-on: ubuntu-latest
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
python-version: ${{ fromJson(needs.get-python-versions.outputs.python-matrix) }}
30+
31+
steps:
32+
- name: Checkout ${{ github.repository }}
33+
uses: actions/checkout@v4
34+
35+
- name: Setup Python ${{ matrix.python-version }}
36+
id: setup-python
37+
uses: actions/setup-python@v5
38+
with:
39+
python-version: ${{ matrix.python-version }}
40+
41+
- name: Install Poetry
42+
uses: snok/install-poetry@v1
43+
with:
44+
virtualenvs-create: true
45+
virtualenvs-in-project: true
46+
installer-parallel: true
47+
48+
- name: Load cached environment
49+
uses: actions/cache@v3
50+
with:
51+
path: .venv
52+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
53+
54+
- name: Install dependencies
55+
id: poetry-install
56+
run: |
57+
poetry install --no-interaction --no-root
58+
echo "django_version=$(poetry run django-admin --version)" >> $GITHUB_OUTPUT
59+
60+
- name: Run pre-commit
61+
run: poetry run pre-commit run --all-files
62+
63+
- name: Run Tests (Django ${{ steps.poetry-install.outputs.django_version }})
64+
run: |
65+
poetry run pytest \
66+
--junitxml=pytest.xml \
67+
--cov-report=term-missing:skip-covered \
68+
--cov=easyaudit | tee pytest-coverage.txt
69+
70+
- name: Add coverage comment
71+
uses: MishaKav/pytest-coverage-comment@main
72+
continue-on-error: true
73+
with:
74+
pytest-coverage-path: ./pytest-coverage.txt
75+
junitxml-path: ./pytest.xml
76+
report-only-changed-files: true
77+
title: Coverage Report
78+
unique-id-for-comment: ${{ matrix.python-version }}
79+
remove-link-from-badge: true

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ celerybeat-schedule
7878
.env
7979

8080
# virtualenv
81+
.venv/
8182
venv/
8283
ENV/
8384

@@ -87,3 +88,6 @@ ENV/
8788
# Rope project settings
8889
.ropeproject
8990
.idea
91+
92+
# DB
93+
db.sqlite3

.pre-commit-config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.1.11
4+
hooks:
5+
- id: ruff
6+
- id: ruff-format
7+
8+
- repo: https://github.com/djlint/djLint
9+
rev: v1.34.1
10+
hooks:
11+
- id: djlint-reformat-django
12+
- id: djlint-django

.travis.yml

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

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"python.testing.unittestEnabled": false,
3+
"python.testing.pytestEnabled": true
4+
}

0 commit comments

Comments
 (0)