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:
14
14
strategy :
15
15
matrix :
16
16
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
21
21
- macos-14
22
+ - macos-13
23
+ - macos-12
22
24
steps :
23
25
- uses : actions/checkout@v4
24
26
25
27
- name : Run setup-postgres
26
28
uses : ./
27
29
id : postgres
28
30
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
+
29
42
- name : Run tests
30
43
run : |
31
44
python3 -m pip install --upgrade pip pytest psycopg furl
57
70
port : 34837
58
71
id : postgres
59
72
73
+ - name : Run setup-python
74
+ uses : actions/setup-python@v5
75
+ with :
76
+ python-version : " 3.10"
77
+
60
78
- name : Run tests
61
79
run : |
62
80
python3 -m pip install --upgrade pip pytest psycopg furl
Original file line number Diff line number Diff line change 64
64
export PGDATA="$RUNNER_TEMP/pgdata"
65
65
export PWFILE="$RUNNER_TEMP/pwfile"
66
66
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
+
67
79
# Unfortunately 'initdb' could only receive a password via file on disk
68
80
# or prompt to enter on. Prompting is not an option since we're running
69
81
# in non-interactive mode.
82
94
--username="${{ inputs.username }}" \
83
95
--pwfile="$PWFILE" \
84
96
--auth="scram-sha-256" \
85
- --encoding="UTF-8 " \
86
- --locale="en_US.UTF-8 " \
97
+ --encoding="$DEFAULT_ENCODING " \
98
+ --locale="$DEFAULT_LOCALE " \
87
99
--no-instructions
88
100
89
101
# 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):
70
70
71
71
72
72
def 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 ."""
74
74
75
75
assert connection .execute ("SHOW SERVER_ENCODING" ).fetchone ()[0 ] == "UTF8"
76
76
77
77
78
78
def 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 ."""
80
80
81
81
lc_collate = connection .execute ("SHOW LC_COLLATE" ).fetchone ()[0 ]
82
82
lc_ctype = connection .execute ("SHOW LC_CTYPE" ).fetchone ()[0 ]
You can’t perform that action at this time.
0 commit comments