-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
7 changed files
with
303 additions
and
107 deletions.
There are no files selected for viewing
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,70 @@ | ||
name: deploy_to_pypi | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
build-n-publish: | ||
name: Build and publish Python distributions to PyPI and TestPyPI | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@release | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Build source and wheel distributions | ||
run: | | ||
python -m pip install --upgrade build twine | ||
python -m build | ||
twine check --strict dist/* | ||
- name: Publish distribution to Test PyPI | ||
uses: pypa/gh-action-pypi-publish@release | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
skip_existing: true | ||
|
||
- name: Publish distribution to PyPI | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | ||
uses: pypa/gh-action-pypi-publish@release | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
skip_existing: true | ||
|
||
- name: Create GitHub Release | ||
id: create_release | ||
uses: actions/create-release@v3 | ||
env: | ||
GITHUB-TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Get Asset name | ||
run: | | ||
export PKG=$(ls dist/ | grep tar) | ||
set -- $PKG | ||
echo "name=$1" >> $GITHUB_ENV | ||
- name: Upload Release Asset (sdist) to GitHub | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v3 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: dist/${{ env.name }} | ||
asset_name: ${{ env.name }} | ||
asset_content_type: application/zip |
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 |
---|---|---|
@@ -1,37 +1,73 @@ | ||
name: test | ||
|
||
on: [push, pull_request] | ||
on: | ||
push: | ||
branches: | ||
- "main" | ||
- "release" | ||
pull_request: | ||
branches: | ||
- "*" | ||
|
||
env: | ||
GITHUB-TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
jobs: | ||
black-lint: | ||
name: Lint with Black | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: psf/black@fcf97961061982656a1384ecc1628e217a52a88c | ||
|
||
test: | ||
name: Test django-advanced-password-validation | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
versions: | ||
- { "djangoVersion": "2.2.28", "pythonVersion": "3.7" } | ||
- { "djangoVersion": "2.2.28", "pythonVersion": "3.8" } | ||
- { "djangoVersion": "2.2.28", "pythonVersion": "3.9" } | ||
- { "djangoVersion": "2.2.28", "pythonVersion": "3.10" } | ||
- { "djangoVersion": "3.2.16", "pythonVersion": "3.7" } | ||
- { "djangoVersion": "3.2.16", "pythonVersion": "3.8" } | ||
- { "djangoVersion": "3.2.16", "pythonVersion": "3.9" } | ||
- { "djangoVersion": "3.2.16", "pythonVersion": "3.10" } | ||
- { "djangoVersion": "4.0.8", "pythonVersion": "3.8" } | ||
- { "djangoVersion": "4.0.8", "pythonVersion": "3.9" } | ||
- { "djangoVersion": "4.0.8", "pythonVersion": "3.10" } | ||
- { "djangoVersion": "4.1.2", "pythonVersion": "3.8" } | ||
- { "djangoVersion": "4.1.2", "pythonVersion": "3.9" } | ||
- { "djangoVersion": "4.1.2", "pythonVersion": "3.10" } | ||
steps: | ||
- name: Checkout 🛎️ | ||
# Checkout the source | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Python 🐍 | ||
# Setup Python | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.versions.pythonVersion }} | ||
- name: Install dependencies 📦 | ||
# Install Dependencies | ||
- name: Install dependencies | ||
run: python -m pip install -r requirements_test.txt && python -m pip install -e . | ||
- name: Install Django ${{ matrix.versions.djangoVersion }} 📦 | ||
# Install Django | ||
- name: Install Django ${{ matrix.versions.djangoVersion }} | ||
run: python -m pip install Django==${{ matrix.versions.djangoVersion }} | ||
- name: Check types, syntax and duckstrings 🦆 | ||
# Check syntax | ||
- name: Check types, syntax and duckstrings | ||
run: | | ||
mypy --exclude=setup.py . | ||
flake8 . | ||
interrogate --quiet --fail-under=90 . | ||
- name: Test Django ${{ matrix.versions.djangoVersion }} with coverage 🧪 | ||
# Test package | ||
- name: Test Django ${{ matrix.versions.djangoVersion }} with coverage | ||
run: coverage run --source=django_advanced_password_validation -m pytest . && coverage lcov -o coverage.lcov | ||
- name: Submit coverage report to Coveralls 📈 | ||
# Generate Coverage Report | ||
- name: Submit coverage report to Coveralls | ||
if: ${{ success() }} | ||
uses: coverallsapp/github-action@1.1.3 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
path-to-lcov: ./coverage.lcov | ||
|
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
Oops, something went wrong.