-
Notifications
You must be signed in to change notification settings - Fork 10
107 lines (97 loc) · 3.61 KB
/
tests.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
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
on:
push:
branches:
- main
tags:
- '**'
pull_request:
jobs:
tests:
runs-on: ubuntu-22.04
# We don't fail on dev versions, as those are snapshots
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
postgresql_version: [11, 12, 13, 14, ]
experimental: [false]
repo: ["pgdg"]
pytest_args: ["-m 'not slow'"]
include:
# Define the current dev version to be experimental
- postgresql_version: 16
experimental: true
repo: "pgdg-snapshot"
pytest_args: "-m 'not slow'"
# For latest stable version, include "slow" tests
- postgresql_version: 15
experimental: false
repo: "pgdg"
pytest_args: ""
env:
PGVERSION: ${{ matrix.postgresql_version }}
DISTRO: ubuntu
steps:
- id: checkout
uses: actions/checkout@v2
with:
# Do not persist the token during execution of this job.
persist-credentials: false
- id: dependencies
run: |
# Must be installed via the system
sudo apt update
sudo apt install curl ca-certificates gnupg
sudo apt install python3-bpfcc python3-pip libunwind-dev linux-headers-$(uname -r)
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-${{ matrix.repo }} main ${{ matrix.postgresql_version }}" > /etc/apt/sources.list.d/pgdg.list'
sudo apt update
# Install postgresql-common so that update alternatives doesn't fail
sudo apt install postgresql-common postgresql-client-common
sudo apt install postgresql-${{matrix.postgresql_version}} postgresql-${{matrix.postgresql_version}}-dbgsym
sudo pip install -U pip toml
# Install requirements from pyproject.toml
sudo pip install -e '.[test]'
- id: tests
run: |
sudo pytest --postgresql-exec /usr/lib/postgresql/${{matrix.postgresql_version}}/bin/pg_ctl --cov src/ --cov-report=xml ${{matrix.pytest_args}}
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
env_vars: PGVERSION
fail_ci_if_error: true
files: ./coverage.xml
verbose: true
name: codecov-umbrella
tests_fedora_container:
runs-on: ubuntu-22.04
env:
PGVERSION: 13
DISTRO: fedora
steps:
- id: checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- id: dependencies
run: |
sudo apt update
sudo apt install dnf systemd-container
sudo apt install postgresql-client
sudo ./tests/scripts/setup_fedora_container.sh
sudo apt install curl ca-certificates gnupg
sudo apt install python3-bpfcc python3-pip libunwind-dev linux-headers-$(uname -r)
# Also install it in the host, for the tests running outside the
# container
sudo pip install -U pip toml
sudo pip install -e '.[test]'
- id: fedora_tests
run: |
sudo pytest --postgresql-host 172.16.0.1 --container fedora --cov src/ --cov-report=xml -m "not slow"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
env_vars: PGVERSION, DISTRO
fail_ci_if_error: true
files: ./coverage.xml
verbose: true
name: codecov