-
Notifications
You must be signed in to change notification settings - Fork 27
59 lines (57 loc) · 1.85 KB
/
test.yml
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
name: Test
on: [push]
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
image:
- 'python:2.7-buster'
- 'python:3.6-bullseye'
- 'python:3.7-bookworm'
- 'python:3.8-bookworm'
- 'python:3.9-bookworm'
- 'python:3.10-bookworm'
- 'python:3.11-bookworm'
- 'python:3.12-bookworm'
container:
image: ${{ matrix.image }}
steps:
- uses: actions/checkout@v4
- name: Set environment variables
run: |
echo "PYTHON=$(echo '${{ matrix.image }}' | sed -r 's/^python:([0-9]+)\.([0-9]+).*$/\1.\2/g')" >> $GITHUB_ENV
echo "TOXFACTOR=$(echo '${{ matrix.image }}' | sed -r 's/^python:([0-9]+)\.([0-9]+).*$/py\1\2/g')" >> $GITHUB_ENV
- name: Install psycopg2 requirements
run: |
apt update
apt-get -y install python-dev
if: matrix.image == 'python:2.7-buster'
- name: Install psycopg2 requirements
run: |
apt update
apt-get -y install python3-dev
if: matrix.image != 'python:2.7-buster'
- name: Install importlib-metadata for older Python versions
run: pip install "importlib-metadata<3"
if: >-
matrix.image == 'python:2.7-buster' ||
matrix.image == 'python:3.6-bullseye' ||
matrix.image == 'python:3.7-bookworm'
- name: Install test utilities
run: pip install "tox<4" tox-factor "coverage<5"
- name: Lint with flake8
run: tox -e flake8
if: matrix.image == 'python:3.12-bookworm'
- name: Test via tox
run: tox -- -p no:warnings
- name: Generate coverage report
run: coverage xml
if: ${{ success() }}
- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
files: coverage.xml
flags: unittests
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ success() }}