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
- Host: GitHub
- URL: https://github.com/ankane/setup-postgres
- Owner: ankane
- License: mit
- Created: 2020-11-11T03:22:23.000Z (about 5 years ago)
- Default Branch: v1
- Last Pushed: 2025-11-14T19:20:41.000Z (24 days ago)
- Last Synced: 2025-11-14T21:21:59.289Z (24 days ago)
- Language: JavaScript
- Homepage:
- Size: 71.3 KB
- Stars: 52
- Watchers: 2
- Forks: 9
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- jimsghstars - ankane/setup-postgres - The missing action for Postgres (JavaScript)
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
[](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