12
12
POSTGRES_HOSTNAME : ' psql-a'
13
13
POSTGRES_HOSTNAME_A : ' psql-a'
14
14
POSTGRES_HOSTNAME_B : ' psql-b'
15
- POSTGRES_DB : ' test_database '
16
- POSTGRES_DB_A : ' test_database '
17
- POSTGRES_DB_B : ' test_database '
15
+ POSTGRES_DB : ' test_database_a '
16
+ POSTGRES_DB_A : ' test_database_a '
17
+ POSTGRES_DB_B : ' test_database_b '
18
18
POSTGRES_USER : ' test_username'
19
19
POSTGRES_USER_A : ' test_username'
20
20
POSTGRES_USER_B : ' test_username'
@@ -24,108 +24,99 @@ env:
24
24
25
25
jobs :
26
26
api-breakage :
27
- if : ${{ !(github.event.pull_request.draft || false) }}
27
+ if : ${{ github.event_name == 'pull_request' && !(github.event.pull_request.draft || false) }}
28
28
runs-on : ubuntu-latest
29
- container : swift:5.8- jammy
29
+ container : swift:jammy
30
30
steps :
31
- - name : Check out package
32
- uses : actions/checkout@v3
31
+ - name : Checkout
32
+ uses : actions/checkout@v4
33
33
with : { 'fetch-depth': 0 }
34
- - name : Run API breakage check action
35
- uses : vapor/ci/.github/actions/ci-swift-check-api-breakage@reusable-workflows
34
+ - name : API breaking changes
35
+ run : |
36
+ git config --global --add safe.directory "${GITHUB_WORKSPACE}"
37
+ swift package diagnose-api-breaking-changes origin/main
36
38
37
39
linux-all :
38
40
if : ${{ !(github.event.pull_request.draft || false) }}
39
41
strategy :
40
42
fail-fast : false
41
43
matrix :
42
44
include :
43
- - {dbimage: 'postgres:11', dbauth: 'trust', swiftver: 'swift:5.7-focal'}
44
- - {dbimage: 'postgres:13', dbauth: 'md5', swiftver: 'swift:5.7-jammy'}
45
- - {dbimage: 'postgres:15', dbauth: 'scram-sha-256', swiftver: 'swift:5.8-jammy'}
46
- - {dbimage: 'postgres:15', dbauth: 'scram-sha-256', swiftver: 'swiftlang/swift:nightly-5.9-jammy'}
47
- - {dbimage: 'postgres:15', dbauth: 'scram-sha-256', swiftver: 'swiftlang/swift:nightly-main-jammy'}
48
- container : ${{ matrix.swiftver }}
45
+ - postgres-image-a : ' postgres:13'
46
+ postgres-image-b : ' postgres:14'
47
+ postgres-auth : ' trust'
48
+ swift-image : ' swift:5.8-focal'
49
+ - postgres-image-a : ' postgres:15'
50
+ postgres-image-b : ' postgres:16'
51
+ postgres-auth : ' md5'
52
+ swift-image : ' swift:5.10-jammy'
53
+ - postgres-image-a : ' postgres:15'
54
+ postgres-image-b : ' postgres:16'
55
+ postgres-auth : ' scram-sha-256'
56
+ swift-image : ' swiftlang/swift:nightly-6.0-jammy'
57
+ container : ${{ matrix.swift-image }}
49
58
runs-on : ubuntu-latest
50
59
services :
51
60
psql-a :
52
- image : ${{ matrix.dbimage }}
61
+ image : ${{ matrix.postgres-image-a }}
53
62
env :
54
63
POSTGRES_USER : ' test_username'
55
- POSTGRES_DB : ' test_database '
64
+ POSTGRES_DB : ' test_database_a '
56
65
POSTGRES_PASSWORD : ' test_password'
57
- POSTGRES_HOST_AUTH_METHOD : ${{ matrix.dbauth }}
58
- POSTGRES_INITDB_ARGS : --auth-host=${{ matrix.dbauth }}
66
+ POSTGRES_HOST_AUTH_METHOD : ${{ matrix.postgres-auth }}
67
+ POSTGRES_INITDB_ARGS : --auth-host=${{ matrix.postgres-auth }}
59
68
psql-b :
60
- image : ${{ matrix.dbimage }}
69
+ image : ${{ matrix.postgres-image-b }}
61
70
env :
62
71
POSTGRES_USER : ' test_username'
63
- POSTGRES_DB : ' test_database '
72
+ POSTGRES_DB : ' test_database_b '
64
73
POSTGRES_PASSWORD : ' test_password'
65
- POSTGRES_HOST_AUTH_METHOD : ${{ matrix.dbauth }}
66
- POSTGRES_INITDB_ARGS : --auth-host=${{ matrix.dbauth }}
74
+ POSTGRES_HOST_AUTH_METHOD : ${{ matrix.postgres-auth }}
75
+ POSTGRES_INITDB_ARGS : --auth-host=${{ matrix.postgres-auth }}
67
76
steps :
68
- - name : Display versions
69
- shell : bash
70
- run : |
71
- echo POSTGRES_VERSION='${{ matrix.dbimage }}' >> $GITHUB_ENV
72
- echo POSTGRES_AUTH_METHOD='${{ matrix.dbauth }}' >> $GITHUB_ENV
73
- if [[ '${{ contains(matrix.container, 'nightly') }}' == 'true' ]]; then
74
- SWIFT_PLATFORM="$(source /etc/os-release && echo "${ID}${VERSION_ID}")" SWIFT_VERSION="$(cat /.swift_tag)"
75
- printf 'SWIFT_PLATFORM=%s\nSWIFT_VERSION=%s\n' "${SWIFT_PLATFORM}" "${SWIFT_VERSION}" >>"${GITHUB_ENV}"
76
- fi
77
- printf 'OS: %s\nTag: %s\nVersion:\n' "${SWIFT_PLATFORM}-${RUNNER_ARCH}" "${SWIFT_VERSION}" && swift --version
78
77
- name : Check out package
79
- uses : actions/checkout@v3
78
+ uses : actions/checkout@v4
80
79
- name : Run all tests
81
80
run : swift test --sanitize=thread --enable-code-coverage
82
81
- name : Submit coverage report to Codecov.io
83
- uses : vapor/swift-codecov-action@v0.2
82
+ uses : vapor/swift-codecov-action@v0.3
84
83
with :
85
- cc_env_vars : ' SWIFT_VERSION,SWIFT_PLATFORM,RUNNER_OS,RUNNER_ARCH,POSTGRES_VERSION,POSTGRES_AUTH_METHOD'
86
- cc_fail_ci_if_error : false
84
+ codecov_token : ${{ secrets.CODECOV_TOKEN }}
87
85
88
86
macos-all :
89
87
if : ${{ !(github.event.pull_request.draft || false) }}
90
88
strategy :
91
89
fail-fast : false
92
90
matrix :
93
91
include :
94
- - dbimage : postgresql@14
95
- dbauth : scram-sha-256
96
- macos : macos-13
97
- xcode : latest-stable
98
- runs-on : ${{ matrix.macos }}
92
+ - macos-version : macos-13
93
+ xcode-version : ' ~14.3 '
94
+ - macos-version : macos-14
95
+ xcode-version : latest
96
+ runs-on : ${{ matrix.macos-version }}
99
97
env :
100
98
LOG_LEVEL : debug
101
99
POSTGRES_HOSTNAME : 127.0.0.1
102
100
POSTGRES_HOSTNAME_A : 127.0.0.1
103
101
POSTGRES_HOSTNAME_B : 127.0.0.1
104
- POSTGRES_DB : ' test_database_a'
105
- POSTGRES_DB_A : ' test_database_a'
106
- POSTGRES_DB_B : ' test_database_b'
107
- POSTGRES_USER : ' test_username_a'
108
- POSTGRES_USER_A : ' test_username_a'
109
- POSTGRES_USER_B : ' test_username_b'
110
102
steps :
111
103
- name : Select latest available Xcode
112
104
uses : maxim-lobanov/setup-xcode@v1
113
105
with :
114
- xcode-version : ${{ matrix.xcode }}
106
+ xcode-version : ${{ matrix.xcode-version }}
115
107
- name : Install Postgres, setup DB and auth, and wait for server start
116
108
run : |
117
- export PATH="$(brew --prefix)/opt/${{ matrix.dbimage }}/bin:$PATH" PGDATA=/tmp/vapor-postgres-test PGUSER=postgres
118
- (brew unlink postgresql || true) && brew install ${{ matrix.dbimage }} && brew link --force ${{ matrix.dbimage }}
119
- initdb --locale=C --auth-host ${{ matrix.dbauth }} --username=postgres --pwfile=<(echo postgres)
109
+ brew upgrade || true
110
+ export PATH="$(brew --prefix)/opt/postgresql@16/bin:$PATH" PGDATA=/tmp/vapor-postgres-test PGUSER="${POSTGRES_USER_A}"
111
+ (brew unlink postgresql@14 || true) && brew install postgresql@16 && brew link --force postgresql@16
112
+ initdb --locale=C --auth-host "scram-sha-256" -U "${POSTGRES_USER_A}" --pwfile=<(echo "${POSTGRES_PASSWORD_A}")
120
113
pg_ctl start --wait
121
- psql postgres <<<"CREATE ROLE $POSTGRES_USER_A LOGIN PASSWORD '$POSTGRES_PASSWORD_A';"
122
- psql postgres <<<"CREATE ROLE $POSTGRES_USER_B LOGIN PASSWORD '$POSTGRES_PASSWORD_B';"
123
- psql postgres <<<"CREATE DATABASE $POSTGRES_DB_A OWNER = $POSTGRES_USER_A;"
124
- psql postgres <<<"CREATE DATABASE $POSTGRES_DB_B OWNER = $POSTGRES_USER_B;"
125
- psql $POSTGRES_DB_A <<<"ALTER SCHEMA public OWNER TO $POSTGRES_USER_A;"
126
- psql $POSTGRES_DB_B <<<"ALTER SCHEMA public OWNER TO $POSTGRES_USER_B;"
127
- timeout-minutes : 2
114
+ PGPASSWORD="${POSTGRES_PASSWORD_A}" createdb -w -O "${POSTGRES_USER_A}" "${POSTGRES_DB_A}"
115
+ PGPASSWORD="${POSTGRES_PASSWORD_A}" createdb -w -O "${POSTGRES_USER_B}" "${POSTGRES_DB_B}"
116
+ PGPASSWORD="${POSTGRES_PASSWORD_A}" psql -w "${POSTGRES_DB_A}" <<<"ALTER SCHEMA public OWNER TO ${POSTGRES_USER_A};"
117
+ PGPASSWORD="${POSTGRES_PASSWORD_A}" psql -w "${POSTGRES_DB_B}" <<<"ALTER SCHEMA public OWNER TO ${POSTGRES_USER_B};"
118
+ timeout-minutes : 15
128
119
- name : Checkout code
129
- uses : actions/checkout@v3
120
+ uses : actions/checkout@v4
130
121
- name : Run all tests
131
122
run : swift test --sanitize=thread
0 commit comments