mirror of
https://github.com/percona/pg_stat_monitor.git
synced 2026-02-04 05:56:21 +00:00
PG-377: Enable PPG Jobs for PGSM in GH.
This commit contains following, 1) Regression jobs are enabled against Percona PG distribution for version postgresql 11~14. 2) Regression job is enabled against PGDG PG distribution for version postgresql 14. 3) GH actions names for some of the jobs are changed to clear the clutter in GH repo's action page.
This commit is contained in:
127
.github/workflows/code-coverage-test.yml
vendored
Normal file
127
.github/workflows/code-coverage-test.yml
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
name: code-coverage-test
|
||||
on: ["push", "pull_request"]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: coverage-test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone postgres repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: 'postgres/postgres'
|
||||
ref: 'REL_14_STABLE'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt purge postgresql-client-common postgresql-common postgresql postgresql*
|
||||
sudo apt-get install libreadline6-dev systemtap-sdt-dev zlib1g-dev libssl-dev libpam0g-dev python-dev bison flex libipc-run-perl -y docbook-xsl docbook-xsl
|
||||
sudo apt-get install -y libxml2 libxml2-utils libxml2-dev libxslt-dev xsltproc libkrb5-dev libldap2-dev libsystemd-dev gettext tcl-dev libperl-dev
|
||||
sudo apt-get install -y pkg-config clang-9 llvm-9 llvm-9-dev libselinux1-dev python-dev python3-dev uuid-dev liblz4-dev lcov
|
||||
sudo rm -rf /var/lib/postgresql/
|
||||
sudo rm -rf /var/log/postgresql/
|
||||
sudo rm -rf /etc/postgresql/
|
||||
sudo rm -rf /usr/lib/postgresql
|
||||
sudo rm -rf /usr/include/postgresql
|
||||
sudo rm -rf /usr/share/postgresql
|
||||
sudo rm -rf /etc/postgresql
|
||||
sudo rm -f /usr/bin/pg_config
|
||||
sudo /usr/bin/perl -MCPAN -e 'install IPC::RUN'
|
||||
sudo /usr/bin/perl -MCPAN -e 'install String::Util'
|
||||
sudo /usr/bin/perl -MCPAN -e 'install Data::Str2Num'
|
||||
|
||||
- name: Create pgsql dir
|
||||
run: mkdir -p /opt/pgsql
|
||||
|
||||
- name: Build postgres
|
||||
run: |
|
||||
export PATH="/opt/pgsql/bin:$PATH"
|
||||
./configure '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=${prefix}/include' \
|
||||
'--enable-coverage' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' \
|
||||
'--sysconfdir=/etc' '--localstatedir=/var' '--disable-silent-rules' \
|
||||
'--libdir=${prefix}/lib/x86_64-linux-gnu' \
|
||||
'--libexecdir=${prefix}/lib/x86_64-linux-gnu' '--disable-maintainer-mode' \
|
||||
'--disable-dependency-tracking' '--with-icu' '--with-tcl' '--with-perl' \
|
||||
'--with-python' '--with-pam' '--with-openssl' '--with-libxml' '--with-libxslt' \
|
||||
'PYTHON=/usr/bin/python3' '--mandir=/usr/share/postgresql/14/man' \
|
||||
'--docdir=/usr/share/doc/postgresql-doc-14' \
|
||||
'--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share/' \
|
||||
'--datadir=/usr/share/postgresql/14' '--bindir=/usr/lib/postgresql/14/bin' \
|
||||
'--libdir=/usr/lib/x86_64-linux-gnu/' '--libexecdir=/usr/lib/postgresql/' \
|
||||
'--includedir=/usr/include/postgresql/' '--with-extra-version= (Ubuntu 2:14-x.focal)' \
|
||||
'--enable-nls' '--enable-thread-safety' '--enable-tap-tests' '--enable-debug' \
|
||||
'--enable-dtrace' '--disable-rpath' '--with-uuid=e2fs' '--with-gnu-ld' \
|
||||
'--with-pgport=5432' '--with-system-tzdata=/usr/share/zoneinfo' '--with-llvm' \
|
||||
'LLVM_CONFIG=/usr/bin/llvm-config-11' 'CLANG=/usr/bin/clang-11' \
|
||||
'--with-systemd' '--with-selinux' 'MKDIR_P=/bin/mkdir -p' 'PROVE=/usr/bin/prove' \
|
||||
'TAR=/bin/tar' 'XSLTPROC=xsltproc --nonet' 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer' \
|
||||
'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now' '--with-gssapi' '--with-ldap' \
|
||||
'build_alias=x86_64-linux-gnu' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' \
|
||||
'CXXFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security'
|
||||
make world
|
||||
sudo make install-world
|
||||
|
||||
- name: Start postgresql cluster
|
||||
run: |
|
||||
/usr/lib/postgresql/14/bin/initdb -D /opt/pgsql/data
|
||||
/usr/lib/postgresql/14/bin/pg_ctl -D /opt/pgsql/data -l logfile start
|
||||
|
||||
- name: Clone pg_stat_monitor repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: 'src/pg_stat_monitor'
|
||||
|
||||
- name: Build pg_stat_monitor
|
||||
run: |
|
||||
export PATH="/usr/lib/postgresql/14/bin:$PATH"
|
||||
sudo cp /usr/lib/postgresql/14/bin/pg_config /usr/bin
|
||||
make USE_PGXS=1
|
||||
sudo make USE_PGXS=1 install
|
||||
working-directory: src/pg_stat_monitor/
|
||||
|
||||
- name: Load pg_stat_monitor library and Restart Server
|
||||
run: |
|
||||
/usr/lib/postgresql/14/bin/pg_ctl -D /opt/pgsql/data -l logfile stop
|
||||
echo "shared_preload_libraries = 'pg_stat_monitor'" >> /opt/pgsql/data/postgresql.conf
|
||||
/usr/lib/postgresql/14/bin/pg_ctl -D /opt/pgsql/data -l logfile start
|
||||
working-directory: src/pg_stat_monitor/
|
||||
|
||||
- name: Start pg_stat_monitor_tests & Run code coverage
|
||||
run: |
|
||||
make installcheck
|
||||
/usr/lib/postgresql/14/bin/psql -d postgres -p 5432 -c "\list"
|
||||
make coverage-html
|
||||
lcov --capture --directory . --output-file coverage/lcov.info
|
||||
pip install cpp-coveralls
|
||||
export COVERALLS_REPO_TOKEN="${{ secrets.COVERALL_PG_STAT_MONITOR_TOKEN }}"
|
||||
coveralls --verbose
|
||||
working-directory: src/pg_stat_monitor/
|
||||
|
||||
- name: Change dir permissions on fail
|
||||
if: ${{ failure() }}
|
||||
run: |
|
||||
sudo chmod -R ugo+rwx t
|
||||
sudo chmod -R ugo+rwx tmp_check
|
||||
exit 2 # regenerate error so that we can upload files in next step
|
||||
working-directory: src/pg_stat_monitor/
|
||||
|
||||
- name: Upload logs on fail
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Regressions diff and postgresql log
|
||||
path: |
|
||||
src/pg_stat_monitor/regression.diffs
|
||||
src/pg_stat_monitor/regression.out
|
||||
src/pg_stat_monitor/logfile
|
||||
src/pg_stat_monitor/t/results/
|
||||
src/pg_stat_monitor/tmp_check/log/
|
||||
!src/pg_stat_monitor/tmp_check/**/archives/*
|
||||
!src/pg_stat_monitor/tmp_check/**/backup/*
|
||||
!src/pg_stat_monitor/tmp_check/**/pgdata/*
|
||||
!src/pg_stat_monitor/tmp_check/**/archives/
|
||||
!src/pg_stat_monitor/tmp_check/**/backup/
|
||||
!src/pg_stat_monitor/tmp_check/**/pgdata/
|
||||
if-no-files-found: warn
|
||||
retention-days: 3
|
||||
Reference in New Issue
Block a user