Add postgres repositories #26
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: Test | |
| on: | |
| push: | |
| branches: ["**"] | |
| pull_request: | |
| branches: ["master"] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| strategy: | |
| matrix: | |
| pg_version: [12, 13, 14, 15, 16, 17] | |
| os: [ubuntu-22.04] | |
| build: [automake, meson] | |
| tests: [sql] | |
| fail-fast: false | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ubuntu:22.04 # main job container | |
| options: --user root | |
| services: | |
| postgres: | |
| image: postgres:${{ matrix.pg_version }} | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| # Checkout shared_ispell | |
| - name: Checkout shared_ispell | |
| uses: actions/checkout@v3 | |
| # Install build tools and headers | |
| - name: Install build tools and PostgreSQL dev headers | |
| run: | | |
| apt-get update | |
| apt-get install -y wget gnupg lsb-release | |
| # Add PostgreSQL APT repo | |
| echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" \ | |
| > /etc/apt/sources.list.d/pgdg.list | |
| wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - | |
| apt-get update | |
| # Install everything | |
| apt-get install -y \ | |
| build-essential automake meson ninja-build pkg-config libxml2-dev \ | |
| postgresql-server-dev-${{ matrix.pg_version }} | |
| # Set PG_CONFIG to container's Postgres | |
| - name: Set PG_CONFIG | |
| run: echo "PG_CONFIG=$(which pg_config)" >> $GITHUB_ENV | |
| # Build shared_ispell (automake) | |
| - name: Build (automake) | |
| if: matrix.build == 'automake' | |
| run: | | |
| make USE_PGXS=1 | |
| make USE_PGXS=1 install | |
| # Build shared_ispell (meson) | |
| - name: Build (meson) | |
| if: matrix.build == 'meson' | |
| run: | | |
| PREFIX=$($PG_CONFIG --pgxs | sed 's|/lib/pgxs/src/makefiles/pgxs.mk||') | |
| meson setup builddir --prefix=$PREFIX | |
| meson compile -C builddir | |
| meson install -C builddir | |
| # Create extension | |
| - name: Create extension | |
| run: | | |
| export PGUSER=postgres | |
| export PGPASSWORD=postgres | |
| createdb -h localhost -p 5432 test | |
| psql -h localhost -p 5432 -U postgres -d test -c "CREATE EXTENSION shared_ispell;" | |
| # Run SQL tests | |
| - name: Run SQL tests | |
| run: | | |
| export PGUSER=postgres | |
| export PGPASSWORD=postgres | |
| for f in sql/*.sql; do | |
| echo "Running $f" | |
| psql -h localhost -p 5432 -U postgres -d test -f "$f" | |
| done | |