1
1
name : test
2
+ concurrency :
3
+ group : ${{ github.workflow }}-${{ github.ref }}
4
+ cancel-in-progress : true
2
5
on :
3
- pull_request : { branches : ['*' ] }
6
+ pull_request : { types : [opened, reopened, synchronize, ready_for_review ] }
4
7
push : { branches: [ main ] }
5
8
6
9
env :
7
- LOG_LEVEL : debug
10
+ LOG_LEVEL : info
8
11
SWIFT_DETERMINISTIC_HASHING : 1
9
12
MYSQL_HOSTNAME : ' mysql-a'
10
13
MYSQL_HOSTNAME_A : ' mysql-a'
20
23
MYSQL_PASSWORD_B : ' test_password'
21
24
22
25
jobs :
23
-
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
- mysql-b :
40
- image : ${{ matrix.dbimage }}
41
- env :
42
- MYSQL_ALLOW_EMPTY_PASSWORD : " true"
43
- MYSQL_USER : test_username
44
- MYSQL_PASSWORD : test_password
45
- MYSQL_DATABASE : test_database
46
- steps :
47
- - name : Save MySQL version to env
48
- run : |
49
- echo MYSQL_VERSION='${{ matrix.dbimage }}' >> $GITHUB_ENV
50
- - name : Check out package
51
- uses : actions/checkout@v3
52
- - name : Run local tests with coverage
53
- run : swift test --enable-code-coverage
54
- - name : Submit coverage report to Codecov.io
55
-
56
- with :
57
- cc_flags : ' unittests'
58
- cc_env_vars : ' SWIFT_VERSION,SWIFT_PLATFORM,RUNNER_OS,RUNNER_ARCH,MYSQL_VERSION'
59
- cc_fail_ci_if_error : true
60
- cc_verbose : true
61
- cc_dry_run : false
62
-
63
- # Check for API breakage versus main
64
26
api-breakage :
65
- if : github.event_name == 'pull_request'
27
+ if : ${{ !( github.event.pull_request.draft || false) }}
66
28
runs-on : ubuntu-latest
67
29
container : swift:5.8-jammy
68
30
steps :
69
31
- name : Check out package
70
32
uses : actions/checkout@v3
71
- with :
72
- fetch-depth : 0
73
- # https://github.com/actions/checkout/issues/766
74
- - name : Mark the workspace as safe
75
- run : git config --global --add safe.directory ${GITHUB_WORKSPACE}
76
- - name : Check for API breaking changes
77
- run : swift package diagnose-api-breaking-changes origin/main
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
78
36
79
- # Unit tests (Linux)
80
37
linux-unit :
81
- if : ${{ github.event_name == 'pull_request' }}
38
+ if : ${{ !( github.event.pull_request.draft || false) }}
82
39
strategy :
83
40
fail-fast : false
84
41
matrix :
85
42
dbimage :
86
43
- mysql:5.7
87
44
- mysql:8.0
88
45
- mariadb:10.4
89
- - mariadb:10. 11
46
+ - mariadb:11
90
47
- percona:8.0
91
48
runner :
92
49
- swift:5.6-focal
@@ -112,33 +69,43 @@ jobs:
112
69
MYSQL_PASSWORD : test_password
113
70
MYSQL_DATABASE : test_database
114
71
steps :
72
+ - name : Display versions
73
+ shell : bash
74
+ run : |
75
+ echo MYSQL_VERSION='${{ matrix.dbimage }}' >> $GITHUB_ENV
76
+ if [[ '${{ contains(matrix.container, 'nightly') }}' == 'true' ]]; then
77
+ SWIFT_PLATFORM="$(source /etc/os-release && echo "${ID}${VERSION_ID}")" SWIFT_VERSION="$(cat /.swift_tag)"
78
+ printf 'SWIFT_PLATFORM=%s\nSWIFT_VERSION=%s\n' "${SWIFT_PLATFORM}" "${SWIFT_VERSION}" >>"${GITHUB_ENV}"
79
+ fi
80
+ printf 'OS: %s\nTag: %s\nVersion:\n' "${SWIFT_PLATFORM}-${RUNNER_ARCH}" "${SWIFT_VERSION}" && swift --version
115
81
- name : Check out package
116
82
uses : actions/checkout@v3
117
- - name : Run tests with Thread Sanitizer
118
- run : swift test --sanitize=thread
83
+ - name : Run tests with Thread Sanitizer and coverage
84
+ run : swift test --sanitize=thread --enable-code-coverage
85
+ - name : Submit coverage report to Codecov.io
86
+
87
+ with :
88
+ cc_env_vars : ' SWIFT_VERSION,SWIFT_PLATFORM,RUNNER_OS,RUNNER_ARCH,MYSQL_VERSION'
119
89
120
- # Unit tests (macOS)
121
90
macos-unit :
122
- if : ${{ github.event_name == 'pull_request' }}
91
+ if : ${{ !( github.event.pull_request.draft || false) }}
123
92
strategy :
124
93
fail-fast : false
125
94
matrix :
126
- formula :
127
-
128
- macos :
129
- - macos-12
130
- xcode :
131
- - latest-stable
95
+ include :
96
+
97
+ macos : macos-13
98
+ xcode : latest-stable
132
99
runs-on : ${{ matrix.macos }}
133
100
steps :
134
101
- name : Select latest available Xcode
135
102
uses : maxim-lobanov/setup-xcode@v1
136
103
with :
137
104
xcode-version : ${{ matrix.xcode }}
138
105
- name : Install MySQL server from Homebrew
139
- run : brew install ${{ matrix.formula }} && brew link --force ${{ matrix.formula }}
106
+ run : brew install ${{ matrix.dbimage }} && brew link --force ${{ matrix.dbimage }}
140
107
- name : Start MySQL server
141
- run : brew services start ${{ matrix.formula }}
108
+ run : brew services start ${{ matrix.dbimage }}
142
109
- name : Wait for MySQL server to be ready
143
110
run : until echo | mysql -uroot; do sleep 1; done
144
111
timeout-minutes : 5
@@ -158,15 +125,3 @@ jobs:
158
125
MYSQL_HOSTNAME_B : ' 127.0.0.1'
159
126
MYSQL_DATABASE_A : test_database_a
160
127
MYSQL_DATABASE_B : test_database_b
161
-
162
- test-exports :
163
- name : Test exports
164
- runs-on : ubuntu-latest
165
- container : swift:5.8-jammy
166
- steps :
167
- - name : Check out Vapor
168
- uses : actions/checkout@v3
169
- with :
170
- fetch-depth : 0
171
- - name : Build
172
- run : swift build -Xswiftc -DBUILDING_DOCC
0 commit comments