File tree Expand file tree Collapse file tree 3 files changed +38
-8
lines changed Expand file tree Collapse file tree 3 files changed +38
-8
lines changed Original file line number Diff line number Diff line change @@ -14,18 +14,31 @@ jobs:
1414 strategy :
1515 matrix :
1616 os :
17- - ubuntu-latest
18- - windows-latest
19- - macos-latest
20- - macos-13
17+ - ubuntu-22.04
18+ - ubuntu-20.04
19+ - windows-2022
20+ - windows-2019
2121 - macos-14
22+ - macos-13
23+ - macos-12
2224 steps :
2325 - uses : actions/checkout@v4
2426
2527 - name : Run setup-postgres
2628 uses : ./
2729 id : postgres
2830
31+ - name : Run setup-python
32+ uses : actions/setup-python@v5
33+ with :
34+ python-version : " 3.10"
35+
36+ - name : Setup tmate session
37+ uses : mxschmitt/action-tmate@v3
38+ with :
39+ limit-access-to-actor : false
40+ if : ${{ matrix.os }} == "windows-2019"
41+
2942 - name : Run tests
3043 run : |
3144 python3 -m pip install --upgrade pip pytest psycopg furl
5770 port : 34837
5871 id : postgres
5972
73+ - name : Run setup-python
74+ uses : actions/setup-python@v5
75+ with :
76+ python-version : " 3.10"
77+
6078 - name : Run tests
6179 run : |
6280 python3 -m pip install --upgrade pip pytest psycopg furl
Original file line number Diff line number Diff line change 6464 export PGDATA="$RUNNER_TEMP/pgdata"
6565 export PWFILE="$RUNNER_TEMP/pwfile"
6666
67+ DEFAULT_ENCODING="UTF-8"
68+ DEFAULT_LOCALE="en_US.$DEFAULT_ENCODING"
69+
70+ # Unfortunately, Windows Server 2019 doesn't understand locale
71+ # specified in the format defined by the POSIX standard, i.e.
72+ # <language>_<country>.<encoding>. Therefore, we have to convert it
73+ # into something it can swallow, i.e. <language>-<country>.
74+ if [[ "$RUNNER_OS" == "Windows" && "$(wmic os get Caption)" == *"2019"* ]]; then
75+ DEFAULT_LOCALE="${DEFAULT_LOCALE%%.*}"
76+ DEFAULT_LOCALE="${DEFAULT_LOCALE//_/-}"
77+ fi
78+
6779 # Unfortunately 'initdb' could only receive a password via file on disk
6880 # or prompt to enter on. Prompting is not an option since we're running
6981 # in non-interactive mode.
8294 --username="${{ inputs.username }}" \
8395 --pwfile="$PWFILE" \
8496 --auth="scram-sha-256" \
85- --encoding="UTF-8 " \
86- --locale="en_US.UTF-8 " \
97+ --encoding="$DEFAULT_ENCODING " \
98+ --locale="$DEFAULT_LOCALE " \
8799 --no-instructions
88100
89101 # Do not create unix sockets since they are created by default in the
Original file line number Diff line number Diff line change @@ -70,13 +70,13 @@ def test_service_name(service_name):
7070
7171
7272def test_server_encoding (connection : psycopg .Connection ):
73- """Test that PostgreSQL's encoding is 'UTF-8' ."""
73+ """Test that PostgreSQL's encoding matches the one we passed to initdb ."""
7474
7575 assert connection .execute ("SHOW SERVER_ENCODING" ).fetchone ()[0 ] == "UTF8"
7676
7777
7878def test_locale (connection : psycopg .Connection ):
79- """Test that PostgreSQL's locale is 'en_US.UTF-8' ."""
79+ """Test that PostgreSQL's locale matches the one we paased to initdb ."""
8080
8181 lc_collate = connection .execute ("SHOW LC_COLLATE" ).fetchone ()[0 ]
8282 lc_ctype = connection .execute ("SHOW LC_CTYPE" ).fetchone ()[0 ]
You can’t perform that action at this time.
0 commit comments