-
-
Notifications
You must be signed in to change notification settings - Fork 26
153 lines (149 loc) · 5.6 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request: { types: [opened, reopened, synchronize, ready_for_review] }
push: { branches: [ main ] }
env:
LOG_LEVEL: info
SWIFT_DETERMINISTIC_HASHING: 1
MYSQL_DATABASE: 'test_database'
MYSQL_DATABASE_A: 'test_database'
MYSQL_DATABASE_B: 'test_database'
MYSQL_USERNAME: 'test_username'
MYSQL_USERNAME_A: 'test_username'
MYSQL_USERNAME_B: 'test_username'
MYSQL_PASSWORD: 'test_password'
MYSQL_PASSWORD_A: 'test_password'
MYSQL_PASSWORD_B: 'test_password'
MYSQL_HOSTNAME: 'mysql-a'
MYSQL_HOSTNAME_A: 'mysql-a'
MYSQL_HOSTNAME_B: 'mysql-b'
jobs:
api-breakage:
if: ${{ !(github.event.pull_request.draft || false) }}
runs-on: ubuntu-latest
container: swift:jammy
steps:
- name: Check out code
uses: actions/checkout@v4
with: { 'fetch-depth': 0 }
- name: Run API breakage check
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
swift package diagnose-api-breaking-changes origin/main
# gh-codeql:
# if: ${{ !(github.event.pull_request.draft || false) }}
# runs-on: ubuntu-latest
# permissions: { actions: write, contents: read, security-events: write }
# timeout-minutes: 30
# steps:
# - name: Install latest Swift toolchain
# uses: vapor/swiftly-action@v0.1
# with: { toolchain: latest }
# - name: Check out code
# uses: actions/checkout@v4
# - name: Fix Git configuration
# run: 'git config --global --add safe.directory "${GITHUB_WORKSPACE}"'
# - name: Initialize CodeQL
# uses: github/codeql-action/init@v3
# with: { languages: swift }
# - name: Perform build
# run: 'swift build ${PACKAGE_ROOT} ${EXTRA_FLAGS}'
# - name: Run CodeQL analyze
# uses: github/codeql-action/analyze@v3
linux-all:
if: ${{ !(github.event.pull_request.draft || false) }}
strategy:
fail-fast: false
matrix:
dbimage:
- mysql:5.7
- mysql:8.2
- mariadb:10.2
- mariadb:11
- percona:5.7
- percona:8
swiftver:
- swift:5.8-jammy
- swift:5.9-jammy
- swift:5.10-jammy
- swiftlang/swift:nightly-6.0-jammy
- swiftlang/swift:nightly-main-jammy
runs-on: ubuntu-latest
container: ${{ matrix.swiftver }}
services:
mysql-a:
image: ${{ matrix.dbimage }}
env: { MYSQL_ALLOW_EMPTY_PASSWORD: true, MYSQL_USER: test_username, MYSQL_PASSWORD: test_password, MYSQL_DATABASE: test_database }
mysql-b:
image: ${{ matrix.dbimage }}
env: { MYSQL_ALLOW_EMPTY_PASSWORD: true, MYSQL_USER: test_username, MYSQL_PASSWORD: test_password, MYSQL_DATABASE: test_database }
steps:
- name: Check out package
uses: actions/checkout@v4
with: { path: 'mysql-nio' }
- name: Run unit tests
run: swift test --package-path mysql-nio --enable-code-coverage --sanitize=thread
- name: Upload code coverage
uses: vapor/swift-codecov-action@v0.3
with:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
package_path: 'mysql-nio'
- name: Check out mysql-kit dependent
uses: actions/checkout@v4
with: { repository: 'vapor/mysql-kit', path: 'mysql-kit' }
- name: Check out fluent-mysql-driver dependent
uses: actions/checkout@v4
with: { repository: 'vapor/fluent-mysql-driver', path: 'fluent-mysql-driver' }
- name: Use local package in dependents
run: |
swift package --package-path mysql-kit edit mysql-nio --path mysql-nio
swift package --package-path fluent-mysql-driver edit mysql-nio --path mysql-nio
- name: Run mysql-kit tests
run: swift test --package-path mysql-kit
- name: Run fluent-mysql-driver tests
run: swift test --package-path fluent-mysql-driver
macos-all:
if: ${{ !(github.event.pull_request.draft || false) }}
strategy:
fail-fast: false
matrix:
dbimage: [mysql, mariadb, percona-server]
macos-version: ['macos-13', 'macos-14']
include:
- { username: root }
- { dbimage: mariadb, username: runner }
- { macos-version: 'macos-13', xcode-version: '~15.2' }
- { macos-version: 'macos-14', xcode-version: 'latest' }
runs-on: ${{ matrix.macos-version }}
env: { MYSQL_HOSTNAME: '127.0.0.1' }
steps:
- name: Select latest available Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode-version }}
- name: Install MySQL, setup DB and auth, and wait for server start
env:
FORMULA: ${{ matrix.dbimage }}
RUNAS_USER: ${{ matrix.username }}
shell: bash
run: |
brew install "${FORMULA}" && brew link --force "${FORMULA}"
brew services start "${FORMULA}"
until echo | mysql -u"${RUNAS_USER}"; do sleep 1; done
mysql -u"${RUNAS_USER}" --batch <<-SQL
CREATE USER ${MYSQL_USERNAME}@localhost IDENTIFIED BY '${MYSQL_PASSWORD}';
CREATE DATABASE ${MYSQL_DATABASE};
GRANT ALL PRIVILEGES ON ${MYSQL_DATABASE}.* TO ${MYSQL_USERNAME}@localhost;
SQL
timeout-minutes: 5
- name: Check out code
uses: actions/checkout@v4
- name: Run all tests
run: swift test --sanitize=thread --enable-code-coverage
- name: Upload code coverage
uses: vapor/swift-codecov-action@v0.3
with:
codecov_token: ${{ secrets.CODECOV_TOKEN }}