Skip to content

CI

CI #1129

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- master
release:
types:
- created
schedule:
- cron: '0 2 * * *'
jobs:
lint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: 3.8 # check pylint with minimal supported python version
- name: Install flake8
run: |
python -m pip install flake8 -U
- name: Lint with flake8
run: |
flake8 mapentity test_project test_app
test:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [ '3.8', '3.10' ]
django-version: [ '3.2.*', '4.1.*' ]
steps:
- uses: actions/checkout@v3
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get -y install gettext libproj-dev binutils gdal-bin libgdal-dev libsqlite3-mod-spatialite libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info libpangoft2-1.0-0 libjpeg-dev libopenjp2-7-dev libsasl2-dev python-dev libldap2-dev libssl-dev
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install .[dev]
pip install Django==${{ matrix.django-version }} -U
if [[ ${{ matrix.django-version }} == 2.2.* ]]; then
# django-modeltranslation 0.18.3 breaks with django < 3.2
pip install django-modeltranslation==0.18.2 -U
fi
- name: Check pending migrations
run: |
./manage.py makemigrations --check
- name: Test with coverage
run: |
coverage run ./manage.py test -v3
coverage report -m
- name: Coverage upload
run: |
pip install codecov
codecov
publish:
needs: [lint, test]
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install setuptools wheel twine -U
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist
twine upload dist/*