DEV Community

Ihor Kalnytskyi
Ihor Kalnytskyi

Posted on • Originally published at kalnytskyi.com on

Setup PostgreSQL for Linux, Windows and macOS using GitHub Actions

GitHub Actions is a CI/CD platform that is widely used among open-source software hosted on GitHub. If you happened to host your software there, you may end up needing a SQL server to test your application. PostgreSQL is the most common choice nowadays.

As of today (Nov 24, 2021), there's only one action on the marketplace to setup a PostgreSQL server for Linux, Windows and macOS action runners. If you among those who want to test their software on all major platforms, you have no option but to use ikalnytskyi/action-setup-postgres. Below is the typical usage example:

steps:
  - name: Setup PostgreSQL
    uses: ikalnytskyi/action-setup-postgres@v1
    id: postgres

  - name: Run tests
    env:
      CONNECTION_URI: ${{ steps.postgres.outputs.connection-uri }}
    run: pytest -vv tests/
Enter fullscreen mode Exit fullscreen mode

So why use that exact action and no other?

  • Runs on Linux, macOS and Windows action runners.
  • Fast! Preinstalled binaries are used.
  • Easy to audit, just 4 steps YAML!

Top comments (0)