Skip to content

Commit

Permalink
[deps/ci] QA reformat, updated CI, updated deps
Browse files Browse the repository at this point in the history
- Formatted code with black
- Updated CI configuration (consistent with other OpenWISP repos)
- PostgreSQL 15 for testing
- Upgraded psycopg2~=2.9.0
- Dropped support for EOL Python and Django versions
  - Dropped support for Python 3.6 and 3.7
  - Dropped support for Django 2.2, 3.0, 3.1 and 4.0
  - Dropped support for djangorestframework < 3.12
- Pinned djangorestframework>=3.12,<3.15 and django-filters~=23.5
- Added Django 5.0, Django 5.1 & DRF 3.15.X to tox conf
- Added GitHub workflow for publishing PyPI packages

---------

Signed-off-by: Gagan Deep <pandafy.dev@gmail.com>
  • Loading branch information
pandafy authored Aug 16, 2024
1 parent 110abaa commit 2f6df04
Show file tree
Hide file tree
Showing 20 changed files with 302 additions and 192 deletions.
3 changes: 0 additions & 3 deletions .coveragerc

This file was deleted.

6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ updates:
interval: "monthly"
commit-message:
prefix: "[deps] "
- package-ecosystem: "github-actions" # Check for GitHub Actions updates
directory: "/"
schedule:
interval: "monthly" # Check for updates weekly
commit-message:
prefix: "[ci] "
128 changes: 60 additions & 68 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

services:
postgres:
image: postgis/postgis:10-2.5
image: postgis/postgis:15-3.4-alpine
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
Expand All @@ -29,97 +29,89 @@ jobs:
fail-fast: false
matrix:
env:
- python: 3.6
TOXENV: py36-django22-djangorestframework310
- python: 3.7
TOXENV: py37-django22-djangorestframework310
- python: 3.8
TOXENV: py38-django22-djangorestframework310
- python: 3.9
TOXENV: py39-django22-djangorestframework310
- python: 3.6
TOXENV: py36-django22-djangorestframework312
- python: 3.7
TOXENV: py37-django22-djangorestframework312
- python: 3.8
TOXENV: py38-django22-djangorestframework312
- python: 3.9
TOXENV: py39-django22-djangorestframework312
- python: 3.6
TOXENV: py36-django30-djangorestframework312
- python: 3.7
TOXENV: py37-django30-djangorestframework312
- python: 3.8
TOXENV: py38-django30-djangorestframework312
- python: 3.9
TOXENV: py39-django30-djangorestframework312
- python: 3.6
TOXENV: py36-django31-djangorestframework312
- python: 3.7
TOXENV: py37-django31-djangorestframework312
- python: 3.8
TOXENV: py38-django31-djangorestframework312
- python: 3.9
TOXENV: py39-django31-djangorestframework312
- python: 3.7
TOXENV: py37-django32-djangorestframework312
- python: 3.8
- python: '3.8'
TOXENV: py38-django32-djangorestframework312
- python: 3.9
- python: '3.8'
TOXENV: py38-django32-djangorestframework313
- python: '3.8'
TOXENV: py38-django32-djangorestframework314
- python: '3.8'
TOXENV: py38-django42-djangorestframework314
- python: '3.9'
TOXENV: py39-django32-djangorestframework312
- python: 3.8
TOXENV: py38-django40-djangorestframework313
- python: 3.9
TOXENV: py39-django40-djangorestframework313
- python: '3.9'
TOXENV: py39-django32-djangorestframework313
- python: '3.9'
TOXENV: py39-django32-djangorestframework314
- python: '3.9'
TOXENV: py39-django42-djangorestframework314
- python: '3.10'
TOXENV: py310-django32-djangorestframework312
- python: '3.10'
TOXENV: py310-django32-djangorestframework313
- python: '3.10'
TOXENV: py310-django32-djangorestframework314
- python: '3.10'
TOXENV: py310-django42-djangorestframework314
- python: '3.11'
TOXENV: py311-django42-djangorestframework314
- python: '3.11'
TOXENV: py311-django50-djangorestframework315
- python: '3.12'
TOXENV: py312-django50-djangorestframework315
- python: '3.11'
TOXENV: py311-django51-djangorestframework315
- python: '3.12'
TOXENV: py312-django51-djangorestframework315
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Python ${{ matrix.env.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.env.python }}
cache: 'pip'
cache-dependency-path: |
**/requirements*.txt
- name: Install system packages
run: |
sudo apt-get update
sudo apt-get install binutils libproj-dev gdal-bin -y
- name: Install python dependencies
- name: Install Dependencies
id: deps
run: |
sudo apt -qq update
sudo apt -qq -y install binutils libproj-dev gdal-bin
pip install -U pip wheel setuptools
pip install -U -r requirements-test.txt
pip install tox docutils pygments twine
- name: QA checks
run: |
./run-qa-checks
- name: Tests
if: ${{ !cancelled() && steps.deps.conclusion == 'success' }}
run: |
tox -e ${{ matrix.env.TOXENV }}
coverage combine
coverage xml
env:
POSTGRES_HOST: localhost

- name: Upload Coverage
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: |
python-${{ matrix.env.env }}
COVERALLS_PARALLEL: true

- name: QA checks
run: |
pip install "importlib-metadata<5.0" # remove when flake8 is upgraded
./run-qa-checks
if: ${{ success() }}
uses: coverallsapp/github-action@v2
with:
parallel: true
format: cobertura
flag-name: python-${{ matrix.env.env }}
github-token: ${{ secrets.GITHUB_TOKEN }}

coveralls:
name: Finish Coveralls
needs: build
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
32 changes: 32 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish Python Package to Pypi.org

on:
release:
types: [published]

permissions:
id-token: write

jobs:
pypi-publish:
name: Release Python Package on Pypi.org
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/djangorestframework-gis
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install -U pip
pip install build
- name: Build package
run: python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@v1.9.0
Loading

0 comments on commit 2f6df04

Please sign in to comment.