-
Notifications
You must be signed in to change notification settings - Fork 126
222 lines (182 loc) · 6.71 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
name: Cargo tests
on:
push:
branches:
- main
pull_request:
jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
components: clippy
override: true
- name: Install dependencies
run: sudo apt install -y openssl libkrb5-dev
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --features=all
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
components: rustfmt
override: true
- uses: mbrobbel/rustfmt-check@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
cargo-test-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
database:
- 2017
- 2019
- 2022
- azure-sql-edge
features:
- "--features=all"
- "--no-default-features"
- "--no-default-features --features=chrono"
- "--no-default-features --features=time"
- "--no-default-features --features=rustls"
- "--no-default-features --features=vendored-openssl"
env:
TIBERIUS_TEST_CONNECTION_STRING: "server=tcp:localhost,1433;user=SA;password=<YourStrong@Passw0rd>;TrustServerCertificate=true"
RUSTFLAGS: "-Dwarnings"
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ matrix.features }}
- name: Start SQL Server ${{matrix.database}}
run: DOCKER_BUILDKIT=1 docker-compose -f docker-compose.yml up -d mssql-${{matrix.database}}
- name: Install dependencies
run: sudo apt install -y openssl libkrb5-dev
- name: Run tests
run: cargo test ${{matrix.features}}
cargo-test-windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
database:
- 2019
features:
- "--features=all"
- "--no-default-features --features=rustls,winauth"
- "--no-default-features --features=vendored-openssl,winauth"
env:
TIBERIUS_TEST_INSTANCE: "MSSQLSERVER"
TIBERIUS_TEST_CONNECTION_STRING: "server=tcp:127.0.0.1,1433;IntegratedSecurity=true;TrustServerCertificate=true"
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- name: Set required PowerShell modules
id: psmodulecache
uses: potatoqualitee/psmodulecache@v1
with:
modules-to-cache: SqlServer
- name: Setup PowerShell module cache
id: cacher
uses: actions/cache@v2
with:
path: ${{ steps.psmodulecache.outputs.modulepath }}
key: ${{ steps.psmodulecache.outputs.keygen }}
- name: Setup Chocolatey download cache
id: chococache
uses: actions/cache@v2
with:
path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey\
key: chocolatey-install
- name: Setup Cargo build cache
uses: actions/cache@v2
with:
path: |
C:\Users\runneradmin\.cargo\registry
C:\Users\runneradmin\.cargo\git
target
key: ${{ runner.os }}-cargo
- name: Install required PowerShell modules
if: steps.cacher.outputs.cache-hit != 'true'
shell: powershell
run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module SqlServer
- name: Install SQL Server ${{matrix.database}}
shell: powershell
run: |
choco feature disable --name="'exitOnRebootDetected'"
$ErrorActionPreference = 'SilentlyContinue'
choco install sql-server-${{matrix.database}} --params="'/IgnorePendingReboot'"
- name: Setup SQL Server ${{matrix.database}}
shell: powershell
run: |
Import-Module 'sqlps'
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement") | Out-Null
$serverName = $env:COMPUTERNAME
$instanceName = "MSSQLSERVER"
$smo = 'Microsoft.SqlServer.Management.Smo.'
$wmi = new-object ($smo + 'Wmi.ManagedComputer')
$wmi
# Enable TCP/IP
echo "Enabling TCP/IP"
$Tcp = $wmi.GetSmoObject("ManagedComputer[@Name='$serverName']/ServerInstance[@Name='$instanceName']/ServerProtocol[@Name='Tcp']")
$Tcp.IsEnabled = $true
$Tcp.alter()
$Tcp
# Enable named pipes
echo "Enabling named pipes"
$Np = $wmi.GetSmoObject("ManagedComputer[@Name='$serverName']/ServerInstance[@Name='$instanceName']/ServerProtocol[@Name='Np']")
$Np.IsEnabled = $true
$Np.Alter()
$Np
# Set Alias
echo "Setting the alias"
New-Item HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client -Name ConnectTo | Out-Null
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo -Name '(local)' -Value "DBMSSOCN,$serverName\$instanceName" | Out-Null
# Start services
echo "Starting services"
Set-Service SQLBrowser -StartupType Manual
Start-Service SQLBrowser
net stop MSSQLSERVER
net start MSSQLSERVER
- name: Run normal tests
shell: powershell
run: cargo test ${{matrix.features}}
cargo-test-macos:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
database:
- 2019
features:
- "--no-default-features --features=rustls,chrono,time,tds73,sql-browser-async-std,sql-browser-tokio,sql-browser-smol,integrated-auth-gssapi,rust_decimal,bigdecimal"
- "--no-default-features --features=vendored-openssl"
env:
TIBERIUS_TEST_CONNECTION_STRING: "server=tcp:localhost,1433;user=SA;password=<YourStrong@Passw0rd>;TrustServerCertificate=true"
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- name: Install docker # Taken from https://github.com/actions/virtual-environments/issues/1143#issuecomment-652264388
run: |
brew install docker
colima start
# - uses: docker-practice/actions-setup-docker@master
- name: Start SQL Server ${{matrix.database}}
run: DOCKER_BUILDKIT=1 docker-compose -f docker-compose.yml up -d mssql-${{matrix.database}}
- name: Run tests
run: cargo test ${{matrix.features}}