-
Notifications
You must be signed in to change notification settings - Fork 21
125 lines (102 loc) · 3.16 KB
/
python-ci.yml
File metadata and controls
125 lines (102 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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:
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Install ruff
run: |
python -m pip install ruff -U
- name: Check linting
run: |
ruff check mapentity test_project
- name: Check format
run: |
ruff format --check mapentity test_project
test:
runs-on: ubuntu-latest
container:
image: python:${{ matrix.python-version }}-bookworm
env:
LANG: C.UTF-8
strategy:
matrix:
python-version: [ '3.9', '3.10', '3.13' ]
django-version: [ '4.2.*', '5.2.*' ]
exclude:
- python-version: '3.9'
django-version: '5.2.*'
env:
PYTHON: ${{ matrix.python-version }}
DJANGO: ${{ matrix.django-version }}
steps:
- uses: actions/checkout@v6
- name: Install system dependencies
run: |
apt-get -qq update
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: Install python dependencies
run: |
python3 -m pip install --upgrade pip setuptools wheel
pip3 install .[dev]
pip3 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@v5
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: [quality, test]
runs-on: ubuntu-latest
permissions:
id-token: write
environment:
name: pypi
url: https://pypi.org/p/mapentity/
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
- 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