Create codeql.yml #300
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
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 |