From 95f0ca216dff246dbcefd897ecef8f63ef297680 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Fri, 10 Sep 2021 18:18:58 +0300 Subject: [PATCH] CI(GHActions): Setup PostgreSQL using `ankane/setup-postgres@v1` This action sets up Postgres on any OS. It also creates the `runner` user and configures trusted access without password. --- .github/workflows/run-tests.yaml | 12 +----------- tox.ini | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index cd07729..0f928d2 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -14,17 +14,7 @@ jobs: steps: - # Use preinstalled PostgreSQL - - name: Start PostgreSQL on Ubuntu - run: | - sudo systemctl start postgresql - pg_isready - - name: Create user - run: | - echo 'localhost:*:test:runner:test' > ~/.pgpass - chmod u=rw,go= ~/.pgpass - sudo -u postgres psql --command="CREATE USER runner CREATEDB ENCRYPTED PASSWORD 'test'" - + - uses: ankane/setup-postgres@v1 - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: diff --git a/tox.ini b/tox.ini index 3d9cf96..fa79032 100644 --- a/tox.ini +++ b/tox.ini @@ -58,7 +58,7 @@ commands = {[testenv]commands} -dropdb --username=runner test createdb --username=runner test - {envpython} -m pytest -D postgres://runner:test@localhost/test + {envpython} -m pytest -D postgres://runner@localhost/test dropdb --username=runner test [testenv:{py27,py34,py35,py36,py37,py38,py39}-postgres-w32] -- 2.39.2