@@ -17,49 +17,52 @@ jobs:
17
17
strategy :
18
18
fail-fast : false
19
19
matrix :
20
- container :
20
+ swift-image :
21
21
- swift:5.6-focal
22
22
- swift:5.7-jammy
23
23
- swift:5.8-jammy
24
24
- swiftlang/swift:nightly-5.9-jammy
25
25
- swiftlang/swift:nightly-main-jammy
26
- container : ${{ matrix.container }}
26
+ include :
27
+ - swift-image : swift:5.8-jammy
28
+ code-coverage : true
29
+ container : ${{ matrix.swift-image }}
27
30
runs-on : ubuntu-latest
28
31
steps :
29
- - name : Note Swift version
30
- if : ${{ contains(matrix.swiftver, 'nightly') }}
31
- run : |
32
- echo "SWIFT_PLATFORM=$(. /etc/os-release && echo "${ID}${VERSION_ID}")" >>"${GITHUB_ENV}"
33
- echo "SWIFT_VERSION=$(cat /.swift_tag)" >>"${GITHUB_ENV}"
34
32
- name : Display OS and Swift versions
33
+ shell : bash
35
34
run : |
36
- printf 'OS: %s\nTag: %s\nVersion:\n' "${SWIFT_PLATFORM}-${RUNNER_ARCH}" "${SWIFT_VERSION}" && swift --version
35
+ [[ -z "${SWIFT_PLATFORM}" ]] && SWIFT_PLATFORM="$(. /etc/os-release && echo "${ID}${VERSION_ID}")"
36
+ [[ -z "${SWIFT_VERSION}" ]] && SWIFT_VERSION="$(cat /.swift_tag 2>/dev/null || true)"
37
+ printf 'OS: %s\nTag: %s\nVersion:\n' "${SWIFT_PLATFORM}-${RUNNER_ARCH}" "${SWIFT_VERSION}"
38
+ swift --version
37
39
- name : Check out package
38
40
uses : actions/checkout@v3
39
- - name : Run unit tests with code coverage and Thread Sanitizer
40
- run : swift test --filter=^PostgresNIOTests --sanitize=thread --enable-code-coverage
41
- - name : Submit coverage report to Codecov.io
42
-
43
- with :
44
- cc_env_vars : ' SWIFT_VERSION,SWIFT_PLATFORM,RUNNER_OS,RUNNER_ARCH'
45
- cc_fail_ci_if_error : false
41
+ - name : Run unit tests with Thread Sanitizer
42
+ env :
43
+ CODE_COVERAGE : ${{ matrix.code-coverage && '--enable-code-coverage' || '' }}
44
+ run : |
45
+ swift test --filter=^PostgresNIOTests --sanitize=thread ${CODE_COVERAGE}
46
+ - name : Submit code coverage
47
+ if : ${{ matrix.code-coverage }}
48
+
46
49
47
50
linux-integration-and-dependencies :
48
51
if : github.event_name == 'pull_request'
49
52
strategy :
50
53
fail-fast : false
51
54
matrix :
52
- dbimage :
55
+ postgres-image :
53
56
- postgres:15
54
57
- postgres:13
55
58
- postgres:11
56
59
include :
57
- - dbimage : postgres:15
58
- dbauth : scram-sha-256
59
- - dbimage : postgres:13
60
- dbauth : md5
61
- - dbimage : postgres:11
62
- dbauth : trust
60
+ - postgres-image : postgres:15
61
+ postgres-auth : scram-sha-256
62
+ - postgres-image : postgres:13
63
+ postgres-auth : md5
64
+ - postgres-image : postgres:11
65
+ postgres-auth : trust
63
66
container :
64
67
image : swift:5.8-jammy
65
68
volumes : [ 'pgrunshare:/var/run/postgresql' ]
@@ -79,29 +82,31 @@ jobs:
79
82
POSTGRES_HOSTNAME_A : ' psql-a'
80
83
POSTGRES_HOSTNAME_B : ' psql-b'
81
84
POSTGRES_SOCKET : ' /var/run/postgresql/.s.PGSQL.5432'
82
- POSTGRES_HOST_AUTH_METHOD : ${{ matrix.dbauth }}
85
+ POSTGRES_HOST_AUTH_METHOD : ${{ matrix.postgres-auth }}
83
86
services :
84
87
psql-a :
85
- image : ${{ matrix.dbimage }}
88
+ image : ${{ matrix.postgres-image }}
86
89
volumes : [ 'pgrunshare:/var/run/postgresql' ]
87
90
env :
88
91
POSTGRES_USER : ' test_username'
89
92
POSTGRES_DB : ' test_database'
90
93
POSTGRES_PASSWORD : ' test_password'
91
- POSTGRES_HOST_AUTH_METHOD : ${{ matrix.dbauth }}
92
- POSTGRES_INITDB_ARGS : --auth-host=${{ matrix.dbauth }}
94
+ POSTGRES_HOST_AUTH_METHOD : ${{ matrix.postgres-auth }}
95
+ POSTGRES_INITDB_ARGS : --auth-host=${{ matrix.postgres-auth }}
93
96
psql-b :
94
- image : ${{ matrix.dbimage }}
97
+ image : ${{ matrix.postgres-image }}
95
98
volumes : [ 'pgrunshare:/var/run/postgresql' ]
96
99
env :
97
100
POSTGRES_USER : ' test_username'
98
101
POSTGRES_DB : ' test_database'
99
102
POSTGRES_PASSWORD : ' test_password'
100
- POSTGRES_HOST_AUTH_METHOD : ${{ matrix.dbauth }}
101
- POSTGRES_INITDB_ARGS : --auth-host=${{ matrix.dbauth }}
103
+ POSTGRES_HOST_AUTH_METHOD : ${{ matrix.postgres-auth }}
104
+ POSTGRES_INITDB_ARGS : --auth-host=${{ matrix.postgres-auth }}
102
105
steps :
103
106
- name : Display OS and Swift versions
104
107
run : |
108
+ [[ -z "${SWIFT_PLATFORM}" ]] && SWIFT_PLATFORM="$(. /etc/os-release && echo "${ID}${VERSION_ID}")"
109
+ [[ -z "${SWIFT_VERSION}" ]] && SWIFT_VERSION="$(cat /.swift_tag 2>/dev/null || true)"
105
110
printf 'OS: %s\nTag: %s\nVersion:\n' "${SWIFT_PLATFORM}-${RUNNER_ARCH}" "${SWIFT_VERSION}" && swift --version
106
111
- name : Check out package
107
112
uses : actions/checkout@v3
@@ -128,33 +133,34 @@ jobs:
128
133
strategy :
129
134
fail-fast : false
130
135
matrix :
131
- dbimage :
136
+ postgres-formula :
132
137
# Only test one version on macOS, let Linux do the rest
133
138
- postgresql@14
134
- dbauth :
139
+ postgres-auth :
135
140
# Only test one auth method on macOS, Linux tests will cover the others
136
141
- scram-sha-256
137
- xcode :
138
- - latest-stable
142
+ xcode-version :
143
+ - ' ~14.3'
144
+ - ' 15.0-beta'
139
145
runs-on : macos-13
140
146
env :
141
147
POSTGRES_HOSTNAME : 127.0.0.1
142
148
POSTGRES_USER : ' test_username'
143
149
POSTGRES_PASSWORD : ' test_password'
144
150
POSTGRES_DB : ' postgres'
145
- POSTGRES_HOST_AUTH_METHOD : ${{ matrix.dbauth }}
151
+ POSTGRES_AUTH_METHOD : ${{ matrix.postgres-auth }}
146
152
POSTGRES_SOCKET : ' /tmp/.s.PGSQL.5432'
147
- POSTGRES_VERSION : ${{ matrix.dbimage }}
153
+ POSTGRES_FORMULA : ${{ matrix.postgres-formula }}
148
154
steps :
149
155
- name : Select latest available Xcode
150
156
uses : maxim-lobanov/setup-xcode@v1
151
157
with :
152
- xcode-version : ${{ matrix.xcode }}
158
+ xcode-version : ${{ matrix.xcode-version }}
153
159
- name : Install Postgres, setup DB and auth, and wait for server start
154
160
run : |
155
- export PATH="$(brew --prefix)/opt/${POSTGRES_VERSION }/bin:$PATH" PGDATA=/tmp/vapor-postgres-test
156
- (brew unlink postgresql || true) && brew install "${POSTGRES_VERSION }" && brew link --force "${POSTGRES_VERSION }"
157
- initdb --locale=C --auth-host "${POSTGRES_HOST_AUTH_METHOD }" -U "${POSTGRES_USER}" --pwfile=<(echo "${POSTGRES_PASSWORD}")
161
+ export PATH="$(brew --prefix)/opt/${POSTGRES_FORMULA }/bin:$PATH" PGDATA=/tmp/vapor-postgres-test
162
+ (brew unlink postgresql || true) && brew install "${POSTGRES_FORMULA }" && brew link --force "${POSTGRES_FORMULA }"
163
+ initdb --locale=C --auth-host "${POSTGRES_AUTH_METHOD }" -U "${POSTGRES_USER}" --pwfile=<(echo "${POSTGRES_PASSWORD}")
158
164
pg_ctl start --wait
159
165
timeout-minutes : 2
160
166
- name : Checkout code
@@ -165,7 +171,7 @@ jobs:
165
171
api-breakage :
166
172
if : github.event_name == 'pull_request'
167
173
runs-on : ubuntu-latest
168
- container : swift:5.8- jammy
174
+ container : swift:jammy
169
175
steps :
170
176
- name : Checkout
171
177
uses : actions/checkout@v3
@@ -177,3 +183,17 @@ jobs:
177
183
- name : API breaking changes
178
184
run : swift package diagnose-api-breaking-changes origin/main
179
185
186
+ gh-codeql :
187
+ runs-on : ubuntu-latest
188
+ permissions : { security-events: write }
189
+ steps :
190
+ - name : Check out code
191
+ uses : actions/checkout@v3
192
+ - name : Initialize CodeQL
193
+ uses : github/codeql-action/init@v2
194
+ with :
195
+ languages : swift
196
+ - name : Perform build
197
+ run : swift build
198
+ - name : Run CodeQL analyze
199
+ uses : github/codeql-action/analyze@v2
0 commit comments