11name : test
2+ concurrency :
3+ group : ${{ github.workflow }}-${{ github.ref }}
4+ cancel-in-progress : true
25on :
3- pull_request : { branches : ['*' ] }
6+ pull_request : { types : [opened, reopened, synchronize, ready_for_review ] }
47 push : { branches: [ main ] }
58
69env :
2124
2225jobs :
2326
24- codecov :
25- strategy :
26- # For MySQL we have to run coverage baselines against multiple DB versions thanks to
27- # the driver's behavior changing notably depending on the server.
28- matrix : { dbimage: ['mysql:5.7', 'mysql:8.0', 'mariadb:10.7'] }
29- runs-on : ubuntu-latest
30- container : swift:5.7-jammy
31- services :
32- mysql-a :
33- image : ${{ matrix.dbimage }}
34- env :
35- MYSQL_ALLOW_EMPTY_PASSWORD : " true"
36- MYSQL_USER : test_username
37- MYSQL_PASSWORD : test_password
38- MYSQL_DATABASE : test_database
39- steps :
40- - name : Save MySQL version to env
41- run : |
42- echo MYSQL_VERSION='${{ matrix.dbimage }}' >> $GITHUB_ENV
43- - name : Check out package
44- uses : actions/checkout@v3
45- - name : Run local tests with coverage
46- run : swift test --enable-code-coverage
47- - name : Submit coverage report to Codecov.io
48- uses : vapor/swift-codecov-action@v0.2
49- with :
50- cc_flags : ' unittests'
51- cc_env_vars : ' SWIFT_VERSION,SWIFT_PLATFORM,RUNNER_OS,RUNNER_ARCH,MYSQL_VERSION'
52- cc_fail_ci_if_error : true
53- cc_verbose : true
54- cc_dry_run : false
55-
5627 # Check for API breakage versus main
5728 api-breakage :
58- if : github.event_name == 'pull_request'
29+ if : ${{ github.event_name == 'pull_request' && !github.event.pull_request.draft }}
5930 runs-on : ubuntu-latest
60- container : swift:5.7 -jammy
31+ container : swift:5.8 -jammy
6132 steps :
6233 - name : Check out package
6334 uses : actions/checkout@v3
64- with :
65- fetch-depth : 0
35+ with : { fetch-depth: 0 }
6636 # https://github.com/actions/checkout/issues/766
6737 - name : Mark the workspace as safe
6838 run : git config --global --add safe.directory ${GITHUB_WORKSPACE}
7141
7242 # Test integration with downstream Fluent driver
7343 dependents :
74- if : github.event_name == 'pull_request'
44+ if : ${{ !( github.event.pull_request.draft || false) }}
7545 runs-on : ubuntu-latest
7646 services :
7747 mysql-a :
@@ -88,52 +58,48 @@ jobs:
8858 MYSQL_USER : test_username
8959 MYSQL_PASSWORD : test_password
9060 MYSQL_DATABASE : test_database
91- container : swift:5.7 -jammy
61+ container : swift:5.8 -jammy
9262 strategy :
9363 fail-fast : false
9464 matrix :
95- # Same minimum all-behavior set as the code coverage runs
9665 dbimage :
9766 - mysql:5.7
9867 - mysql:8.0
99- - mariadb:10.7
100- dependent :
101- - fluent-mysql-driver
68+ - mariadb:10.11
69+ - percona:8.0
10270 steps :
10371 - name : Check out package
10472 uses : actions/checkout@v3
105- with :
106- path : package
73+ with : { path: 'mysql-kit' }
10774 - name : Check out dependent
10875 uses : actions/checkout@v3
10976 with :
110- repository : vapor/${{ matrix.dependent }}
111- path : dependent
112- ref : main
77+ repository : vapor/fluent-mysql-driver
78+ path : fluent-mysql-driver
11379 - name : Use local package
114- run : swift package edit mysql-kit --path ../package
115- working-directory : dependent
80+ run : swift package --package-path fluent-mysql-driver edit mysql-kit --path ./mysql-kit
11681 - name : Run tests with Thread Sanitizer
117- run : swift test --sanitize=thread
118- working-directory : dependent
82+ run : swift test --package-path fluent-mysql-driver --sanitize=thread
11983
120- # Run unit tests (Linux)
84+ # Run unit tests (Linux), do code coverage in same job to cut down on extra builds
12185 linux-unit :
122- if : github.event_name == 'pull_request'
86+ if : ${{ !( github.event.pull_request.draft || false) }}
12387 strategy :
12488 fail-fast : false
12589 matrix :
12690 dbimage :
12791 - mysql:5.7
12892 - mysql:8.0
129- - mariadb:10.3
130- - mariadb:10.7
93+ - mariadb:10.4
94+ - mariadb:10.11
13195 - percona:8.0
13296 runner :
133- - swift:5.5-bionic
97+ # List is deliberately incomplete; we want to avoid running 50 jobs on every commit
13498 - swift:5.6-focal
135- - swift:5.7-jammy
136- - swiftlang/swift:nightly-main-jammy
99+ # - swift:5.7-jammy
100+ - swift:5.8-jammy
101+ - swiftlang/swift:nightly-5.9-jammy
102+ # - swiftlang/swift:nightly-main-jammy
137103 container : ${{ matrix.runner }}
138104 runs-on : ubuntu-latest
139105 services :
@@ -145,24 +111,32 @@ jobs:
145111 MYSQL_PASSWORD : test_password
146112 MYSQL_DATABASE : test_database
147113 steps :
148- - name : Check out code
114+ - name : Save MySQL version to env
115+ run : |
116+ echo MYSQL_VERSION='${{ matrix.dbimage }}' >> $GITHUB_ENV
117+ - name : Check out package
149118 uses : actions/checkout@v3
150- - name : Run tests with Thread Sanitizer
151- run : swift test --sanitize=thread
119+ - name : Run local tests with coverage and TSan
120+ run : swift test --enable-code-coverage --sanitize=thread
121+ - name : Submit coverage report to Codecov.io
122+ if : ${{ !contains(matrix.runner, '5.8') }}
123+ uses : vapor/swift-codecov-action@v0.2
124+ with :
125+ cc_flags : ' unittests'
126+ cc_env_vars : ' SWIFT_VERSION,SWIFT_PLATFORM,RUNNER_OS,RUNNER_ARCH,MYSQL_VERSION'
127+ cc_fail_ci_if_error : true
128+ cc_verbose : true
129+ cc_dry_run : false
152130
153131 # Run unit tests (macOS). Don't bother with lots of variations, Linux will cover that.
154132 macos-unit :
155- if : github.event_name == 'pull_request'
133+ if : ${{ !( github.event.pull_request.draft || false) }}
156134 strategy :
157135 fail-fast : false
158136 matrix :
159- formula :
160- - mysql@8.0
161- macos :
162- - macos-11
163- - macos-12
164- xcode :
165- - latest-stable
137+ formula : [ 'mysql@8.0' ]
138+ macos : [ 'macos-12' ]
139+ xcode : [ 'latest-stable' ]
166140 runs-on : ${{ matrix.macos }}
167141 steps :
168142 - name : Select latest available Xcode
@@ -187,16 +161,16 @@ jobs:
187161 uses : actions/checkout@v3
188162 - name : Run tests with Thread Sanitizer
189163 run : swift test --sanitize=thread
190- env :
191- MYSQL_HOSTNAME : ' 127.0.0.1'
164+ env : { MYSQL_HOSTNAME: '127.0.0.1' }
192165
193166 test-exports :
167+ if : ${{ !(github.event.pull_request.draft || false) }}
194168 name : Test exports
195169 runs-on : ubuntu-latest
170+ container : swift:5.8-jammy
196171 steps :
197- - name : Check out Vapor
172+ - name : Check out package
198173 uses : actions/checkout@v3
199- with :
200- fetch-depth : 0
174+ with : { fetch-depth: 0 }
201175 - name : Build
202176 run : swift build -Xswiftc -DBUILDING_DOCC
0 commit comments