]> git.phdru.name Git - sqlconvert.git/commitdiff
CI(GHActions): Setup PostgreSQL using `ankane/setup-postgres@v1`
authorOleg Broytman <phd@phdru.name>
Fri, 10 Sep 2021 15:18:58 +0000 (18:18 +0300)
committerOleg Broytman <phd@phdru.name>
Fri, 10 Sep 2021 15:20:01 +0000 (18:20 +0300)
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
tox.ini

index cd07729bc905d93f81a07150ec5ce6204d1d160e..0f928d21b75771653b51c14b29b3d7b50655301e 100644 (file)
@@ -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 3d9cf96fda05e1364c0a730c4dac11f2f2f92629..fa79032a250d5aa6cf3f10032646cb7d33461132 100644 (file)
--- 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]