Upgrade example docker image python version to 3.12 #213
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: Run tests, lint and publish | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
wagtail-version: | |
- 4.1 | |
- 5.1 | |
- 5.2 | |
services: | |
postgres: | |
image: postgis/postgis:12-2.5 | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
POSTGRES_DB: postgres | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
set -xe | |
sudo apt-get update | |
sudo apt-get install gdal-bin libgdal-dev | |
python -m pip install --upgrade pip | |
pip install .[test] | |
pip install psycopg2-binary>=2.9.3 | |
- name: Install wagtail ${{ matrix.wagtail-version }} | |
run: pip install wagtail==${{ matrix.wagtail-version }} | |
- name: Run tests | |
run: | | |
pytest | |
env: | |
DATABASE_NAME: postgres | |
DATABASE_USER: postgres | |
DATABASE_PASSWORD: postgres | |
DATABASE_HOST: localhost | |
DATABASE_PORT: 5432 | |
GOOGLE_MAPS_V3_APIKEY: X | |
lint-black: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: psf/black@stable | |
with: | |
options: "--check --verbose" | |
src: "." | |
version: "22.3.0" | |
lint-isort: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install isort | |
isort . --check-only | |
publish: | |
runs-on: ubuntu-latest | |
needs: [test, lint-black, lint-isort] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build twine | |
- name: Build | |
run: | | |
python -m build | |
- name: Release to Test PyPi | |
if: startsWith(github.ref, 'refs/tags/testv') | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }} | |
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/ | |
run: | | |
twine upload -r testpypi dist/* | |
- name: Release to PyPi | |
if: startsWith(github.ref, 'refs/tags/v') | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
twine upload dist/* |