An open API service indexing awesome lists of open source software.

https://github.com/ankane/setup-postgres

The missing action for Postgres
https://github.com/ankane/setup-postgres

Last synced: 22 days ago
JSON representation

The missing action for Postgres

Awesome Lists containing this project

README

          

# setup-postgres

The missing action for Postgres :tada:

- Faster (with the default version) and simpler than containers
- Works on Linux, Mac, and Windows
- Supports different versions

[![Build Status](https://github.com/ankane/setup-postgres/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/setup-postgres/actions)

## Getting Started

Add it as a step to your workflow

```yml
- uses: ankane/setup-postgres@v1
```

The default credentials are:

- user: `runner` (the OS user) on Linux and Mac, `postgres` on Windows
- password: none
- host: `localhost` or socket
- port: `5432`

## Versions

Specify a version

```yml
- uses: ankane/setup-postgres@v1
with:
postgres-version: 18
```

Currently supports

Version | `18` | `17` | `16` | `15` | `14` | `13`
--- | --- | --- | --- | --- | --- | ---
`ubuntu-24.04` | ✓ | ✓ | default | ✓ | ✓ | ✓
`ubuntu-24.04-arm` | ✓ | ✓ | default | ✓ | ✓ | ✓
`ubuntu-22.04` | ✓ | ✓ | ✓ | ✓ | default | ✓
`ubuntu-22.04-arm` | ✓ | ✓ | ✓ | ✓ | default | ✓
`macos-26` | ✓ | default | ✓ | ✓ | ✓ | ✓
`macos-15` | ✓ | default | ✓ | ✓ | ✓ | ✓
`macos-15-intel` | ✓ | default | ✓ | ✓ | ✓ | ✓
`macos-14` | ✓ | default | ✓ | ✓ | ✓ | ✓
`macos-13` | | default | ✓ | ✓ | ✓ | ✓
`windows-2025` | | default | | | | |
`windows-2022` | | | | | default | |

Test against multiple versions

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

## Options

Create a database

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

Specify a user

```yml
- uses: ankane/setup-postgres@v1
with:
user: testuser
```

Set `postgresql.conf` config

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

Install development files (for building extensions)

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

## Extra Steps

Run queries

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

## Related Actions

- [setup-mysql](https://github.com/ankane/setup-mysql)
- [setup-mariadb](https://github.com/ankane/setup-mariadb)
- [setup-mongodb](https://github.com/ankane/setup-mongodb)
- [setup-elasticsearch](https://github.com/ankane/setup-elasticsearch)
- [setup-opensearch](https://github.com/ankane/setup-opensearch)
- [setup-sqlserver](https://github.com/ankane/setup-sqlserver)

## Contributing

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

- [Report bugs](https://github.com/ankane/setup-postgres/issues)
- Fix bugs and [submit pull requests](https://github.com/ankane/setup-postgres/pulls)
- Write, clarify, or fix documentation
- Suggest or add new features