Home

Awesome

setup-postgres

The missing action for Postgres :tada:

Build Status

Getting Started

Add it as a step to your workflow

      - uses: ankane/setup-postgres@v1

Versions

Specify a version

      - uses: ankane/setup-postgres@v1
        with:
          postgres-version: 17

Currently supports

Version171615141312
Ubuntu 24.04default
Ubuntu (rest)default
Macdefault
Windowsdefault

Test against multiple versions

    strategy:
      matrix:
        postgres-version: [17, 16, 15, 14, 13]
    steps:
      - uses: ankane/setup-postgres@v1
        with:
          postgres-version: ${{ matrix.postgres-version }}

Options

Create a database

      - uses: ankane/setup-postgres@v1
        with:
          database: testdb

Set postgresql.conf config

      - uses: ankane/setup-postgres@v1
        with:
          config: |
            shared_preload_libraries = 'pg_stat_statements'

Install development files (for building extensions)

      - uses: ankane/setup-postgres@v1
        with:
          dev-files: true

Extra Steps

Run queries

      - run: psql -d testdb -c 'SHOW server_version'

Related Actions

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help: