Added required package files #16
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
name: CI | |
on: | |
push: | |
branches: | |
- main # Change this to the default branch of your repository | |
pull_request: | |
branches: | |
- main # Change this to the default branch of your repository | |
release: | |
types: [published] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Pipenv | |
run: | | |
python -m pip install --upgrade pip | |
pip install pipenv ruff | |
- name: Install dependencies with Pipenv | |
run: | | |
pipenv install --dev | |
- name: Analysing the code with pylint | |
run: | | |
pipenv run pylint django_country_kit dev project | |
- name: Check code style with flake8 | |
run: | | |
pipenv run flake8 . | |
- name: Check import order with isort | |
run: | | |
pipenv run isort --check-only --diff . | |
- name: Linting with Ruff | |
run: | | |
ruff . | |
build_django_50: | |
runs-on: ubuntu-latest | |
needs: lint | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
django-version: ["5.0"] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies and setuptools | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install setuptools | |
- name: Install specific Django version | |
run: pip install Django==${{ matrix.django-version }} | |
- name: Run tests | |
run: | | |
python manage.py test | |
- name: Build distribution package | |
run: python setup.py sdist | |
- name: Archive distribution package | |
uses: actions/upload-artifact@v2 | |
with: | |
name: dist | |
path: dist/*.tar.gz | |
build_django_42: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9"] | |
django-version: ["4.2"] | |
needs: build_django_50 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
- name: Install specific Django version | |
run: pip install Django==${{ matrix.django-version }} | |
- name: Run tests | |
run: | | |
python manage.py test | |
- name: Build distribution package | |
run: python setup.py sdist | |
- name: Archive distribution package | |
uses: actions/upload-artifact@v2 | |
with: | |
name: dist | |
path: dist/*.tar.gz | |
build_django_32: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.7", "3.8", "3.9"] | |
django-version: ["3.2"] | |
needs: build_django_42 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
- name: Install specific Django version | |
run: pip install Django==${{ matrix.django-version }} | |
- name: Run tests | |
run: | | |
python manage.py test | |
- name: Build distribution package | |
run: python setup.py sdist | |
- name: Archive distribution package | |
uses: actions/upload-artifact@v2 | |
with: | |
name: dist | |
path: dist/*.tar.gz | |
deploy: | |
needs: build_django_32 | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
environment: release | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: Install Pipenv | |
run: python -m pip install --upgrade pipenv | |
- name: Install dependencies with Pipenv | |
run: | | |
pipenv install --dev | |
- name: Build package | |
run: pipenv run python -m build | |
- name: Publish package | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
packages_dir: dist/ |