GitHub - ankane/setup-postgres: The missing action for Postgres
The missing action for Postgres ๐
- Faster (with the default version) and simpler than containers
- Works on Linux, Mac, and Windows
- Supports different versions
Getting Started
Add it as a step to your workflow
- uses: ankane/setup-postgres@v1
The default credentials are:
- user:
runner(the OS user) on Linux and Mac,postgreson Windows - password: none
- host:
localhostor socket - port:
5432
Versions
Specify a version
- uses: ankane/setup-postgres@v1 with: postgres-version: 18
Currently supports
| Version | 18 |
17 |
16 |
15 |
14 |
|---|---|---|---|---|---|
ubuntu-26.04 |
default | โ | โ | โ | โ |
ubuntu-26.04-arm |
default | โ | โ | โ | โ |
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 | โ | โ | โ |
windows-2025 |
default | ||||
windows-2022 |
default |
Test against multiple versions
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
- uses: ankane/setup-postgres@v1 with: database: testdb
Specify a user
- uses: ankane/setup-postgres@v1 with: user: testuser
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:
- Report bugs
- Fix bugs and submit pull requests
- Write, clarify, or fix documentation
- Suggest or add new features