File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 3030 python3 -m pytest -vv test_action.py
3131 env :
3232 CONNECTION_URI : ${{ steps.postgres.outputs.connection-uri }}
33- EXPECTED_CONNECTION_URI : postgresql://postgres:postgres@localhost/postgres
33+ EXPECTED_CONNECTION_URI : postgresql://postgres:postgres@localhost:5432 /postgres
3434 shell : bash
3535
3636 parametrized :
@@ -50,13 +50,15 @@ jobs:
5050 username : yoda
5151 password : GrandMaster
5252 database : jedi_order
53+ port : 34837
5354 id : postgres
5455
5556 - name : Run tests
5657 run : |
5758 python3 -m pip install --upgrade pip pytest psycopg
5859 python3 -m pytest -vv test_action.py
5960 env :
61+ PGPORT : 34837
6062 CONNECTION_URI : ${{ steps.postgres.outputs.connection-uri }}
61- EXPECTED_CONNECTION_URI : postgresql://yoda:GrandMaster@localhost/jedi_order
63+ EXPECTED_CONNECTION_URI : postgresql://yoda:GrandMaster@localhost:34837 /jedi_order
6264 shell : bash
Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ inputs:
1717 description : The database name to setup and grant permissions to created user.
1818 default : postgres
1919 required : false
20+ port :
21+ description : The server port.
22+ default : 5432
23+ required : false
2024outputs :
2125 connection-uri :
2226 description : The connection URI to connect to PostgreSQL.
4347 # Forbid creating unix sockets since they are created by default in the
4448 # directory we don't have permissions to.
4549 echo "unix_socket_directories = ''" >> "$PGDATA/postgresql.conf"
50+ echo "port = ${{ inputs.port }}" >> "$PGDATA/postgresql.conf"
4651 pg_ctl start
4752
4853 # Both PGHOST and PGUSER are used by PostgreSQL tooling such as 'psql'
5762 # the current user.
5863 echo "PGHOST=localhost" >> $GITHUB_ENV
5964 echo "PGUSER=${USER:-$USERNAME}" >> $GITHUB_ENV
65+ echo "PGPORT=${{ inputs.port }}" >> $GITHUB_ENV
6066 shell : bash
6167
6268 - name : Setup PostgreSQL user and database
7278
7379 - name : Expose connection URI
7480 run : |
75- CONNECTION_URI="postgresql://${{ inputs.username }}:${{ inputs.password }}@localhost/${{ inputs.database }}"
81+ CONNECTION_URI="postgresql://${{ inputs.username }}:${{ inputs.password }}@localhost:${{inputs.port}} /${{ inputs.database }}"
7682 echo ::set-output name=value::$CONNECTION_URI
7783 shell : bash
7884 id : connection-uri
You can’t perform that action at this time.
0 commit comments