Merge pull request #46 from uktrade/ci/tidy-pypi-publish #163
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: Tests | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
# If changing how many times tests are run, must also change in codecov.yml | |
# to ensure test coverage is reported only after all tests have finished | |
python-version: | |
- "3.7.1" | |
- "3.8.0" | |
- "3.9.0" | |
- "3.10.0" | |
- "3.11.0" | |
postgresql-version: | |
- "postgres:9.6" | |
- "postgres:10.0" | |
- "postgres:11.0" | |
- "postgres:12.0" | |
- "postgres:13.0" | |
- "postgres:14.0" | |
- "postgres:15.0" | |
- "postgres:16beta2" | |
# sqlalchemy 1.4 doesn't support psycopg3 | |
ci-extras: | |
- ci-psycopg2-sqlalchemy1 | |
- ci-psycopg2-sqlalchemy2 | |
- ci-psycopg3-sqlalchemy2 | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v3" | |
- uses: "actions/setup-python@v4" | |
with: | |
python-version: '${{ matrix.python-version }}' | |
- name: "Run PostgreSQL" | |
run: | | |
./start-services.sh ${{ matrix.postgresql-version }} | |
- name: "Install package and python dependencies" | |
run: | | |
pip install .[ci,${{ matrix.ci-extras }}] | |
- name: "Wait for PostgreSQL" | |
run: "timeout 60 bash -c 'until echo > /dev/tcp/127.0.0.1/5432; do sleep 5; done'" | |
- name: "Test" | |
run: | | |
pytest --cov | |
- uses: codecov/codecov-action@v3 |