Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Reusable build and test
on:
workflow_call:
inputs:
pg_package:
type: string
required: true
pg_version:
type: string
required: true
os:
type: string
required: true
compiler:
type: string
required: true
build_type:
type: string
required: true

env:
PG_PACKAGE: ${{ inputs.pg_package }}
PG_VERSION: ${{ inputs.pg_version }}
OS: ${{ inputs.os }}
CC: ${{ inputs.compiler }}
BUILD_TYPE: ${{ inputs.build_type }}

jobs:
build:
name: Build
runs-on: ${{ inputs.os }}
timeout-minutes: 10
steps:
- name: Remove existing PostgreSQL
if: startsWith(inputs.os, 'ubuntu-')
run: sudo apt purge postgresql* libpq*

- name: Clone repository
uses: actions/checkout@v5
with:
submodules: recursive
ref: ${{ github.ref }}

- name: Install dependencies for Ubuntu
if: startsWith(inputs.os, 'ubuntu-')
run: ci_scripts/ubuntu-deps.sh

- name: Install dependencies for MacOS
if: startsWith(inputs.os, 'macos-')
run: ci_scripts/macos-deps.sh

- name: Install PostgreSQL
run: ci_scripts/install-postgresql.sh ${{ env.PG_PACKAGE }} ${{ env.PG_VERSION }}

- name: Build pg_stat_monitor
run: ci_scripts/build.sh ${{ env.BUILD_TYPE }}

- name: Set permissions
if: startsWith(inputs.os, 'ubuntu-')
run: sudo chown -R runner:runner /var/run/postgresql

- name: Stop existing PostgreSQL instances
if: startsWith(inputs.os, 'ubuntu-')
run: sudo service postgresql stop

- name: Run tests
run: ci_scripts/test.sh ${{ env.BUILD_TYPE }}

- name: Report on test fail
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: log-test-${{ env.PG_PACKAGE }}-${{ env.PG_VERSION }}-${{ env.OS }}-${{ env.CC }}-${{ env.BUILD_TYPE }}
path: |
regression_install
regression_install.log
regression.diffs
regression.out
results
t/results
tmp_check
retention-days: 3
94 changes: 30 additions & 64 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,84 +1,50 @@
name: Checks
name: Check
on:
pull_request:

jobs:
cppcheck:
name: Cppcheck
runs-on: ubuntu-22.04
timeout-minutes: 5

steps:
- name: Checkout sources
uses: actions/checkout@v6
with:
path: src/pg_stat_monitor

- name: Checkout cppcheck sources
uses: actions/checkout@v6
with:
repository: "danmar/cppcheck"
ref: "2.13.4"
path: src/cppcheck

- name: Build and install cppcheck
working-directory: src/cppcheck
run: |
mkdir build
cd build
cmake ..
cmake --build .
sudo cmake --install .

- name: Execute linter check with cppcheck
working-directory: src/pg_stat_monitor
run: |
set -x
cppcheck --enable=all --inline-suppr --template='{file}:{line},{severity},{id},{message}' --error-exitcode=1 --suppress=missingIncludeSystem --suppress=unmatchedSuppression:pg_stat_monitor.c --check-config .
env:
PG_VERSION: 18

jobs:
format:
name: Format
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
timeout-minutes: 5

steps:
- name: Clone postgres repository
uses: actions/checkout@v6
- name: Remove existing PostgreSQL
run: sudo apt purge postgresql* libpq*

- name: Clone repository
uses: actions/checkout@v5
with:
repository: 'postgres/postgres'
ref: 'REL_17_STABLE'
submodules: recursive
path: src
ref: ${{ github.ref }}

- name: Checkout sources
uses: actions/checkout@v6
- name: Clone postgres repository
uses: actions/checkout@v5
with:
path: 'contrib/pg_stat_monitor'
path: postgres
repository: percona/postgres.git
ref: PSP_REL_${{ env.PG_VERSION }}_STABLE

- name: Configure postgres
run: ./configure
- name: Install dependencies
run: src/ci_scripts/ubuntu-deps.sh dev

- name: Install perltidy
run: sudo cpan -T SHANCOCK/Perl-Tidy-20230309.tar.gz
- name: Build and install PostgreSQL
run: src/ci_scripts/build-postgres.sh debug

- name: Install pg_bsd_indent
working-directory: src/tools/pg_bsd_indent
run: sudo make install
- name: Build pg_stat_monitor
run: src/ci_scripts/build.sh debug

- name: Add pg_bsd_indent and pgindent to path
run: |
echo "/usr/local/pgsql/bin" >> $GITHUB_PATH
echo "${{ github.workspace }}/src/tools/pgindent" >> $GITHUB_PATH
- name: Update typedefs
run: src/ci_scripts/dump-typedefs.sh

- name: Format sources
working-directory: contrib/pg_stat_monitor
run: |
make update-typedefs
make indent
- name: Run pgindent
run: src/ci_scripts/run-pgindent.sh --check --diff

- name: Check files are formatted and no source code changes
working-directory: contrib/pg_stat_monitor
run: |
git status
git diff --exit-code
- name: Run pgperltidy
run: src/ci_scripts/run-pgperltidy.sh --assert-tidy --standard-error-output

license:
name: License
Expand Down
149 changes: 0 additions & 149 deletions .github/workflows/code-coverage-test.yml

This file was deleted.

Loading
Loading