Skip to content

Commit f505023

Browse files
committed
Appveyor
1 parent 0391dbc commit f505023

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

appveyor.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: 4.2.5.{build}
2+
init:
3+
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
4+
- SET PATH=C:\MinGW\msys\1.0\bin;%PATH%
5+
- SET RAKEOPT=-rdevkit
6+
clone_depth: 5
7+
skip_tags: true
8+
matrix:
9+
fast_finish: true
10+
install:
11+
- ruby --version
12+
- gem --version
13+
- bundle install --without odbc
14+
build: off
15+
test_script:
16+
- powershell -File "%APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.ps1"
17+
- timeout /t 4 /nobreak > NUL
18+
- ps: Start-Service 'MSSQL$SQL2014'
19+
- timeout /t 4 /nobreak > NUL
20+
- sqlcmd -S ".\SQL2014" -U sa -P Password12! -i %APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.sql
21+
- bundle exec rake test ACTIVERECORD_UNITTEST_DATASERVER="localhost\SQL2014"
22+
- ps: Stop-Service 'MSSQL$SQL2014'
23+
- ps: Start-Service 'MSSQL$SQL2012SP1'
24+
- timeout /t 4 /nobreak > NUL
25+
- sqlcmd -S ".\SQL2012SP1" -U sa -P Password12! -i %APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.sql
26+
- bundle exec rake test ACTIVERECORD_UNITTEST_DATASERVER="localhost\SQL2012SP1"
27+
environment:
28+
matrix:
29+
# - ruby_version: "193"
30+
# - ruby_version: "200-x64"
31+
# - ruby_version: "21-x64"
32+
- ruby_version: "22-x64"

test/appveyor/dbsetup.ps1

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
Write-Output "Setting up..."
3+
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null
4+
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement") | Out-Null
5+
6+
Write-Output "Setting variables..."
7+
$serverName = $env:COMPUTERNAME
8+
$instances = @('SQL2012SP1', 'SQL2014')
9+
$smo = 'Microsoft.SqlServer.Management.Smo.'
10+
$wmi = new-object ($smo + 'Wmi.ManagedComputer')
11+
12+
Write-Output "Configure Instances..."
13+
foreach ($instance in $instances) {
14+
Write-Output "Instance $instance ..."
15+
Write-Output "Enable TCP/IP and port 1433..."
16+
$uri = "ManagedComputer[@Name='$serverName']/ServerInstance[@Name='$instance']/ServerProtocol[@Name='Tcp']"
17+
$tcp = $wmi.GetSmoObject($uri)
18+
$tcp.IsEnabled = $true
19+
foreach ($ipAddress in $Tcp.IPAddresses) {
20+
$ipAddress.IPAddressProperties["TcpDynamicPorts"].Value = ""
21+
$ipAddress.IPAddressProperties["TcpPort"].Value = "1433"
22+
}
23+
$tcp.Alter()
24+
}
25+
26+
Set-Service SQLBrowser -StartupType Manual
27+
Start-Service SQLBrowser

test/appveyor/dbsetup.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CREATE DATABASE [activerecord_unittest];
2+
CREATE DATABASE [activerecord_unittest2];
3+
GO
4+
CREATE LOGIN [rails] WITH PASSWORD = '', CHECK_POLICY = OFF, DEFAULT_DATABASE = [activerecord_unittest];
5+
EXEC sp_addrolemember N'sysadmin', N'rails';
6+
GO
7+
USE [activerecord_unittest];
8+
CREATE USER [rails] FOR LOGIN [rails];
9+
GO
10+
EXEC sp_addrolemember N'db_owner', N'rails';
11+
GO

0 commit comments

Comments
 (0)