Skip to content

Bump black from 22.1.0 to 24.3.0 #1452

Bump black from 22.1.0 to 24.3.0

Bump black from 22.1.0 to 24.3.0 #1452

Workflow file for this run

name: Test Pepys
on:
push:
branches:
- master
pull_request:
jobs:
test-linux:
name: Linux
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install apt dependencies
shell: bash -l {0}
run: |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
sudo apt update
# workaround for pg14 being present in GitHub base image of Ubuntu
sudo apt remove postgresql-14 postgresql-client
sudo apt install -y postgresql-13-postgis-3 sqlite3 libgdal-dev libproj-dev libproj-dev libsqlite3-dev spatialite-bin libsqlite3-mod-spatialite
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install pip dependencies
shell: bash -l {0}
run: |
pip install -r requirements.txt
pip install -r requirements_dev.txt
- name: Install pytest GH Actions plugin
shell: bash -l {0}
run: pip install pytest-github-actions-annotate-failures
- name: Run tests (non GUI)
shell: bash -l {0}
env:
PEPYS_SPATIALITE_PATH: /usr/lib/x86_64-linux-gnu/mod_spatialite.so
SQLALCHEMY_WARN_20: 1
run: |
coverage3 run -m pytest -v --color=yes --ignore=tests/gui_tests tests/ -Werror
- name: Run tests (GUI)
shell: bash -l {0}
env:
PEPYS_SPATIALITE_PATH: /usr/lib/x86_64-linux-gnu/mod_spatialite.so
SQLALCHEMY_WARN_20: 1
run: |
coverage3 run -a -m pytest -v --color=yes -s tests/gui_tests -Werror
- name: Run black
shell: bash -l {0}
run: |
black --check --diff importers pepys_import pepys_admin pepys_timeline tests
- name: Run isort
shell: bash -l {0}
run: |
isort --check-only --diff importers pepys_import pepys_admin pepys_timeline tests
- name: Get coverage report
shell: bash -l {0}
run: |
coverage3 report
coverage3 xml
- uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
test-windows:
name: Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
# - name: Install Postgres 12
# uses: crazy-max/ghaction-chocolatey@v1
# with:
# args: install postgresql12
# - name: Stop Postgres service
# shell: powershell
# run: |
# Stop-Service postgresql-x64-12
- name: Run setup Powershell script
shell: cmd
run: powershell.exe -executionpolicy remotesigned -File .\.github\workflows\setup_windows.ps1
- name: Set up environment variables
shell: bash -l {0}
run: |
echo "C:\Program Files\PostgreSQL\12\bin" >> $GITHUB_PATH
echo ".\lib\spatialite-loadable-modules-5.0.0-win-amd64" >> $GITHUB_PATH
echo "PYTHONPATH=.\lib\sqlite-python" >> $GITHUB_ENV
- name: Install pip dependencies
shell: cmd
run: |
pip install -r requirements.txt
pip install -r requirements_dev.txt
- name: Install pytest GH Actions plugin
shell: bash -l {0}
run: pip install pytest-github-actions-annotate-failures
# This actions runs all tests under a different user so that Postgres doesn't complain
# It has various issues - it seems to cause other tests to fail, seems to be slow to produce output on the online GH Actions
# console, and seems to run into MemoryErrors. At the moment it isn't worth debugging these as running the Postgres tests
# on Windows isn't that important to us.
#
# To try this again:
# 1. Uncomment this section below, plus the two sections above which install and setup Postgres
# 2. Uncomment the commented section in setup_windows.ps1 which installs PostGIS
#
# - name: Run tests (with Postgres)
# shell: cmd
# run: powershell.exe -executionpolicy remotesigned -File .\.github\workflows\windows_run_tests.ps1
- name: Run tests (no Postgres)
shell: cmd
run: python.exe -m pytest -v --color=yes tests -m "not postgres" -Werror
env:
SQLALCHEMY_WARN_20: 1