Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0e6e0b6

Browse files
authored
Update CI for Postgres 15 + Swift 5.7, add code coverage, add API breakage check (#200)
1 parent a8b2839 commit 0e6e0b6

File tree

1 file changed

+98
-39
lines changed

1 file changed

+98
-39
lines changed

β€Ž.github/workflows/test.yml

Lines changed: 98 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,100 @@
11
name: test
2-
on: [ 'pull_request' ]
2+
on:
3+
pull_request: { branches: ['*'] }
4+
push: { branches: ['main'] }
5+
6+
env:
7+
LOG_LEVEL: debug
8+
SWIFT_DETERMINISTIC_HASHING: 1
9+
POSTGRES_HOSTNAME: 'psql-a'
10+
POSTGRES_HOSTNAME_A: 'psql-a'
11+
POSTGRES_HOSTNAME_B: 'psql-b'
12+
POSTGRES_DB: 'test_database'
13+
POSTGRES_DB_A: 'test_database'
14+
POSTGRES_DB_B: 'test_database'
15+
POSTGRES_USER: 'test_username'
16+
POSTGRES_USER_A: 'test_username'
17+
POSTGRES_USER_B: 'test_username'
18+
POSTGRES_PASSWORD: 'test_password'
19+
POSTGRES_PASSWORD_A: 'test_password'
20+
POSTGRES_PASSWORD_B: 'test_password'
321

422
jobs:
23+
# Baseline test run for code coverage stats
24+
codecov:
25+
strategy:
26+
matrix: { dbimage: ['postgres:15'], dbauth: ['scram-sha-256'] }
27+
runs-on: ubuntu-latest
28+
container: swift:5.7-jammy
29+
services:
30+
psql-a:
31+
image: ${{ matrix.dbimage }}
32+
env:
33+
POSTGRES_USER: 'test_username'
34+
POSTGRES_DB: 'test_database'
35+
POSTGRES_PASSWORD: 'test_password'
36+
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.dbauth }}
37+
POSTGRES_INITDB_ARGS: --auth-host=${{ matrix.dbauth }}
38+
psql-b:
39+
image: ${{ matrix.dbimage }}
40+
env:
41+
POSTGRES_USER: 'test_username'
42+
POSTGRES_DB: 'test_database'
43+
POSTGRES_PASSWORD: 'test_password'
44+
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.dbauth }}
45+
POSTGRES_INITDB_ARGS: --auth-host=${{ matrix.dbauth }}
46+
steps:
47+
- name: Save Postgres version and method to env
48+
run: |
49+
echo POSTGRES_VERSION='${{ matrix.dbimage }}' >> $GITHUB_ENV
50+
echo POSTGRES_AUTH_METHOD='${{ matrix.dbauth }}' >> $GITHUB_ENV
51+
- name: Check out package
52+
uses: actions/checkout@v3
53+
- name: Run local tests with coverage
54+
run: swift test --enable-code-coverage
55+
- name: Submit coverage report to Codecov.io
56+
uses: vapor/swift-codecov-action@v0.2
57+
with:
58+
cc_flags: 'unittests'
59+
cc_env_vars: 'SWIFT_VERSION,SWIFT_PLATFORM,RUNNER_OS,RUNNER_ARCH,POSTGRES_VERSION,POSTGRES_AUTH_METHOD'
60+
cc_fail_ci_if_error: true
61+
cc_verbose: true
62+
cc_dry_run: false
63+
64+
# Check for API breakage versus main
65+
api-breakage:
66+
if: github.event_name == 'pull_request'
67+
runs-on: ubuntu-latest
68+
container: swift:5.7-jammy
69+
steps:
70+
- name: Check out package
71+
uses: actions/checkout@v3
72+
with:
73+
fetch-depth: 0
74+
# https://github.com/actions/checkout/issues/766
75+
- name: Mark the workspace as safe
76+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
77+
- name: Check for API breaking changes
78+
run: swift package diagnose-api-breaking-changes origin/main
79+
580
linux-all:
81+
if: github.event_name == 'pull_request'
682
strategy:
783
fail-fast: false
884
matrix:
9-
dbimage:
10-
- postgres:14
11-
- postgres:13
12-
- postgres:11
13-
dbauth:
14-
- trust
15-
- md5
16-
- scram-sha-256
17-
swiftver:
18-
- swift:5.4
19-
- swift:5.5
20-
- swift:5.6
21-
- swiftlang/swift:nightly-main
22-
swiftos:
23-
- focal
24-
container: ${{ format('{0}-{1}', matrix.swiftver, matrix.swiftos) }}
85+
dbimage: ['postgres:15', 'postgres:14', 'postgres:11']
86+
swiftver: [
87+
'swift:5.4-focal', 'swift:5.5-focal', 'swift:5.6-focal',
88+
'swift:5.7-jammy',
89+
'swiftlang/swift:nightly-main-jammy'
90+
]
91+
include: [
92+
{dbimage: 'postgres:15', dbauth: 'scram-sha-256'},
93+
{dbimage: 'postgres:14', dbauth: 'md5'},
94+
{dbimage: 'postgres:11', dbauth: 'trust'}
95+
]
96+
container: ${{ matrix.swiftver }}
2597
runs-on: ubuntu-latest
26-
env:
27-
LOG_LEVEL: debug
28-
POSTGRES_DB_A: 'test_database'
29-
POSTGRES_DB_B: 'test_database'
30-
POSTGRES_USER_A: 'test_username'
31-
POSTGRES_USER_B: 'test_username'
32-
POSTGRES_PASSWORD_A: 'test_password'
33-
POSTGRES_PASSWORD_B: 'test_password'
34-
POSTGRES_HOSTNAME_A: 'psql-a'
35-
POSTGRES_HOSTNAME_B: 'psql-b'
36-
POSTGRES_HOST_AUTH_METHOD: ${{ matrix.dbauth }}
3798
services:
3899
psql-a:
39100
image: ${{ matrix.dbimage }}
@@ -58,28 +119,26 @@ jobs:
58119
run: swift test
59120

60121
macos-all:
122+
if: github.event_name == 'pull_request'
61123
strategy:
62124
fail-fast: false
63125
matrix:
64-
# Only test latest version and one auth method on macOS
65-
dbimage:
66-
- postgresql@14
67-
dbauth:
68-
- scram-sha-256
126+
dbimage: ['postgresql@14'] # N.B.: As of this writing, Homebrew didn't have Postgres 15 yet
127+
dbauth: ['scram-sha-256']
69128
macos: ['macos-11', 'macos-12']
70-
xcode: ['latest-stable', 'latest']
71-
exclude: [{ macos: 'macos-11', xcode: 'latest' }]
129+
xcode: ['latest-stable']
72130
runs-on: ${{ matrix.macos }}
73131
env:
74132
LOG_LEVEL: debug
133+
POSTGRES_HOSTNAME: 127.0.0.1
75134
POSTGRES_HOSTNAME_A: 127.0.0.1
76135
POSTGRES_HOSTNAME_B: 127.0.0.1
77-
POSTGRES_USER_A: 'test_username'
78-
POSTGRES_USER_B: 'test_username'
79-
POSTGRES_PASSWORD_A: 'test_password'
80-
POSTGRES_PASSWORD_B: 'test_password'
136+
POSTGRES_DB: 'test_database_a'
81137
POSTGRES_DB_A: 'test_database_a'
82138
POSTGRES_DB_B: 'test_database_b'
139+
POSTGRES_USER: 'test_username_a'
140+
POSTGRES_USER_A: 'test_username_a'
141+
POSTGRES_USER_B: 'test_username_b'
83142
steps:
84143
- name: Select latest available Xcode
85144
uses: maxim-lobanov/setup-xcode@v1

0 commit comments

Comments
(0)

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /