Skip to content

Commit 686f201

Browse files
committed
Debug
1 parent 6bb2488 commit 686f201

File tree

2 files changed

+78
-65
lines changed

2 files changed

+78
-65
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
pull_request:
77
branches: [ master ]
88
schedule:
9-
- cron: "0 8 * * *"
9+
- cron: "@weekly"
1010

1111
defaults:
1212
run:
@@ -18,13 +18,13 @@ jobs:
1818
strategy:
1919
matrix:
2020
os:
21-
- ubuntu-20.04
22-
- ubuntu-22.04
23-
- ubuntu-24.04
24-
- macos-12
25-
- macos-13
26-
- macos-14 # M1 CPU
27-
- windows-2019
21+
# - ubuntu-20.04
22+
# - ubuntu-22.04
23+
# - ubuntu-24.04
24+
# - macos-12
25+
# - macos-13
26+
# - macos-14
27+
# - windows-2019
2828
- windows-2022
2929
steps:
3030
- uses: actions/checkout@v4
@@ -49,43 +49,43 @@ jobs:
4949
EXPECTED_SERVICE_NAME: postgres
5050
EXPECTED_SERVER_VERSION: "16"
5151

52-
parametrized:
53-
runs-on: ${{ matrix.os }}
54-
strategy:
55-
matrix:
56-
os:
57-
- ubuntu-latest
58-
- macos-latest
59-
- windows-latest
60-
postgres-version:
61-
- "13"
62-
- "14"
63-
- "15"
64-
steps:
65-
- uses: actions/checkout@v4
66-
67-
- name: Run setup-postgres
68-
uses: ./
69-
with:
70-
username: yoda
71-
password: GrandMaster
72-
database: jedi_order
73-
port: 34837
74-
postgres-version: ${{ matrix.postgres-version }}
75-
id: postgres
76-
77-
- name: Run setup-python
78-
uses: actions/setup-python@v5
79-
with:
80-
python-version: "3.10"
81-
82-
- name: Run tests
83-
run: |
84-
python3 -m pip install --upgrade pip pytest psycopg furl
85-
python3 -m pytest -vv test_action.py
86-
env:
87-
CONNECTION_URI: ${{ steps.postgres.outputs.connection-uri }}
88-
SERVICE_NAME: ${{ steps.postgres.outputs.service-name }}
89-
EXPECTED_CONNECTION_URI: postgresql://yoda:GrandMaster@localhost:34837/jedi_order
90-
EXPECTED_SERVICE_NAME: yoda
91-
EXPECTED_SERVER_VERSION: ${{ matrix.postgres-version }}
52+
# parametrized:
53+
# runs-on: ${{ matrix.os }}
54+
# strategy:
55+
# matrix:
56+
# os:
57+
# - ubuntu-latest
58+
# - macos-latest
59+
# - windows-latest
60+
# postgres-version:
61+
# - "13"
62+
# - "14"
63+
# - "15"
64+
# steps:
65+
# - uses: actions/checkout@v4
66+
#
67+
# - name: Run setup-postgres
68+
# uses: ./
69+
# with:
70+
# username: yoda
71+
# password: GrandMaster
72+
# database: jedi_order
73+
# port: 34837
74+
# postgres-version: ${{ matrix.postgres-version }}
75+
# id: postgres
76+
#
77+
# - name: Run setup-python
78+
# uses: actions/setup-python@v5
79+
# with:
80+
# python-version: "3.10"
81+
#
82+
# - name: Run tests
83+
# run: |
84+
# python3 -m pip install --upgrade pip pytest psycopg furl
85+
# python3 -m pytest -vv test_action.py
86+
# env:
87+
# CONNECTION_URI: ${{ steps.postgres.outputs.connection-uri }}
88+
# SERVICE_NAME: ${{ steps.postgres.outputs.service-name }}
89+
# EXPECTED_CONNECTION_URI: postgresql://yoda:GrandMaster@localhost:34837/jedi_order
90+
# EXPECTED_SERVICE_NAME: yoda
91+
# EXPECTED_SERVER_VERSION: ${{ matrix.postgres-version }}

action.yml

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,40 +35,50 @@ outputs:
3535
runs:
3636
using: composite
3737
steps:
38-
- name: Cache PostgreSQL installation packages
39-
uses: actions/cache@v3
38+
# - name: Cache PostgreSQL installation packages
39+
# uses: actions/cache@v3
40+
# with:
41+
# key: ${{ runner.os }}-postgres-${{ inputs.postgres-version }}
42+
# path: |
43+
# /var/cache/apt/archives
44+
# C:\Users\<username>\AppData\Local\Temp\chocolatey
45+
46+
- uses: mxschmitt/action-tmate@v3
4047
with:
41-
key: ${{ runner.os }}-postgres-${{ inputs.postgres-version }}
42-
path: |
43-
/var/cache/apt/archives
44-
C:\Users\<username>\AppData\Local\Temp\chocolatey
48+
limit-access-to-actor: false
4549

4650
- name: Install PostgreSQL
4751
run: |
52+
if [[ ! "${{ inputs.postgres-version }}" =~ ^(13|14|15|16)$ ]]; then
53+
echo "::error::postgres-version must be one of: 13, 14, 15, 16."
54+
exit 1
55+
fi
56+
4857
if [ "$RUNNER_OS" == "Linux" ]; then
49-
echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" \
50-
| sudo tee /etc/apt/sources.list.d/pgdg.list
51-
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
58+
APT_ENTRY="deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main"
59+
APT_KEY="https://www.postgresql.org/media/keys/ACCC4CF8.asc"
60+
61+
echo "$APT_ENTRY" | sudo tee /etc/apt/sources.list.d/pgdg.list
62+
wget --quiet -O - "$APT_KEY" | sudo apt-key add -
5263
sudo apt-get update
5364
sudo apt-get -y install postgresql-${{ inputs.postgres-version }}
5465
55-
# Add PostgreSQL binaries to PATH, so they become globally available.
5666
/usr/lib/postgresql/${{ inputs.postgres-version }}/bin/pg_config --bindir >> $GITHUB_PATH
57-
elif [ "$RUNNER_OS" == "Windows" ]; then
58-
echo "$PGBIN" >> $GITHUB_PATH
59-
echo "PQ_LIB_DIR=$PGROOT\lib" >> $GITHUB_ENV
6067
68+
elif [ "$RUNNER_OS" == "Windows" ]; then
6169
# The Windows runner has some PostgreSQL environment variables set
6270
# that may confuse users since they may be irrelevant to the
63-
# PostgreSQL server we're using.
71+
# PostgreSQL server we're using. Since GitHub actions does not
72+
# support unsetting environment variables, the best we can do is to
73+
# clear their values in order to indicate they must not be used.
6474
for name in "PGROOT" "PGDATA" "PGBIN" "PGUSER" "PGPASSWORD"; do
6575
echo "$name=" >> $GITHUB_ENV
6676
done
6777
6878
# FIXME: Aargh! For reasons unknown the '--servicename' option is
69-
# ignored when installing a PostgreSQL version that is already
70-
# preinstalled on GitHub runners. In order to bypass the issue I'm
71-
# using default naming convention to overwrite the service name.
79+
# ignored when installing a PostgreSQL version that come preinstalled
80+
# on the GitHub runners. In order to bypass the issue I'm using
81+
# default naming convention to overwrite the service name.
7282
choco install postgresql${{ inputs.postgres-version }} \
7383
--ia "--servicename postgresql-${{ runner.arch }}-${{ inputs.postgres-version }}"
7484
@@ -83,6 +93,9 @@ runs:
8393
export PGROOT="$PROGRAMFILES/PostgreSQL/${{ inputs.postgres-version }}"
8494
"$PGROOT"/bin/pg_config.exe --bindir >> $GITHUB_PATH
8595
echo "PQ_LIB_DIR=$("$PGROOT"/bin/pg_config.exe --libdir)" >> $GITHUB_ENV
96+
97+
# echo "$PGBIN" >> $GITHUB_PATH
98+
# echo "PQ_LIB_DIR=$PGROOT\lib" >> $GITHUB_ENV
8699
elif [ "$RUNNER_OS" == "macOS" ]; then
87100
case "$(sw_vers -productVersion)" in
88101
13.*|14.*)

0 commit comments

Comments
 (0)