From 1f7469374a20d0c444338f1b4f410f78734eee27 Mon Sep 17 00:00:00 2001 From: Artem Gavrilov Date: Wed, 3 Apr 2024 14:33:56 +0200 Subject: [PATCH] Revert "Temporary remove all workflows except cppcheck" This reverts commit 9f32e94992ebb3612f2f399af1a18646a43a2ee2. --- .github/workflows/code-coverage-test.yml | 139 +++++++++++++++++ .github/workflows/postgresql-11-build.yml | 121 +++++++++++++++ .../workflows/postgresql-11-pgdg-package.yml | 63 ++++++++ .github/workflows/postgresql-11-pmm.yaml | 41 +++++ .../workflows/postgresql-11-ppg-package.yml | 72 +++++++++ .github/workflows/postgresql-12-build.yml | 141 +++++++++++++++++ .../workflows/postgresql-12-pgdg-package.yml | 87 +++++++++++ .github/workflows/postgresql-12-pmm.yaml | 41 +++++ .../workflows/postgresql-12-ppg-package.yml | 96 ++++++++++++ .github/workflows/postgresql-13-build.yml | 141 +++++++++++++++++ .../workflows/postgresql-13-pgdg-package.yml | 87 +++++++++++ .github/workflows/postgresql-13-pmm.yaml | 41 +++++ .../workflows/postgresql-13-ppg-package.yml | 93 +++++++++++ .github/workflows/postgresql-14-build.yml | 145 ++++++++++++++++++ .../workflows/postgresql-14-pgdg-package.yml | 86 +++++++++++ .github/workflows/postgresql-14-pmm.yaml | 41 +++++ .../workflows/postgresql-14-ppg-package.yml | 93 +++++++++++ .github/workflows/postgresql-15-build.yml | 145 ++++++++++++++++++ .../workflows/postgresql-15-pgdg-package.yml | 87 +++++++++++ .github/workflows/postgresql-15-pmm.yaml | 41 +++++ .../workflows/postgresql-15-ppg-package.yml | 94 ++++++++++++ .github/workflows/postgresql-16-build.yml | 145 ++++++++++++++++++ .../workflows/postgresql-16-pgdg-package.yml | 87 +++++++++++ .../workflows/postgresql-16-ppg-package.yml | 94 ++++++++++++ 24 files changed, 2221 insertions(+) create mode 100644 .github/workflows/code-coverage-test.yml create mode 100644 .github/workflows/postgresql-11-build.yml create mode 100644 .github/workflows/postgresql-11-pgdg-package.yml create mode 100644 .github/workflows/postgresql-11-pmm.yaml create mode 100644 .github/workflows/postgresql-11-ppg-package.yml create mode 100644 .github/workflows/postgresql-12-build.yml create mode 100644 .github/workflows/postgresql-12-pgdg-package.yml create mode 100644 .github/workflows/postgresql-12-pmm.yaml create mode 100644 .github/workflows/postgresql-12-ppg-package.yml create mode 100644 .github/workflows/postgresql-13-build.yml create mode 100644 .github/workflows/postgresql-13-pgdg-package.yml create mode 100644 .github/workflows/postgresql-13-pmm.yaml create mode 100644 .github/workflows/postgresql-13-ppg-package.yml create mode 100644 .github/workflows/postgresql-14-build.yml create mode 100644 .github/workflows/postgresql-14-pgdg-package.yml create mode 100644 .github/workflows/postgresql-14-pmm.yaml create mode 100644 .github/workflows/postgresql-14-ppg-package.yml create mode 100644 .github/workflows/postgresql-15-build.yml create mode 100644 .github/workflows/postgresql-15-pgdg-package.yml create mode 100644 .github/workflows/postgresql-15-pmm.yaml create mode 100644 .github/workflows/postgresql-15-ppg-package.yml create mode 100644 .github/workflows/postgresql-16-build.yml create mode 100644 .github/workflows/postgresql-16-pgdg-package.yml create mode 100644 .github/workflows/postgresql-16-ppg-package.yml diff --git a/.github/workflows/code-coverage-test.yml b/.github/workflows/code-coverage-test.yml new file mode 100644 index 00000000..45305243 --- /dev/null +++ b/.github/workflows/code-coverage-test.yml @@ -0,0 +1,139 @@ +name: code-coverage-test +on: [pull_request] + +jobs: + build: + name: coverage-test + runs-on: ubuntu-22.04 + steps: + - name: Clone postgres repository + uses: actions/checkout@v2 + with: + repository: 'postgres/postgres' + ref: 'REL_15_STABLE' + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt purge postgresql-client-common postgresql-common \ + postgresql postgresql* + sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \ + zlib1g-dev libssl-dev libpam0g-dev bison flex \ + libipc-run-perl -y docbook-xsl docbook-xsl libxml2 libxml2-utils \ + libxml2-dev libxslt-dev xsltproc libkrb5-dev libldap2-dev \ + libsystemd-dev gettext tcl-dev libperl-dev pkg-config clang-11 \ + llvm-11 llvm-11-dev libselinux1-dev python3-dev uuid-dev \ + liblz4-dev lcov + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /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 Text::Trim' + + - 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' '--with-icu' \ + '--libdir=${prefix}/lib/x86_64-linux-gnu' '--with-tcl' \ + '--libexecdir=${prefix}/lib/x86_64-linux-gnu' '--with-perl' \ + '--with-python' '--with-pam' '--with-openssl' '--with-libxml' \ + '--with-libxslt' 'PYTHON=/usr/bin/python3' '--enable-nls' \ + '--mandir=/usr/share/postgresql/15/man' '--enable-thread-safety' \ + '--docdir=/usr/share/doc/postgresql-doc-15' '--enable-dtrace' \ + '--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share' \ + '--datadir=/usr/share/postgresql/15' '--with-uuid=e2fs' \ + '--bindir=/usr/lib/postgresql/15/bin' '--with-gnu-ld' \ + '--libdir=/usr/lib/x86_64-linux-gnu' '--enable-tap-tests' \ + '--libexecdir=/usr/lib/postgresql' '--enable-debug' \ + '--includedir=/usr/include/postgresql' '--disable-rpath' \ + '--with-pgport=5432' '--with-system-tzdata=/usr/share/zoneinfo' \ + '--with-llvm''TAR=/bin/tar' 'XSLTPROC=xsltproc --nonet' \ + 'LLVM_CONFIG=/usr/bin/llvm-config-11' 'CLANG=/usr/bin/clang-11' \ + '--with-systemd' 'MKDIR_P=/bin/mkdir -p' '--with-selinux' \ + 'PROVE=/usr/bin/prove' '--with-gssapi' '--with-ldap' \ + 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now' \ + 'build_alias=x86_64-linux-gnu' \ + 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' \ + 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer' \ + 'CXXFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security' + make world + sudo make install-world + + - name: Start postgresql cluster + run: | + export PATH="/usr/lib/postgresql/15/bin:$PATH" + sudo cp /usr/lib/postgresql/15/bin/pg_config /usr/bin + initdb -D /opt/pgsql/data + 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: | + 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: | + export PATH="/usr/lib/postgresql/15/bin:$PATH" + pg_ctl -D /opt/pgsql/data -l logfile stop + echo "shared_preload_libraries = 'pg_stat_monitor'" \ + >> /opt/pgsql/data/postgresql.conf + 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/15/bin/psql -d postgres -p 5432 -c "\list" + gcov -abcfu pg_stat_monitor.c + gcov -abcfu guc.c + gcov -abcfu hash_query.c + sudo chmod -R ugo+rwx *.gcov* + working-directory: src/pg_stat_monitor + + - name: Upload + uses: codecov/codecov-action@v2 + with: + verbose: true + working-directory: ./src/pg_stat_monitor + files: ./pg_stat_monitor.c.gcov,./hash_query.c.gcov,./guc.c.gcov + + - 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 diff --git a/.github/workflows/postgresql-11-build.yml b/.github/workflows/postgresql-11-build.yml new file mode 100644 index 00000000..ef4aa910 --- /dev/null +++ b/.github/workflows/postgresql-11-build.yml @@ -0,0 +1,121 @@ +name: postgresql-11-build +on: [push] + +jobs: + build: + name: pg-11-build-test + runs-on: ubuntu-22.04 + steps: + - name: Clone postgres repository + uses: actions/checkout@v2 + with: + repository: 'postgres/postgres' + ref: 'REL_11_STABLE' + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt purge postgresql-client-common postgresql-common \ + postgresql postgresql* + sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \ + zlib1g-dev libssl-dev libpam0g-dev bison flex \ + libipc-run-perl -y docbook-xsl docbook-xsl libxml2 libxml2-utils \ + libxml2-dev libxslt-dev xsltproc libkrb5-dev libldap2-dev \ + libsystemd-dev gettext tcl-dev libperl-dev pkg-config clang-11 \ + llvm-11 llvm-11-dev libselinux1-dev python3-dev uuid-dev liblz4-dev + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /etc/postgresql + sudo rm -f /usr/bin/pg_config + + - 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=/usr/include' '--mandir=/usr/share/man' \ + '--infodir=/usr/share/info' '--sysconfdir=/etc' '--enable-nls' \ + '--localstatedir=/var' '--libdir=/usr/lib/x86_64-linux-gnu' \ + 'runstatedir=/run' '--with-icu' '--with-tcl' '--with-perl' \ + '--with-python' '--with-pam' '--with-openssl' '--with-libxml' \ + '--with-libxslt' 'PYTHON=/usr/bin/python3' 'MKDIR_P=/bin/mkdir -p' \ + '--mandir=/usr/share/postgresql/11/man' '--enable-dtrace' \ + '--docdir=/usr/share/doc/postgresql-doc-11' '--enable-debug' \ + '--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share' \ + '--datadir=/usr/share/postgresql/11' '--enable-thread-safety' \ + '--bindir=/usr/lib/postgresql/11/bin' '--enable-tap-tests' \ + '--libdir=/usr/lib/x86_64-linux-gnu' '--disable-rpath' \ + '--libexecdir=/usr/lib/postgresql' '--with-uuid=e2fs' \ + '--includedir=/usr/include/postgresql' '--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' \ + 'PROVE=/usr/bin/prove' 'TAR=/bin/tar' '--with-gssapi' '--with-ldap' \ + 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now' \ + '--with-includes=/usr/include/mit-krb5' '--with-libs=/usr/lib/mit-krb5' \ + '--with-libs=/usr/lib/x86_64-linux-gnu/mit-krb5' \ + 'build_alias=x86_64-linux-gnu' \ + 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' \ + 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer' \ + 'CXXFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security' + make world + sudo make install-world + + - name: Start postgresql cluster + run: | + export PATH="/usr/lib/postgresql/11/bin:$PATH" + sudo cp /usr/lib/postgresql/11/bin/pg_config /usr/bin + initdb -D /opt/pgsql/data + 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: | + 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: | + export PATH="/usr/lib/postgresql/11/bin:$PATH" + pg_ctl -D /opt/pgsql/data -l logfile stop + echo "shared_preload_libraries = 'pg_stat_monitor'" >> \ + /opt/pgsql/data/postgresql.conf + pg_ctl -D /opt/pgsql/data -l logfile start + working-directory: src/pg_stat_monitor + + - name: Start pg_stat_monitor_tests + run: | + make installcheck + working-directory: src/pg_stat_monitor + + - name: Report on pg_stat_monitor test fail + uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: Regressions diff and postgresql log + path: | + src/pg_stat_monitor/regression.diffs + src/pg_stat_monitor/logfile + retention-days: 1 + + - name: Start Server installcheck-world tests + run: | + make installcheck-world + + - name: Report on installcheck-world test suites fail + uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: Regressions output files of failed testsuite, and pg log + path: | + **/regression.diffs + **/regression.out + src/pg_stat_monitor/logfile + retention-days: 3 diff --git a/.github/workflows/postgresql-11-pgdg-package.yml b/.github/workflows/postgresql-11-pgdg-package.yml new file mode 100644 index 00000000..258cb632 --- /dev/null +++ b/.github/workflows/postgresql-11-pgdg-package.yml @@ -0,0 +1,63 @@ +name: postgresql-11-pgdg-package +on: [pull_request] + +jobs: + build: + name: pg-11-pgdg-package-test + runs-on: ubuntu-22.04 + steps: + - name: Clone pg_stat_monitor repository + uses: actions/checkout@v2 + with: + path: 'src/pg_stat_monitor' + + - name: Delete old postgresql files + run: | + sudo apt-get update + sudo apt purge postgresql-client-common postgresql-common \ + postgresql postgresql* + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /etc/postgresql + sudo rm -f /usr/bin/pg_config + + - name: Install PG Distribution Postgresql 11 + run: | + sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt \ + $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' + sudo wget --quiet -O - \ + https://www.postgresql.org/media/keys/ACCC4CF8.asc | + sudo apt-key add - + sudo apt-get -y update + sudo apt-get -y install postgresql-11 postgresql-server-dev-11 + + - name: Change src owner to postgres + run: | + sudo chown -R postgres:postgres src + + - name: Build pg_stat_monitor + run: | + sudo -u postgres bash -c 'make USE_PGXS=1' + sudo make USE_PGXS=1 install + working-directory: src/pg_stat_monitor + + - name: Start pg_stat_monitor_tests + run: | + sudo service postgresql stop + echo "shared_preload_libraries = 'pg_stat_monitor'" | + sudo tee -a /etc/postgresql/11/main/postgresql.conf + sudo service postgresql start + sudo psql -V + export PG_TEST_PORT_DIR=/home/postgres + sudo -u postgres bash -c 'make installcheck USE_PGXS=1' + working-directory: src/pg_stat_monitor + + - name: Report on test fail + uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: Regressions diff and postgresql log + path: | + src/pg_stat_monitor/regression.diffs + src/pg_stat_monitor/logfile + retention-days: 3 diff --git a/.github/workflows/postgresql-11-pmm.yaml b/.github/workflows/postgresql-11-pmm.yaml new file mode 100644 index 00000000..95013ae2 --- /dev/null +++ b/.github/workflows/postgresql-11-pmm.yaml @@ -0,0 +1,41 @@ +name: postgresql-11-pmm-integration +on: [push] + +jobs: + build: + name: pg-11-pgsm-pmm-integration-test + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Clone QA Integration repository + uses: actions/checkout@v3 + with: + repository: 'Percona-Lab/qa-integration' + ref: 'main' + + # print branch and Repo name + - name: Get branch and Repo Name + run: echo 'The branch and Repo Name is' ${{ github.head_ref }} ${{ github.actor }}/pg_stat_monitor + + - name: "Set TARGET_BRANCH variable for a PR run" + if: github.event_name == 'pull_request' + run: echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV + + - name: "Set TARGET_BRANCH variable for a PUSH run" + if: github.event_name == 'push' + run: echo "TARGET_BRANCH=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Run PMM & PGSM Setup, E2E Tests + run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=11 --pgstat-monitor-branch=${{ env.TARGET_BRANCH }} + + - name: Get PMM-Agent Logs from the Container + if: success() || failure() # run this step even if previous step failed + run: docker exec pgsql_pgsm_11 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log + + - name: Upload Tests Artifacts + uses: actions/upload-artifact@v3 + if: success() || failure() # run this step even if previous step failed + with: + name: tests-artifact + path: ./pmm-ui-tests/tests/output/ + if-no-files-found: ignore # 'warn' or 'ignore' are also available, defaults to `warn` diff --git a/.github/workflows/postgresql-11-ppg-package.yml b/.github/workflows/postgresql-11-ppg-package.yml new file mode 100644 index 00000000..caf81fff --- /dev/null +++ b/.github/workflows/postgresql-11-ppg-package.yml @@ -0,0 +1,72 @@ +name: postgresql-11-ppg-package +on: [push] + +jobs: + build: + name: pg-11-ppg-package-test + runs-on: ubuntu-22.04 + steps: + - name: Clone pg_stat_monitor repository + uses: actions/checkout@v2 + with: + path: 'src/pg_stat_monitor' + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt purge postgresql-client-common postgresql-common \ + postgresql postgresql* + sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \ + zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \ + libipc-run-perl wget + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /etc/postgresql + sudo rm -f /usr/bin/pg_config + + - name: Install percona-release script + run: | + sudo apt-get -y update + sudo apt-get -y upgrade + sudo apt-get install -y wget gnupg2 curl lsb-release + sudo wget \ + https://repo.percona.com/apt/percona-release_latest.generic_all.deb + sudo dpkg -i percona-release_latest.generic_all.deb + + - name: Install Percona Distribution Postgresql 11 + run: | + sudo percona-release setup ppg-11 + sudo apt-get update -y + sudo apt-get install -y percona-postgresql-11 \ + percona-postgresql-contrib percona-postgresql-server-dev-all + + - name: Change src owner to postgres + run: | + sudo chown -R postgres:postgres src + + - name: Build pg_stat_monitor + run: | + sudo -u postgres bash -c 'make USE_PGXS=1' + sudo make USE_PGXS=1 install + working-directory: src/pg_stat_monitor + + - name: Start pg_stat_monitor_tests + run: | + sudo service postgresql stop + echo "shared_preload_libraries = 'pg_stat_monitor'" | + sudo tee -a /etc/postgresql/11/main/postgresql.conf + sudo service postgresql start + sudo psql -V + export PG_TEST_PORT_DIR=/home/postgres + sudo -u postgres bash -c 'make installcheck USE_PGXS=1' + working-directory: src/pg_stat_monitor + + - name: Report on test fail + uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: Regressions diff and postgresql log + path: | + src/pg_stat_monitor/regression.diffs + src/pg_stat_monitor/logfile + retention-days: 3 diff --git a/.github/workflows/postgresql-12-build.yml b/.github/workflows/postgresql-12-build.yml new file mode 100644 index 00000000..93199847 --- /dev/null +++ b/.github/workflows/postgresql-12-build.yml @@ -0,0 +1,141 @@ +name: postgresql-12-build +on: [push] + +jobs: + build: + name: pg-12-build-test + runs-on: ubuntu-22.04 + steps: + - name: Clone postgres repository + uses: actions/checkout@v2 + with: + repository: 'postgres/postgres' + ref: 'REL_12_STABLE' + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt purge postgresql-client-common postgresql-common \ + postgresql postgresql* + sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \ + zlib1g-dev libssl-dev libpam0g-dev bison flex \ + libipc-run-perl docbook-xsl docbook-xsl libxml2 libxml2-utils \ + libxml2-dev libxslt-dev xsltproc libkrb5-dev libldap2-dev \ + libsystemd-dev gettext tcl-dev libperl-dev pkg-config clang-11 \ + llvm-11 llvm-11-dev libselinux1-dev python3-dev uuid-dev liblz4-dev + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /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 Text::Trim' + + - 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=/usr/include' '--mandir=/usr/share/man' \ + '--infodir=/usr/share/info' '--sysconfdir=/etc' '--with-gnu-ld' \ + '--localstatedir=/var' '--libdir=/usr/lib/x86_64-linux-gnu' \ + 'runstatedir=/run' '--with-icu' '--with-tcl' '--with-perl' \ + '--with-python' '--with-pam' '--with-openssl' '--with-libxml' \ + '--with-libxslt' 'PYTHON=/usr/bin/python3' '--enable-tap-tests' \ + '--mandir=/usr/share/postgresql/12/man' '--enable-thread-safety' \ + '--docdir=/usr/share/doc/postgresql-doc-12' '--enable-debug' \ + '--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share' \ + '--datadir=/usr/share/postgresql/12' '--enable-dtrace' \ + '--bindir=/usr/lib/postgresql/12/bin' '--disable-rpath' \ + '--libdir=/usr/lib/x86_64-linux-gnu' '--with-pgport=5432' \ + '--libexecdir=/usr/lib/postgresql' '--with-uuid=e2fs' \ + '--includedir=/usr/include/postgresql' 'TAR=/bin/tar' \ + '--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' '--with-gssapi' '--with-ldap' \ + 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now' \ + '--with-includes=/usr/include/mit-krb5' '--with-libs=/usr/lib/mit-krb5' \ + '--with-libs=/usr/lib/x86_64-linux-gnu/mit-krb5' \ + 'build_alias=x86_64-linux-gnu' \ + 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' '--enable-nls' \ + 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer' \ + 'CXXFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security' + make world + sudo make install-world + + - name: Start postgresql cluster + run: | + export PATH="/usr/lib/postgresql/12/bin:$PATH" + sudo cp /usr/lib/postgresql/12/bin/pg_config /usr/bin + initdb -D /opt/pgsql/data + 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: | + 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: | + export PATH="/usr/lib/postgresql/12/bin:$PATH" + pg_ctl -D /opt/pgsql/data -l logfile stop + echo "shared_preload_libraries = 'pg_stat_monitor'" >> \ + /opt/pgsql/data/postgresql.conf + pg_ctl -D /opt/pgsql/data -l logfile start + working-directory: src/pg_stat_monitor + + - name: Start pg_stat_monitor_tests + run: | + make installcheck + 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 + + - name: Start Server installcheck-world tests + run: | + make installcheck-world + + - name: Report on installcheck-world test suites fail + uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: Regressions output files of failed testsuite, and pg log + path: | + **/regression.diffs + **/regression.out + src/pg_stat_monitor/logfile + retention-days: 3 diff --git a/.github/workflows/postgresql-12-pgdg-package.yml b/.github/workflows/postgresql-12-pgdg-package.yml new file mode 100644 index 00000000..b53ca17c --- /dev/null +++ b/.github/workflows/postgresql-12-pgdg-package.yml @@ -0,0 +1,87 @@ +name: postgresql-12-pgdg-package +on: [pull_request] + +jobs: + build: + name: pg-12-pgdg-package-test + runs-on: ubuntu-22.04 + steps: + - name: Clone pg_stat_monitor repository + uses: actions/checkout@v2 + with: + path: 'src/pg_stat_monitor' + + - name: Delete old postgresql files + run: | + sudo apt-get update + sudo apt purge postgresql-client-common postgresql-common \ + postgresql postgresql* + sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \ + zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \ + libipc-run-perl wget -y + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /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 Text::Trim' + + - name: Install PG Distribution Postgresql 12 + run: | + sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt \ + $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' + sudo wget --quiet -O - \ + https://www.postgresql.org/media/keys/ACCC4CF8.asc | + sudo apt-key add - + sudo apt-get -y update + sudo apt-get -y install postgresql-12 postgresql-server-dev-12 + + - name: Change src owner to postgres + run: | + sudo chown -R postgres:postgres src + + - name: Build pg_stat_monitor + run: | + sudo -u postgres bash -c 'make USE_PGXS=1' + sudo make USE_PGXS=1 install + working-directory: src/pg_stat_monitor + + - name: Start pg_stat_monitor_tests + run: | + sudo service postgresql stop + echo "shared_preload_libraries = 'pg_stat_monitor'" | + sudo tee -a /etc/postgresql/12/main/postgresql.conf + sudo service postgresql start + sudo psql -V + export PG_TEST_PORT_DIR=${GITHUB_WORKSPACE}/src/pg_stat_monitor + echo $PG_TEST_PORT_DIR + sudo -E -u postgres bash -c 'make installcheck USE_PGXS=1' + 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 diff --git a/.github/workflows/postgresql-12-pmm.yaml b/.github/workflows/postgresql-12-pmm.yaml new file mode 100644 index 00000000..e5b88d6e --- /dev/null +++ b/.github/workflows/postgresql-12-pmm.yaml @@ -0,0 +1,41 @@ +name: postgresql-12-pmm-integration +on: [push] + +jobs: + build: + name: pg-12-pgsm-pmm-integration-test + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Clone QA Integration repository + uses: actions/checkout@v3 + with: + repository: 'Percona-Lab/qa-integration' + ref: 'main' + + # print branch and Repo name + - name: Get branch and Repo Name + run: echo 'The branch and Repo Name is' ${{ github.head_ref }} ${{ github.actor }}/pg_stat_monitor + + - name: "Set TARGET_BRANCH variable for a PR run" + if: github.event_name == 'pull_request' + run: echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV + + - name: "Set TARGET_BRANCH variable for a PUSH run" + if: github.event_name == 'push' + run: echo "TARGET_BRANCH=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Run PMM & PGSM Setup, E2E Tests + run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=12 --pgstat-monitor-branch=${{ env.TARGET_BRANCH }} + + - name: Get PMM-Agent Logs from the Container + if: success() || failure() # run this step even if previous step failed + run: docker exec pgsql_pgsm_12 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log + + - name: Upload Tests Artifacts + uses: actions/upload-artifact@v3 + if: success() || failure() # run this step even if previous step failed + with: + name: tests-artifact + path: ./pmm-ui-tests/tests/output/ + if-no-files-found: ignore # 'warn' or 'ignore' are also available, defaults to `warn` diff --git a/.github/workflows/postgresql-12-ppg-package.yml b/.github/workflows/postgresql-12-ppg-package.yml new file mode 100644 index 00000000..b99575f3 --- /dev/null +++ b/.github/workflows/postgresql-12-ppg-package.yml @@ -0,0 +1,96 @@ +name: postgresql-12-ppg-package +on: [push] + +jobs: + build: + name: pg-12-ppg-package-test + runs-on: ubuntu-22.04 + steps: + - name: Clone pg_stat_monitor repository + uses: actions/checkout@v2 + with: + path: 'src/pg_stat_monitor' + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt purge postgresql-client-common postgresql-common \ + postgresql postgresql* + sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \ + zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \ + libipc-run-perl wget + sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \ + zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \ + libipc-run-perl wget + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /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 Text::Trim' + + - name: Install percona-release script + run: | + sudo apt-get -y update + sudo apt-get -y upgrade + sudo apt-get install -y wget gnupg2 curl lsb-release + sudo wget \ + https://repo.percona.com/apt/percona-release_latest.generic_all.deb + sudo dpkg -i percona-release_latest.generic_all.deb + + - name: Install Percona Distribution Postgresql 12 + run: | + sudo percona-release setup ppg-12 + sudo apt-get update -y + sudo apt-get install -y percona-postgresql-12 \ + percona-postgresql-contrib percona-postgresql-server-dev-all + + - name: Change src owner to postgres + run: | + sudo chown -R postgres:postgres src + + - name: Build pg_stat_monitor + run: | + sudo -u postgres bash -c 'make USE_PGXS=1' + sudo make USE_PGXS=1 install + working-directory: src/pg_stat_monitor + + - name: Start pg_stat_monitor_tests + run: | + sudo service postgresql stop + echo "shared_preload_libraries = 'pg_stat_monitor'" | + sudo tee -a /etc/postgresql/12/main/postgresql.conf + sudo service postgresql start + sudo psql -V + export PG_TEST_PORT_DIR=${GITHUB_WORKSPACE}/src/pg_stat_monitor + echo $PG_TEST_PORT_DIR + sudo -E -u postgres bash -c 'make installcheck USE_PGXS=1' + 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 diff --git a/.github/workflows/postgresql-13-build.yml b/.github/workflows/postgresql-13-build.yml new file mode 100644 index 00000000..16fe0a9c --- /dev/null +++ b/.github/workflows/postgresql-13-build.yml @@ -0,0 +1,141 @@ +name: postgresql-13-build +on: [push] + +jobs: + build: + name: pg-13-build-test + runs-on: ubuntu-22.04 + steps: + - name: Clone postgres repository + uses: actions/checkout@v2 + with: + repository: 'postgres/postgres' + ref: 'REL_13_STABLE' + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt purge postgresql-client-common postgresql-common \ + postgresql postgresql* + sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \ + zlib1g-dev libssl-dev libpam0g-dev bison flex \ + libipc-run-perl -y docbook-xsl docbook-xsl libxml2 libxml2-utils \ + libxml2-dev libxslt-dev xsltproc libkrb5-dev libldap2-dev \ + libsystemd-dev gettext tcl-dev libperl-dev pkg-config clang-11 \ + llvm-11 llvm-11-dev libselinux1-dev python3-dev uuid-dev liblz4-dev + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /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 Text::Trim' + + - 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' \ + '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' \ + '--sysconfdir=/etc' '--localstatedir=/var' '--with-icu' \ + '--libdir=${prefix}/lib/x86_64-linux-gnu' '--with-perl' \ + '--libexecdir=${prefix}/lib/x86_64-linux-gnu' '--enable-debug' \ + '--with-tcl' '--with-pam' '--with-python' '--with-openssl' \ + '--with-libxml' '--with-libxslt' '--enable-tap-tests' \ + 'PYTHON=/usr/bin/python3' '--mandir=/usr/share/postgresql/13/man' \ + '--docdir=/usr/share/doc/postgresql-doc-13' 'AWK=mawk' \ + '--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share' \ + '--datadir=/usr/share/postgresql/13' '--enable-nls' \ + '--bindir=/usr/lib/postgresql/13/bin' '--enable-dtrace' \ + '--libdir=/usr/lib/x86_64-linux-gnu' '--disable-rpath' \ + '--libexecdir=/usr/lib/postgresql' '--enable-thread-safety' \ + '--includedir=/usr/include/postgresql' 'TAR=/bin/tar' \ + '--with-uuid=e2fs' '--with-gnu-ld' 'XSLTPROC=xsltproc --nonet' \ + '--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' \ + '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' \ + 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer' \ + 'CXXFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security' + make world + sudo make install-world + + - name: Start postgresql cluster + run: | + export PATH="/usr/lib/postgresql/13/bin:$PATH" + sudo cp /usr/lib/postgresql/13/bin/pg_config /usr/bin + initdb -D /opt/pgsql/data + 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: | + 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: | + export PATH="/usr/lib/postgresql/13/bin:$PATH" + pg_ctl -D /opt/pgsql/data -l logfile stop + echo "shared_preload_libraries = 'pg_stat_monitor'" >> \ + /opt/pgsql/data/postgresql.conf + pg_ctl -D /opt/pgsql/data -l logfile start + working-directory: src/pg_stat_monitor + + - name: Start pg_stat_monitor_tests + run: | + make installcheck + 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: 1 + + - name: Start Server installcheck-world tests + run: | + make installcheck-world + + - name: Report on installcheck-world test suites fail + uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: Regressions output files of failed testsuite, and pg log + path: | + **/regression.diffs + **/regression.out + src/pg_stat_monitor/logfile + retention-days: 3 diff --git a/.github/workflows/postgresql-13-pgdg-package.yml b/.github/workflows/postgresql-13-pgdg-package.yml new file mode 100644 index 00000000..8e0eccc4 --- /dev/null +++ b/.github/workflows/postgresql-13-pgdg-package.yml @@ -0,0 +1,87 @@ +name: postgresql-13-pgdg-package +on: [pull_request] + +jobs: + build: + name: pg-13-pgdg-package-test + runs-on: ubuntu-22.04 + steps: + - name: Clone pg_stat_monitor repository + uses: actions/checkout@v2 + with: + path: 'src/pg_stat_monitor' + + - name: Delete old postgresql files + run: | + sudo apt-get update + sudo apt purge postgresql-client-common postgresql-common \ + postgresql postgresql* + sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \ + zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \ + libipc-run-perl wget -y + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /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 Text::Trim' + + - name: Install PG Distribution Postgresql 13 + run: | + sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt \ + $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' + sudo wget --quiet -O - \ + https://www.postgresql.org/media/keys/ACCC4CF8.asc | + sudo apt-key add - + sudo apt update + sudo apt -y install postgresql-13 postgresql-server-dev-13 + + - name: Change src owner to postgres + run: | + sudo chown -R postgres:postgres src + + - name: Build pg_stat_monitor + run: | + sudo -u postgres bash -c 'make USE_PGXS=1' + sudo make USE_PGXS=1 install + working-directory: src/pg_stat_monitor + + - name: Start pg_stat_monitor_tests + run: | + sudo service postgresql stop + echo "shared_preload_libraries = 'pg_stat_monitor'" | + sudo tee -a /etc/postgresql/13/main/postgresql.conf + sudo service postgresql start + sudo psql -V + export PG_TEST_PORT_DIR=${GITHUB_WORKSPACE}/src/pg_stat_monitor + echo $PG_TEST_PORT_DIR + sudo -E -u postgres bash -c 'make installcheck USE_PGXS=1' + 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 diff --git a/.github/workflows/postgresql-13-pmm.yaml b/.github/workflows/postgresql-13-pmm.yaml new file mode 100644 index 00000000..549c5a45 --- /dev/null +++ b/.github/workflows/postgresql-13-pmm.yaml @@ -0,0 +1,41 @@ +name: postgresql-13-pmm-integration +on: [push] + +jobs: + build: + name: pg-13-pgsm-pmm-integration-test + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Clone QA Integration repository + uses: actions/checkout@v3 + with: + repository: 'Percona-Lab/qa-integration' + ref: 'main' + + # print branch and Repo name + - name: Get branch and Repo Name + run: echo 'The branch and Repo Name is' ${{ github.head_ref }} ${{ github.actor }}/pg_stat_monitor + + - name: "Set TARGET_BRANCH variable for a PR run" + if: github.event_name == 'pull_request' + run: echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV + + - name: "Set TARGET_BRANCH variable for a PUSH run" + if: github.event_name == 'push' + run: echo "TARGET_BRANCH=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Run PMM & PGSM Setup, E2E Tests + run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=13 --pgstat-monitor-branch=${{ env.TARGET_BRANCH }} + + - name: Get PMM-Agent Logs from the Container + if: success() || failure() # run this step even if previous step failed + run: docker exec pgsql_pgsm_13 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log + + - name: Upload Tests Artifacts + uses: actions/upload-artifact@v3 + if: success() || failure() # run this step even if previous step failed + with: + name: tests-artifact + path: ./pmm-ui-tests/tests/output/ + if-no-files-found: ignore # 'warn' or 'ignore' are also available, defaults to `warn` diff --git a/.github/workflows/postgresql-13-ppg-package.yml b/.github/workflows/postgresql-13-ppg-package.yml new file mode 100644 index 00000000..53c5e8b5 --- /dev/null +++ b/.github/workflows/postgresql-13-ppg-package.yml @@ -0,0 +1,93 @@ +name: postgresql-13-ppg-package +on: [push] + +jobs: + build: + name: pg-13-ppg-package-test + runs-on: ubuntu-22.04 + steps: + - name: Clone pg_stat_monitor repository + uses: actions/checkout@v2 + with: + path: 'src/pg_stat_monitor' + + - name: Delete old postgresql files + run: | + sudo apt-get update + sudo apt purge postgresql-client-common postgresql-common \ + postgresql postgresql* + sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \ + zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \ + libipc-run-perl wget + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /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 Text::Trim' + + - name: Install percona-release script + run: | + sudo apt-get -y update + sudo apt-get -y upgrade + sudo apt-get install -y wget gnupg2 curl lsb-release + sudo wget \ + https://repo.percona.com/apt/percona-release_latest.generic_all.deb + sudo dpkg -i percona-release_latest.generic_all.deb + + - name: Install Percona Distribution Postgresql 13 + run: | + sudo percona-release setup ppg-13 + sudo apt-get update -y + sudo apt-get install -y percona-postgresql-13 \ + percona-postgresql-contrib percona-postgresql-server-dev-all + + - name: Change src owner to postgres + run: | + sudo chown -R postgres:postgres src + + - name: Build pg_stat_monitor + run: | + sudo -u postgres bash -c 'make USE_PGXS=1' + sudo make USE_PGXS=1 install + working-directory: src/pg_stat_monitor + + - name: Start pg_stat_monitor_tests + run: | + sudo service postgresql stop + echo "shared_preload_libraries = 'pg_stat_monitor'" | + sudo tee -a /etc/postgresql/13/main/postgresql.conf + sudo service postgresql start + sudo psql -V + export PG_TEST_PORT_DIR=${GITHUB_WORKSPACE}/src/pg_stat_monitor + echo $PG_TEST_PORT_DIR + sudo -E -u postgres bash -c 'make installcheck USE_PGXS=1' + 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 diff --git a/.github/workflows/postgresql-14-build.yml b/.github/workflows/postgresql-14-build.yml new file mode 100644 index 00000000..30fea46c --- /dev/null +++ b/.github/workflows/postgresql-14-build.yml @@ -0,0 +1,145 @@ +name: postgresql-14-build +on: [push] + +jobs: + build: + name: pg-14-build-test + runs-on: ubuntu-22.04 + 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 -y libreadline6-dev systemtap-sdt-dev \ + zlib1g-dev libssl-dev libpam0g-dev bison flex \ + libipc-run-perl -y docbook-xsl docbook-xsl libxml2 libxml2-utils \ + libxml2-dev libxslt-dev xsltproc libkrb5-dev libldap2-dev \ + libsystemd-dev gettext tcl-dev libperl-dev pkg-config clang-11 \ + llvm-11 llvm-11-dev libselinux1-dev python3-dev \ + uuid-dev liblz4-dev + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /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 Text::Trim' + + - 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' '--mandir=${prefix}/share/man' \ + '--infodir=${prefix}/share/info' '--sysconfdir=/etc' \ + '--localstatedir=/var' '--libdir=${prefix}/lib/x86_64-linux-gnu' \ + '--libexecdir=${prefix}/lib/x86_64-linux-gnu' '--with-icu' \ + '--with-tcl' '--with-perl' '--with-python' '--with-pam' \ + '--with-openssl' '--with-libxml' '--with-libxslt' '--with-ldap' \ + 'PYTHON=/usr/bin/python3' '--mandir=/usr/share/postgresql/14/man' \ + '--docdir=/usr/share/doc/postgresql-doc-14' '--with-pgport=5432' \ + '--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share' \ + '--datadir=/usr/share/postgresql/14' '--with-uuid=e2fs' \ + '--bindir=/usr/lib/postgresql/14/bin' '--enable-tap-tests' \ + '--libdir=/usr/lib/x86_64-linux-gnu' '--enable-debug' \ + '--libexecdir=/usr/lib/postgresql' '--with-gnu-ld' \ + '--includedir=/usr/include/postgresql' '--enable-dtrace' \ + '--enable-nls' '--enable-thread-safety' '--disable-rpath' \ + '--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' \ + 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now' \ + 'build_alias=x86_64-linux-gnu' '--with-gssapi' \ + 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' \ + 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer' \ + 'CXXFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security' + make world + sudo make install-world + + - name: Start postgresql cluster + run: | + export PATH="/usr/lib/postgresql/14/bin:$PATH" + sudo cp /usr/lib/postgresql/14/bin/pg_config /usr/bin + initdb -D /opt/pgsql/data + 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: | + 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: | + export PATH="/usr/lib/postgresql/14/bin:$PATH" + pg_ctl -D /opt/pgsql/data -l logfile stop + echo "shared_preload_libraries = 'pg_stat_monitor'" >> \ + /opt/pgsql/data/postgresql.conf + pg_ctl -D /opt/pgsql/data -l logfile start + working-directory: src/pg_stat_monitor + + - name: Start pg_stat_monitor_tests + run: | + make installcheck + 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 + + - name: Start Server installcheck-world tests + run: | + export PATH="/usr/lib/postgresql/14/bin:$PATH" + pg_ctl -D /opt/pgsql/data -l logfile stop + echo "compute_query_id = off" >> /opt/pgsql/data/postgresql.conf + pg_ctl -D /opt/pgsql/data -l logfile start + make installcheck-world + + - name: Report on installcheck-world test suites fail + uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: Regressions output files of failed testsuite, and pg log + path: | + **/regression.diffs + **/regression.out + src/pg_stat_monitor/logfile + retention-days: 3 diff --git a/.github/workflows/postgresql-14-pgdg-package.yml b/.github/workflows/postgresql-14-pgdg-package.yml new file mode 100644 index 00000000..982bbc85 --- /dev/null +++ b/.github/workflows/postgresql-14-pgdg-package.yml @@ -0,0 +1,86 @@ +name: postgresql-14-pgdg-package +on: [pull_request] + +jobs: + build: + name: pg-14-pgdg-package-test + runs-on: ubuntu-22.04 + steps: + - name: Clone pg_stat_monitor repository + uses: actions/checkout@v2 + with: + path: 'src/pg_stat_monitor' + + - name: Delete old postgresql files + run: | + sudo apt-get update + sudo apt purge postgresql-client-common postgresql-common \ + postgresql postgresql* + sudo apt-get install -y libreadline6-dev systemtap-sdt-dev wget \ + zlib1g-dev libssl-dev libpam0g-dev bison flex libipc-run-perl + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /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 Text::Trim' + + - name: Install PG Distribution Postgresql 14 + run: | + sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt \ + $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' + sudo wget --quiet -O - \ + https://www.postgresql.org/media/keys/ACCC4CF8.asc | + sudo apt-key add - + sudo apt update + sudo apt -y install postgresql-14 postgresql-server-dev-14 + + - name: Change src owner to postgres + run: | + sudo chown -R postgres:postgres src + + - name: Build pg_stat_monitor + run: | + sudo -u postgres bash -c 'make USE_PGXS=1' + sudo make USE_PGXS=1 install + working-directory: src/pg_stat_monitor + + - name: Start pg_stat_monitor_tests + run: | + sudo service postgresql stop + echo "shared_preload_libraries = 'pg_stat_monitor'" | + sudo tee -a /etc/postgresql/14/main/postgresql.conf + sudo service postgresql start + sudo psql -V + export PG_TEST_PORT_DIR=${GITHUB_WORKSPACE}/src/pg_stat_monitor + echo $PG_TEST_PORT_DIR + sudo -E -u postgres bash -c 'make installcheck USE_PGXS=1' + 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 diff --git a/.github/workflows/postgresql-14-pmm.yaml b/.github/workflows/postgresql-14-pmm.yaml new file mode 100644 index 00000000..3c34e63c --- /dev/null +++ b/.github/workflows/postgresql-14-pmm.yaml @@ -0,0 +1,41 @@ +name: postgresql-14-pmm-integration +on: [push] + +jobs: + build: + name: pg-14-pgsm-pmm-integration-test + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Clone QA Integration repository + uses: actions/checkout@v3 + with: + repository: 'Percona-Lab/qa-integration' + ref: 'main' + + # print branch and Repo name + - name: Get branch and Repo Name + run: echo 'The branch and Repo Name is' ${{ github.head_ref }} ${{ github.actor }}/pg_stat_monitor + + - name: "Set TARGET_BRANCH variable for a PR run" + if: github.event_name == 'pull_request' + run: echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV + + - name: "Set TARGET_BRANCH variable for a PUSH run" + if: github.event_name == 'push' + run: echo "TARGET_BRANCH=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Run PMM & PGSM Setup, E2E Tests + run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=14 --pgstat-monitor-branch=${{ env.TARGET_BRANCH }} + + - name: Get PMM-Agent Logs from the Container + if: success() || failure() # run this step even if previous step failed + run: docker exec pgsql_pgsm_14 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log + + - name: Upload Tests Artifacts + uses: actions/upload-artifact@v3 + if: success() || failure() # run this step even if previous step failed + with: + name: tests-artifact + path: ./pmm-ui-tests/tests/output/ + if-no-files-found: ignore # 'warn' or 'ignore' are also available, defaults to `warn` diff --git a/.github/workflows/postgresql-14-ppg-package.yml b/.github/workflows/postgresql-14-ppg-package.yml new file mode 100644 index 00000000..3a507bff --- /dev/null +++ b/.github/workflows/postgresql-14-ppg-package.yml @@ -0,0 +1,93 @@ +name: postgresql-14-ppg-package +on: [push] + +jobs: + build: + name: pg-14-ppg-package-test + runs-on: ubuntu-22.04 + steps: + - name: Clone pg_stat_monitor repository + uses: actions/checkout@v2 + with: + path: 'src/pg_stat_monitor' + + - name: Delete old postgresql files + run: | + sudo apt-get update + sudo apt purge postgresql-client-common postgresql-common \ + postgresql postgresql* + sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \ + zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \ + libipc-run-perl wget + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /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 Text::Trim' + + - name: Install percona-release script + run: | + sudo apt-get -y update + sudo apt-get -y upgrade + sudo apt-get install -y wget gnupg2 curl lsb-release + sudo wget \ + https://repo.percona.com/apt/percona-release_latest.generic_all.deb + sudo dpkg -i percona-release_latest.generic_all.deb + + - name: Install Percona Distribution Postgresql 14 + run: | + sudo percona-release setup ppg-14 + sudo apt-get update -y + sudo apt-get install -y percona-postgresql-14 \ + percona-postgresql-contrib percona-postgresql-server-dev-all + + - name: Change src owner to postgres + run: | + sudo chown -R postgres:postgres src + + - name: Build pg_stat_monitor + run: | + sudo -u postgres bash -c 'make USE_PGXS=1' + sudo make USE_PGXS=1 install + working-directory: src/pg_stat_monitor + + - name: Start pg_stat_monitor_tests + run: | + sudo service postgresql stop + echo "shared_preload_libraries = 'pg_stat_monitor'" | + sudo tee -a /etc/postgresql/14/main/postgresql.conf + sudo service postgresql start + sudo psql -V + export PG_TEST_PORT_DIR=${GITHUB_WORKSPACE}/src/pg_stat_monitor + echo $PG_TEST_PORT_DIR + sudo -E -u postgres bash -c 'make installcheck USE_PGXS=1' + 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 diff --git a/.github/workflows/postgresql-15-build.yml b/.github/workflows/postgresql-15-build.yml new file mode 100644 index 00000000..cf357041 --- /dev/null +++ b/.github/workflows/postgresql-15-build.yml @@ -0,0 +1,145 @@ +name: postgresql-15-build +on: [push] + +jobs: + build: + name: pg-15-build-test + runs-on: ubuntu-22.04 + steps: + - name: Clone postgres repository + uses: actions/checkout@v2 + with: + repository: 'postgres/postgres' + ref: 'REL_15_STABLE' + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt purge postgresql-client-common postgresql-common \ + postgresql postgresql* + sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \ + zlib1g-dev libssl-dev libpam0g-dev bison flex \ + libipc-run-perl -y docbook-xsl docbook-xsl libxml2 libxml2-utils \ + libxml2-dev libxslt-dev xsltproc libkrb5-dev libldap2-dev \ + libsystemd-dev gettext tcl-dev libperl-dev pkg-config clang-11 \ + llvm-11 llvm-11-dev libselinux1-dev python3-dev \ + uuid-dev liblz4-dev + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /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 Text::Trim' + + - 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' '--mandir=${prefix}/share/man' \ + '--infodir=${prefix}/share/info' '--sysconfdir=/etc' \ + '--localstatedir=/var' '--libdir=${prefix}/lib/x86_64-linux-gnu' \ + '--libexecdir=${prefix}/lib/x86_64-linux-gnu' '--with-icu' \ + '--with-tcl' '--with-perl' '--with-python' '--with-pam' \ + '--with-openssl' '--with-libxml' '--with-libxslt' '--with-ldap' \ + 'PYTHON=/usr/bin/python3' '--mandir=/usr/share/postgresql/15/man' \ + '--docdir=/usr/share/doc/postgresql-doc-15' '--with-pgport=5432' \ + '--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share' \ + '--datadir=/usr/share/postgresql/15' '--with-uuid=e2fs' \ + '--bindir=/usr/lib/postgresql/15/bin' '--enable-tap-tests' \ + '--libdir=/usr/lib/x86_64-linux-gnu' '--enable-debug' \ + '--libexecdir=/usr/lib/postgresql' '--with-gnu-ld' \ + '--includedir=/usr/include/postgresql' '--enable-dtrace' \ + '--enable-nls' '--enable-thread-safety' '--disable-rpath' \ + '--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' \ + 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now' \ + 'build_alias=x86_64-linux-gnu' '--with-gssapi' \ + 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' \ + 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer' \ + 'CXXFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security' + make world + sudo make install-world + + - name: Start postgresql cluster + run: | + export PATH="/usr/lib/postgresql/15/bin:$PATH" + sudo cp /usr/lib/postgresql/15/bin/pg_config /usr/bin + initdb -D /opt/pgsql/data + 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: | + 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: | + export PATH="/usr/lib/postgresql/15/bin:$PATH" + pg_ctl -D /opt/pgsql/data -l logfile stop + echo "shared_preload_libraries = 'pg_stat_monitor'" >> \ + /opt/pgsql/data/postgresql.conf + pg_ctl -D /opt/pgsql/data -l logfile start + working-directory: src/pg_stat_monitor + + - name: Start pg_stat_monitor_tests + run: | + make installcheck + 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 + + - name: Start Server installcheck-world tests + run: | + export PATH="/usr/lib/postgresql/15/bin:$PATH" + pg_ctl -D /opt/pgsql/data -l logfile stop + echo "compute_query_id = off" >> /opt/pgsql/data/postgresql.conf + pg_ctl -D /opt/pgsql/data -l logfile start + make installcheck-world + + - name: Report on installcheck-world test suites fail + uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: Regressions output files of failed testsuite, and pg log + path: | + **/regression.diffs + **/regression.out + src/pg_stat_monitor/logfile + retention-days: 3 diff --git a/.github/workflows/postgresql-15-pgdg-package.yml b/.github/workflows/postgresql-15-pgdg-package.yml new file mode 100644 index 00000000..0ba508f4 --- /dev/null +++ b/.github/workflows/postgresql-15-pgdg-package.yml @@ -0,0 +1,87 @@ +name: postgresql-15-pgdg-package +on: [pull_request] + +jobs: + build: + name: pg-15-pgdg-package-test + runs-on: ubuntu-22.04 + steps: + - name: Clone pg_stat_monitor repository + uses: actions/checkout@v2 + with: + path: 'src/pg_stat_monitor' + + - name: Delete old postgresql files + run: | + sudo apt-get update + sudo apt purge postgresql-client-common postgresql-common \ + postgresql postgresql* + sudo apt-get install -y libreadline6-dev systemtap-sdt-dev wget \ + zlib1g-dev libssl-dev libpam0g-dev bison flex libipc-run-perl + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /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 Text::Trim' + + - name: Install PG Distribution Postgresql 15 + run: | + sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt \ + $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' + sudo wget --quiet -O - \ + https://www.postgresql.org/media/keys/ACCC4CF8.asc | + sudo apt-key add - + sudo apt update + sudo apt -y install postgresql-15 postgresql-server-dev-15 + + - name: Change src owner to postgres + run: | + sudo chmod o+rx ~ + sudo chown -R postgres:postgres src + + - name: Build pg_stat_monitor + run: | + sudo -u postgres bash -c 'make USE_PGXS=1' + sudo make USE_PGXS=1 install + working-directory: src/pg_stat_monitor + + - name: Start pg_stat_monitor_tests + run: | + sudo service postgresql stop + echo "shared_preload_libraries = 'pg_stat_monitor'" | + sudo tee -a /etc/postgresql/15/main/postgresql.conf + sudo service postgresql start + sudo psql -V + export PG_TEST_PORT_DIR=${GITHUB_WORKSPACE}/src/pg_stat_monitor + echo $PG_TEST_PORT_DIR + sudo -E -u postgres bash -c 'make installcheck USE_PGXS=1' + 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 diff --git a/.github/workflows/postgresql-15-pmm.yaml b/.github/workflows/postgresql-15-pmm.yaml new file mode 100644 index 00000000..c621aaa7 --- /dev/null +++ b/.github/workflows/postgresql-15-pmm.yaml @@ -0,0 +1,41 @@ +name: postgresql-15-pmm-integration +on: [push] + +jobs: + build: + name: pg-15-pgsm-pmm-integration-test + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Clone QA Integration repository + uses: actions/checkout@v3 + with: + repository: 'Percona-Lab/qa-integration' + ref: 'main' + + # print branch and Repo name + - name: Get branch and Repo Name + run: echo 'The branch and Repo Name is' ${{ github.head_ref }} ${{ github.actor }}/pg_stat_monitor + + - name: "Set TARGET_BRANCH variable for a PR run" + if: github.event_name == 'pull_request' + run: echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV + + - name: "Set TARGET_BRANCH variable for a PUSH run" + if: github.event_name == 'push' + run: echo "TARGET_BRANCH=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Run PMM & PGSM Setup, E2E Tests + run: bash -xe ./pmm_pgsm_setup/pmm_pgsm_setup.sh --pgsql-version=15 --pgstat-monitor-branch=${{ env.TARGET_BRANCH }} + + - name: Get PMM-Agent Logs from the Container + if: success() || failure() # run this step even if previous step failed + run: docker exec pgsql_pgsm_15 cat pmm-agent.log > ./pmm-ui-tests/tests/output/pmm-agent.log + + - name: Upload Tests Artifacts + uses: actions/upload-artifact@v3 + if: success() || failure() # run this step even if previous step failed + with: + name: tests-artifact + path: ./pmm-ui-tests/tests/output/ + if-no-files-found: ignore # 'warn' or 'ignore' are also available, defaults to `warn` diff --git a/.github/workflows/postgresql-15-ppg-package.yml b/.github/workflows/postgresql-15-ppg-package.yml new file mode 100644 index 00000000..f105dbc9 --- /dev/null +++ b/.github/workflows/postgresql-15-ppg-package.yml @@ -0,0 +1,94 @@ +name: postgresql-15-ppg-package +on: [push] + +jobs: + build: + name: pg-15-ppg-package-test + runs-on: ubuntu-22.04 + steps: + - name: Clone pg_stat_monitor repository + uses: actions/checkout@v2 + with: + path: 'src/pg_stat_monitor' + + - name: Delete old postgresql files + run: | + sudo apt-get update + sudo apt purge postgresql-client-common postgresql-common \ + postgresql postgresql* + sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \ + zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \ + libipc-run-perl wget + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /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 Text::Trim' + + - name: Install percona-release script + run: | + sudo apt-get -y update + sudo apt-get -y upgrade + sudo apt-get install -y wget gnupg2 curl lsb-release + sudo wget \ + https://repo.percona.com/apt/percona-release_latest.generic_all.deb + sudo dpkg -i percona-release_latest.generic_all.deb + + - name: Install Percona Distribution Postgresql 15 + run: | + sudo percona-release setup ppg-15 + sudo apt-get update -y + sudo apt-get install -y percona-postgresql-15 \ + percona-postgresql-contrib percona-postgresql-server-dev-all + + - name: Change src owner to postgres + run: | + sudo chmod o+rx ~ + sudo chown -R postgres:postgres src + + - name: Build pg_stat_monitor + run: | + sudo -u postgres bash -c 'make USE_PGXS=1' + sudo make USE_PGXS=1 install + working-directory: src/pg_stat_monitor + + - name: Start pg_stat_monitor_tests + run: | + sudo service postgresql stop + echo "shared_preload_libraries = 'pg_stat_monitor'" | + sudo tee -a /etc/postgresql/15/main/postgresql.conf + sudo service postgresql start + sudo psql -V + export PG_TEST_PORT_DIR=${GITHUB_WORKSPACE}/src/pg_stat_monitor + echo $PG_TEST_PORT_DIR + sudo -E -u postgres bash -c 'make installcheck USE_PGXS=1' + 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 diff --git a/.github/workflows/postgresql-16-build.yml b/.github/workflows/postgresql-16-build.yml new file mode 100644 index 00000000..b92ae135 --- /dev/null +++ b/.github/workflows/postgresql-16-build.yml @@ -0,0 +1,145 @@ +name: postgresql-16-build +on: [push] + +jobs: + build: + name: pg-16-build-test + runs-on: ubuntu-22.04 + steps: + - name: Clone postgres repository + uses: actions/checkout@v2 + with: + repository: 'postgres/postgres' + ref: 'REL_16_STABLE' + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt purge postgresql-client-common postgresql-common \ + postgresql postgresql* + sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \ + zlib1g-dev libssl-dev libpam0g-dev bison flex \ + libipc-run-perl -y docbook-xsl docbook-xsl libxml2 libxml2-utils \ + libxml2-dev libxslt-dev xsltproc libkrb5-dev libldap2-dev \ + libsystemd-dev gettext tcl-dev libperl-dev pkg-config clang-11 \ + llvm-11 llvm-11-dev libselinux1-dev python3-dev \ + uuid-dev liblz4-dev + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /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 Text::Trim' + + - 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' '--mandir=${prefix}/share/man' \ + '--infodir=${prefix}/share/info' '--sysconfdir=/etc' \ + '--localstatedir=/var' '--libdir=${prefix}/lib/x86_64-linux-gnu' \ + '--libexecdir=${prefix}/lib/x86_64-linux-gnu' '--with-icu' \ + '--with-tcl' '--with-perl' '--with-python' '--with-pam' \ + '--with-openssl' '--with-libxml' '--with-libxslt' '--with-ldap' \ + 'PYTHON=/usr/bin/python3' '--mandir=/usr/share/postgresql/16/man' \ + '--docdir=/usr/share/doc/postgresql-doc-16' '--with-pgport=5432' \ + '--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share' \ + '--datadir=/usr/share/postgresql/16' '--with-uuid=e2fs' \ + '--bindir=/usr/lib/postgresql/16/bin' '--enable-tap-tests' \ + '--libdir=/usr/lib/x86_64-linux-gnu' '--enable-debug' \ + '--libexecdir=/usr/lib/postgresql' '--with-gnu-ld' \ + '--includedir=/usr/include/postgresql' '--enable-dtrace' \ + '--enable-nls' '--enable-thread-safety' '--disable-rpath' \ + '--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' \ + 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now' \ + 'build_alias=x86_64-linux-gnu' '--with-gssapi' \ + 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' \ + 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer' \ + 'CXXFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security' + make world + sudo make install-world + + - name: Start postgresql cluster + run: | + export PATH="/usr/lib/postgresql/16/bin:$PATH" + sudo cp /usr/lib/postgresql/16/bin/pg_config /usr/bin + initdb -D /opt/pgsql/data + 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: | + 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: | + export PATH="/usr/lib/postgresql/16/bin:$PATH" + pg_ctl -D /opt/pgsql/data -l logfile stop + echo "shared_preload_libraries = 'pg_stat_monitor'" >> \ + /opt/pgsql/data/postgresql.conf + pg_ctl -D /opt/pgsql/data -l logfile start + working-directory: src/pg_stat_monitor + + - name: Start pg_stat_monitor_tests + run: | + make installcheck + 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 + + - name: Start Server installcheck-world tests + run: | + export PATH="/usr/lib/postgresql/16/bin:$PATH" + pg_ctl -D /opt/pgsql/data -l logfile stop + echo "compute_query_id = off" >> /opt/pgsql/data/postgresql.conf + pg_ctl -D /opt/pgsql/data -l logfile start + make installcheck-world + + - name: Report on installcheck-world test suites fail + uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: Regressions output files of failed testsuite, and pg log + path: | + **/regression.diffs + **/regression.out + src/pg_stat_monitor/logfile + retention-days: 3 diff --git a/.github/workflows/postgresql-16-pgdg-package.yml b/.github/workflows/postgresql-16-pgdg-package.yml new file mode 100644 index 00000000..85a82c9f --- /dev/null +++ b/.github/workflows/postgresql-16-pgdg-package.yml @@ -0,0 +1,87 @@ +name: postgresql-16-pgdg-package +on: [pull_request] + +jobs: + build: + name: pg-16-pgdg-package-test + runs-on: ubuntu-22.04 + steps: + - name: Clone pg_stat_monitor repository + uses: actions/checkout@v2 + with: + path: 'src/pg_stat_monitor' + + - name: Delete old postgresql files + run: | + sudo apt-get update + sudo apt purge postgresql-client-common postgresql-common \ + postgresql postgresql* + sudo apt-get install -y libreadline6-dev systemtap-sdt-dev wget \ + zlib1g-dev libssl-dev libpam0g-dev bison flex libipc-run-perl + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /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 Text::Trim' + + - name: Install PG Distribution Postgresql 16 + run: | + sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt \ + $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' + sudo wget --quiet -O - \ + https://www.postgresql.org/media/keys/ACCC4CF8.asc | + sudo apt-key add - + sudo apt update + sudo apt -y install postgresql-16 postgresql-server-dev-16 + + - name: Change src owner to postgres + run: | + sudo chmod o+rx ~ + sudo chown -R postgres:postgres src + + - name: Build pg_stat_monitor + run: | + sudo -u postgres bash -c 'make USE_PGXS=1' + sudo make USE_PGXS=1 install + working-directory: src/pg_stat_monitor + + - name: Start pg_stat_monitor_tests + run: | + sudo service postgresql stop + echo "shared_preload_libraries = 'pg_stat_monitor'" | + sudo tee -a /etc/postgresql/16/main/postgresql.conf + sudo service postgresql start + sudo psql -V + export PG_TEST_PORT_DIR=${GITHUB_WORKSPACE}/src/pg_stat_monitor + echo $PG_TEST_PORT_DIR + sudo -E -u postgres bash -c 'make installcheck USE_PGXS=1' + 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 diff --git a/.github/workflows/postgresql-16-ppg-package.yml b/.github/workflows/postgresql-16-ppg-package.yml new file mode 100644 index 00000000..eb4807eb --- /dev/null +++ b/.github/workflows/postgresql-16-ppg-package.yml @@ -0,0 +1,94 @@ +name: postgresql-16-ppg-package +on: [push] + +jobs: + build: + name: pg-16-ppg-package-test + runs-on: ubuntu-22.04 + steps: + - name: Clone pg_stat_monitor repository + uses: actions/checkout@v2 + with: + path: 'src/pg_stat_monitor' + + - name: Delete old postgresql files + run: | + sudo apt-get update + sudo apt purge postgresql-client-common postgresql-common \ + postgresql postgresql* + sudo apt-get install -y libreadline6-dev systemtap-sdt-dev \ + zlib1g-dev libssl-dev libpam0g-dev python3-dev bison flex \ + libipc-run-perl wget + sudo rm -rf /var/lib/postgresql /var/log/postgresql /etc/postgresql \ + /usr/lib/postgresql /usr/include/postgresql /usr/share/postgresql \ + /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 Text::Trim' + + - name: Install percona-release script + run: | + sudo apt-get -y update + sudo apt-get -y upgrade + sudo apt-get install -y wget gnupg2 curl lsb-release + sudo wget \ + https://repo.percona.com/apt/percona-release_latest.generic_all.deb + sudo dpkg -i percona-release_latest.generic_all.deb + + - name: Install Percona Distribution Postgresql 16 + run: | + sudo percona-release setup ppg-16 + sudo apt-get update -y + sudo apt-get install -y percona-postgresql-16 \ + percona-postgresql-contrib percona-postgresql-server-dev-all + + - name: Change src owner to postgres + run: | + sudo chmod o+rx ~ + sudo chown -R postgres:postgres src + + - name: Build pg_stat_monitor + run: | + sudo -u postgres bash -c 'make USE_PGXS=1' + sudo make USE_PGXS=1 install + working-directory: src/pg_stat_monitor + + - name: Start pg_stat_monitor_tests + run: | + sudo service postgresql stop + echo "shared_preload_libraries = 'pg_stat_monitor'" | + sudo tee -a /etc/postgresql/16/main/postgresql.conf + sudo service postgresql start + sudo psql -V + export PG_TEST_PORT_DIR=${GITHUB_WORKSPACE}/src/pg_stat_monitor + echo $PG_TEST_PORT_DIR + sudo -E -u postgres bash -c 'make installcheck USE_PGXS=1' + 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