Version new #51
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| branches: ["main", "chore/**", "feature/**", "fix/**"] | |
| pull_request: | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| env: | |
| PGHOST: localhost | |
| PGPORT: 5432 | |
| PGUSER: postgres | |
| PGDATABASE: postgres | |
| PGPASSWORD: postgres | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: postgres | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --name pgtools-postgres-ci | |
| --health-cmd "pg_isready -U postgres" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y shellcheck jq postgresql-client | |
| - name: Wait for PostgreSQL | |
| run: | | |
| for i in {1..10}; do | |
| if pg_isready -h "$PGHOST" -p "$PGPORT" -U "$PGUSER"; then | |
| exit 0 | |
| fi | |
| sleep 2 | |
| done | |
| echo "PostgreSQL did not become ready in time" >&2 | |
| exit 1 | |
| - name: Enable pg_stat_statements | |
| run: | | |
| psql -c "CREATE EXTENSION IF NOT EXISTS pg_stat_statements;" | |
| psql -c "SELECT extname FROM pg_extension WHERE extname = 'pg_stat_statements';" | |
| - name: Configure preload and restart PostgreSQL | |
| run: | | |
| psql -c "ALTER SYSTEM SET shared_preload_libraries = 'pg_stat_statements';" | |
| docker restart pgtools-postgres-ci | |
| for i in {1..30}; do | |
| if pg_isready -h "$PGHOST" -p "$PGPORT" -U "$PGUSER"; then | |
| break | |
| fi | |
| sleep 2 | |
| done | |
| if ! pg_isready -h "$PGHOST" -p "$PGPORT" -U "$PGUSER"; then | |
| echo "PostgreSQL did not become ready after restart" >&2 | |
| exit 1 | |
| fi | |
| psql -tA -c "SHOW shared_preload_libraries;" | grep -q "pg_stat_statements" | |
| psql -c "SELECT extname FROM pg_extension WHERE extname = 'pg_stat_statements';" | |
| - name: ShellCheck all shell scripts | |
| run: | | |
| shellcheck \ | |
| automation/*.sh \ | |
| integration/*.sh \ | |
| configuration/*.sh \ | |
| maintenance/*.sh \ | |
| scripts/*.sh | |
| - name: Fast automation test suite | |
| run: ./automation/test_pgtools.sh --fast | |
| - name: HOT checklist JSON validation | |
| run: ./automation/run_hot_update_report.sh --format json --database "$PGDATABASE" --stdout | |
| - name: HOT checklist text validation | |
| run: ./automation/run_hot_update_report.sh --format text --database "$PGDATABASE" --stdout |