Skip to content

Commit 5bdadfb

Browse files
tolbertamolim7t
authored andcommitted
Add appveyor continuous integration support
Enables continuous integration of builds against a windows platform. 'short' profile test runs will now be publically visible for pull requests against the latest C* version and JDK8. Unit tests run for jdk6 and jdk7.
1 parent e3d26ca commit 5bdadfb

4 files changed

Lines changed: 168 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Datastax Java Driver for Apache Cassandra
22

3-
[![Build Status](https://travis-ci.org/datastax/java-driver.svg?branch=3.0.x)](https://travis-ci.org/datastax/java-driver)
3+
[![Build Status](https://travis-ci.org/datastax/java-driver.svg?branch=3.0.x)](https://travis-ci.org/datastax/java-driver) [![Build status](https://ci.appveyor.com/api/projects/status/717ysg5l1si1h3pi/branch/3.0.x?svg=true)](https://ci.appveyor.com/project/DataStax/java-driver/branch/3.0.x)
44

55
*If you're reading this on github.com, please note that this is the readme
66
for the development version and that some features described here might

ci/appveyor.ps1

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
Add-Type -AssemblyName System.IO.Compression.FileSystem
2+
3+
$dep_dir="C:\Users\appveyor\deps"
4+
If (!(Test-Path $dep_dir)) {
5+
Write-Host "Creating $($dep_dir)"
6+
New-Item -Path $dep_dir -ItemType Directory -Force
7+
}
8+
9+
$apr_platform = "Win32"
10+
$openssl_platform = "Win32"
11+
$vc_platform = "x86"
12+
$env:PYTHON="C:\Python27"
13+
$env:OPENSSL_PATH="C:\OpenSSL-Win32"
14+
If ($env:PLATFORM -eq "X64") {
15+
$apr_platform = "x64"
16+
$vc_platform = "x64"
17+
$env:PYTHON="C:\Python27-x64"
18+
$env:OPENSSL_PATH="C:\OpenSSL-Win64"
19+
}
20+
21+
$env:JAVA_HOME="C:\Program Files\Java\jdk$($env:java_version)"
22+
$env:JAVA_8_HOME="C:\Program Files\Java\jdk1.8.0"
23+
$env:PATH="$($env:PYTHON);$($env:PYTHON)\Scripts;$($env:JAVA_HOME)\bin;$($env:OPENSSL_PATH)\bin;$($env:PATH)"
24+
$env:CCM_PATH="$($dep_dir)\ccm"
25+
26+
$apr_dist_path = "$($dep_dir)\apr"
27+
# Build APR if it hasn't been previously built.
28+
If (!(Test-Path $apr_dist_path)) {
29+
Write-Host "Cloning APR"
30+
$apr_path = "C:\Users\appveyor\apr"
31+
Start-Process git -ArgumentList "clone --branch=1.5.2 --depth=1 https://github.com/apache/apr.git $($apr_path)" -Wait -nnw
32+
Write-Host "Setting Visual Studio Environment to VS 2015"
33+
Push-Location "$($env:VS140COMNTOOLS)\..\..\VC"
34+
cmd /c "vcvarsall.bat $vc_platform & set" |
35+
foreach {
36+
if ($_ -match "=") {
37+
$v = $_.split("="); Set-Item -force -path "ENV:\$($v[0])" -value "$($v[1])"
38+
}
39+
}
40+
Pop-Location
41+
Write-Host "Building APR (an error may be printed, but it will still build)"
42+
Push-Location $($apr_path)
43+
cmd /c nmake -f Makefile.win ARCH="$apr_platform Release" PREFIX=$($apr_dist_path) buildall install
44+
Pop-Location
45+
Write-Host "Done Building APR"
46+
}
47+
$env:PATH="$($apr_dist_path)\bin;$($env:PATH)"
48+
49+
# Install Ant and Maven
50+
$ant_base = "$($dep_dir)\ant"
51+
$ant_path = "$($ant_base)\apache-ant-1.9.7"
52+
If (!(Test-Path $ant_path)) {
53+
Write-Host "Installing Ant"
54+
$ant_url = "https://www.dropbox.com/s/lgx95x1jr6s787l/apache-ant-1.9.7-bin.zip?dl=1"
55+
$ant_zip = "C:\Users\appveyor\apache-ant-1.9.7-bin.zip"
56+
(new-object System.Net.WebClient).DownloadFile($ant_url, $ant_zip)
57+
[System.IO.Compression.ZipFile]::ExtractToDirectory($ant_zip, $ant_base)
58+
}
59+
$env:PATH="$($ant_path)\bin;$($env:PATH)"
60+
61+
$maven_base = "$($dep_dir)\maven"
62+
$maven_path = "$($maven_base)\apache-maven-3.2.5"
63+
If (!(Test-Path $maven_path)) {
64+
Write-Host "Installing Maven"
65+
$maven_url = "https://www.dropbox.com/s/fh9kffmexprsmha/apache-maven-3.2.5-bin.zip?dl=1"
66+
$maven_zip = "C:\Users\appveyor\apache-maven-3.2.5-bin.zip"
67+
(new-object System.Net.WebClient).DownloadFile($maven_url, $maven_zip)
68+
[System.IO.Compression.ZipFile]::ExtractToDirectory($maven_zip, $maven_base)
69+
}
70+
$env:PATH="$($maven_path)\bin;$($env:PATH)"
71+
72+
$jdks = @("1.6.0", "1.7.0", "1.8.0")
73+
foreach ($jdk in $jdks) {
74+
$java_dir = "C:\Program Files\Java\jdk$jdk"
75+
$jce_target = "$java_dir\jre\lib\security"
76+
$jce_indicator = "$jce_target\README.txt"
77+
# Install Java Cryptographic Extensions, needed for SSL.
78+
# If this file doesn't exist we know JCE hasn't been installed.
79+
If (!(Test-Path $jce_indicator)) {
80+
Write-Host "Installing JCE for $jdk"
81+
$zip = "$dep_dir\jce_policy-$jdk.zip"
82+
$url = "https://www.dropbox.com/s/po4308hlwulpvep/UnlimitedJCEPolicyJDK7.zip?dl=1"
83+
$extract_folder = "UnlimitedJCEPolicy"
84+
If ($jdk -eq "1.8.0") {
85+
$url = "https://www.dropbox.com/s/al1e6e92cjdv7m7/jce_policy-8.zip?dl=1"
86+
$extract_folder = "UnlimitedJCEPolicyJDK8"
87+
}
88+
ElseIf ($jdk -eq "1.6.0") {
89+
$url = "https://www.dropbox.com/s/dhrtucxcif4n11k/jce_policy-6.zip?dl=1"
90+
$extract_folder = "jce"
91+
}
92+
# Download zip to staging area if it doesn't exist, we do this because
93+
# we extract it to the directory based on the platform and we want to cache
94+
# this file so it can apply to all platforms.
95+
if(!(Test-Path $zip)) {
96+
(new-object System.Net.WebClient).DownloadFile($url, $zip)
97+
}
98+
99+
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $jce_target)
100+
101+
$jcePolicyDir = "$jce_target\$extract_folder"
102+
Move-Item $jcePolicyDir\* $jce_target\ -force
103+
Remove-Item $jcePolicyDir
104+
}
105+
}
106+
107+
# Install Python Dependencies for CCM.
108+
Write-Host "Installing Python Dependencies for CCM"
109+
Start-Process python -ArgumentList "-m pip install psutil pyYaml six" -Wait -nnw
110+
111+
# Clone ccm from git and use master.
112+
If (!(Test-Path $env:CCM_PATH)) {
113+
Write-Host "Cloning CCM"
114+
Start-Process git -ArgumentList "clone https://github.com/pcmanus/ccm.git $($env:CCM_PATH)" -Wait -nnw
115+
}
116+
117+
# Copy ccm -> ccm.py so windows knows to run it.
118+
If (!(Test-Path $env:CCM_PATH\ccm.py)) {
119+
Copy-Item "$env:CCM_PATH\ccm" "$env:CCM_PATH\ccm.py"
120+
}
121+
$env:PYTHONPATH="$($env:CCM_PATH);$($env:PYTHONPATH)"
122+
$env:PATH="$($env:CCM_PATH);$($env:PATH)"
123+
124+
# Predownload cassandra version for CCM if it isn't already downloaded.
125+
If (!(Test-Path C:\Users\appveyor\.ccm\repository\$env:cassandra_version)) {
126+
Write-Host "Preinstalling C* $($env:cassandra_version)"
127+
Start-Process python -ArgumentList "$($env:CCM_PATH)\ccm.py create -v $($env:cassandra_version) -n 1 predownload" -Wait -nnw
128+
Start-Process python -ArgumentList "$($env:CCM_PATH)\ccm.py remove predownload" -Wait -nnw
129+
}

ci/appveyor.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
environment:
2+
test_profile: default
3+
cassandra_version: 3.5
4+
matrix:
5+
- java_version: 1.6.0
6+
- java_version: 1.7.0
7+
- java_version: 1.8.0
8+
test_profile: short
9+
platform: x64
10+
install:
11+
- ps: .\ci\appveyor.ps1
12+
build_script:
13+
- mvn -B install -DskipTests=true
14+
test_script:
15+
- "mvn -B -Dccm.java.home=\"%JAVA_8_HOME%\" -Dccm.maxNumberOfNodes=1 -Dcassandra.version=%cassandra_version% verify -P%test_profile%"
16+
on_finish:
17+
- ps: .\ci\uploadtests.ps1
18+
cache:
19+
- C:\Users\appveyor\.m2
20+
- C:\Users\appveyor\.ccm\repository
21+
- C:\Users\appveyor\deps -> .\ci\appveyor.ps1

ci/uploadtests.ps1

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
$testResults=Get-ChildItem TEST-TestSuite.xml -Recurse
2+
3+
Write-Host "Uploading test results."
4+
5+
$url = "https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)"
6+
$wc = New-Object 'System.Net.WebClient'
7+
8+
foreach ($testResult in $testResults) {
9+
try {
10+
Write-Host -ForegroundColor Green "Uploading $testResult -> $url."
11+
$wc.UploadFile($url, $testResult)
12+
} catch [Net.WebException] {
13+
Write-Host -ForegroundColor Red "Failed Uploading $testResult -> $url. $_"
14+
}
15+
}
16+
17+
Write-Host "Done uploading test results."

0 commit comments

Comments
 (0)