Prevent multiple submissions of create/update form #1846
Workflow file for this run
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: | |
pull_request: | |
push: | |
branches: | |
- master | |
release: | |
types: | |
- created | |
schedule: | |
- cron: '0 2 * * *' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
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 # wait for spatialite fix | |
strategy: | |
matrix: | |
python-version: [ '3.8', '3.10', '3.12' ] | |
django-version: [ '4.2.*', '5.0.*' ] | |
exclude: | |
- python-version: '3.8' | |
django-version: '5.0.*' | |
env: | |
PYTHON: ${{ matrix.python-version }} | |
DJANGO: ${{ matrix.django-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install system dependencies | |
run: | | |
sudo apt-get -qq 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 python3-dev libldap2-dev libssl-dev | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
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 | |
- name: Compile messages | |
run: | | |
./manage.py compilemessages | |
- name: Check pending migrations | |
run: | | |
./manage.py makemigrations --check | |
- name: Test with coverage | |
run: | | |
coverage run --parallel-mode --concurrency=multiprocessing ./manage.py test --parallel -v 3 | |
coverage combine | |
coverage xml -o coverage.xml | |
- uses: codecov/codecov-action@v4 | |
with: | |
files: ./coverage.xml | |
env_vars: PYTHON,DJANGO | |
token: ${{ secrets.CODECOV_TOKEN }} # not usually required for public repos | |
fail_ci_if_error: true # optional (default = false) | |
publish: | |
needs: [lint, test] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
if: ${{ github.event_name == 'release' && github.event.action == 'created' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Compile messages | |
run: | | |
pip install django | |
sudo apt-get -qq update | |
sudo apt-get -y install gettext | |
django-admin compilemessages | |
- name: Build package | |
run: | | |
python setup.py sdist | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |