-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c2aa54c
commit dc43262
Showing
66 changed files
with
2,866 additions
and
1,473 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Publish Python 🐍 package 📦 to PyPI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
jobs: | ||
get-package-version: | ||
name: Get ${{ github.ref_name }} package version | ||
runs-on: ubuntu-latest | ||
outputs: | ||
package-version: ${{ steps.package-version.outputs.package-version }} | ||
version-compairson: ${{ steps.semver.outputs.comparison-result}} | ||
steps: | ||
- name: Checkout ${{ github.repository }} | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
|
||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
installer-parallel: true | ||
|
||
- name: Get package version | ||
id: package-version | ||
run: echo "package-version=v$(poetry version --short)" >> $GITHUB_OUTPUT | ||
|
||
- name: Get release version | ||
id: release-version | ||
uses: pozetroninc/github-action-get-latest-release@master | ||
with: | ||
repository: ${{ github.repository }} | ||
|
||
- name: Analyze semver | ||
id: semver | ||
uses: madhead/semver-utils@latest | ||
with: | ||
lenient: false | ||
version: ${{ steps.package-version.outputs.package-version }} | ||
compare-to: ${{ steps.release-version.outputs.release }} | ||
|
||
- name: Check pre-release | ||
if: ${{ steps.semver.outputs.prerelease != '' }} | ||
run: | | ||
echo "Checking if version is a pre-release" | ||
echo "::error::Skipping pre-release version: ${{ steps.package-version.outputs.package-version}}" | ||
exit 1 | ||
deploy: | ||
name: Deploy Python 🐍 distributions 📦 to PyPI | ||
needs: [get-package-version] | ||
runs-on: ubuntu-latest | ||
if: ${{ needs.get-package-version.outputs.version-compairson != '=' }} | ||
|
||
steps: | ||
- name: Checkout ${{ github.repository }} | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build and publish to PyPI | ||
uses: JRubics/[email protected] | ||
with: | ||
pypi_token: ${{ secrets.PYPI_API_TOKEN }} | ||
|
||
- name: Create release ${{ needs.get-package-version.outputs.package-version }} | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
commit: ${{ github.ref_name }} | ||
tag: ${{ needs.get-package-version.outputs.package-version }} | ||
generateReleaseNotes: true | ||
artifacts: | | ||
dist/*.whl | ||
dist/*.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: CI | ||
|
||
on: [pull_request, workflow_dispatch] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
get-python-versions: | ||
name: Get Python versions | ||
runs-on: ubuntu-latest | ||
outputs: | ||
python-matrix: ${{ steps.get-python-versions-action.outputs.latest-python-versions }} | ||
steps: | ||
- name: Get Python version matrix | ||
uses: snok/latest-python-versions@v1 | ||
id: get-python-versions-action | ||
with: | ||
min-version: 3.8 | ||
|
||
ci: | ||
name: CI | ||
needs: [get-python-versions] | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ${{ fromJson(needs.get-python-versions.outputs.python-matrix) }} | ||
|
||
steps: | ||
- name: Checkout ${{ github.repository }} | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python ${{ matrix.python-version }} | ||
id: setup-python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
installer-parallel: true | ||
|
||
- name: Load cached environment | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Install dependencies | ||
id: poetry-install | ||
run: | | ||
poetry install --no-interaction --no-root | ||
echo "django_version=$(poetry run django-admin --version)" >> $GITHUB_OUTPUT | ||
- name: Run pre-commit | ||
run: poetry run pre-commit run --all-files | ||
|
||
- name: Run Tests (Django ${{ steps.poetry-install.outputs.django_version }}) | ||
run: | | ||
poetry run pytest \ | ||
--junitxml=pytest.xml \ | ||
--cov-report=term-missing:skip-covered \ | ||
--cov=easyaudit | tee pytest-coverage.txt | ||
- name: Add coverage comment | ||
uses: MishaKav/pytest-coverage-comment@main | ||
continue-on-error: true | ||
with: | ||
pytest-coverage-path: ./pytest-coverage.txt | ||
junitxml-path: ./pytest.xml | ||
report-only-changed-files: true | ||
title: Coverage Report | ||
unique-id-for-comment: ${{ matrix.python-version }} | ||
remove-link-from-badge: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.1.11 | ||
hooks: | ||
- id: ruff | ||
- id: ruff-format | ||
|
||
- repo: https://github.com/djlint/djLint | ||
rev: v1.34.1 | ||
hooks: | ||
- id: djlint-reformat-django | ||
- id: djlint-django |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true | ||
} |
Oops, something went wrong.