1212 POSTGRES_HOSTNAME : ' psql-a'
1313 POSTGRES_HOSTNAME_A : ' psql-a'
1414 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 '
1818 POSTGRES_USER : ' test_username'
1919 POSTGRES_USER_A : ' test_username'
2020 POSTGRES_USER_B : ' test_username'
@@ -24,108 +24,99 @@ env:
2424
2525jobs :
2626 api-breakage :
27- if : ${{ !(github.event.pull_request.draft || false) }}
27+ if : ${{ github.event_name == 'pull_request' && !(github.event.pull_request.draft || false) }}
2828 runs-on : ubuntu-latest
29- container : swift:5.8- jammy
29+ container : swift:jammy
3030 steps :
31- - name : Check out package
32- uses : actions/checkout@v3
31+ - name : Checkout
32+ uses : actions/checkout@v4
3333 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
3638
3739 linux-all :
3840 if : ${{ !(github.event.pull_request.draft || false) }}
3941 strategy :
4042 fail-fast : false
4143 matrix :
4244 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 }}
4958 runs-on : ubuntu-latest
5059 services :
5160 psql-a :
52- image : ${{ matrix.dbimage }}
61+ image : ${{ matrix.postgres-image-a }}
5362 env :
5463 POSTGRES_USER : ' test_username'
55- POSTGRES_DB : ' test_database '
64+ POSTGRES_DB : ' test_database_a '
5665 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 }}
5968 psql-b :
60- image : ${{ matrix.dbimage }}
69+ image : ${{ matrix.postgres-image-b }}
6170 env :
6271 POSTGRES_USER : ' test_username'
63- POSTGRES_DB : ' test_database '
72+ POSTGRES_DB : ' test_database_b '
6473 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 }}
6776 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
7877 - name : Check out package
79- uses : actions/checkout@v3
78+ uses : actions/checkout@v4
8079 - name : Run all tests
8180 run : swift test --sanitize=thread --enable-code-coverage
8281 - name : Submit coverage report to Codecov.io
83- uses : vapor/swift-codecov-action@v0.2
82+ uses : vapor/swift-codecov-action@v0.3
8483 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 }}
8785
8886 macos-all :
8987 if : ${{ !(github.event.pull_request.draft || false) }}
9088 strategy :
9189 fail-fast : false
9290 matrix :
9391 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 }}
9997 env :
10098 LOG_LEVEL : debug
10199 POSTGRES_HOSTNAME : 127.0.0.1
102100 POSTGRES_HOSTNAME_A : 127.0.0.1
103101 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'
110102 steps :
111103 - name : Select latest available Xcode
112104 uses : maxim-lobanov/setup-xcode@v1
113105 with :
114- xcode-version : ${{ matrix.xcode }}
106+ xcode-version : ${{ matrix.xcode-version }}
115107 - name : Install Postgres, setup DB and auth, and wait for server start
116108 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}")
120113 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
128119 - name : Checkout code
129- uses : actions/checkout@v3
120+ uses : actions/checkout@v4
130121 - name : Run all tests
131122 run : swift test --sanitize=thread
0 commit comments