Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ In both cases, the `CASSANDRA_VERSION` environment variable determines which ser

## Building the driver and running tests

DataStax C# drivers target .NET Framework 4.5.2 and .NET Standard 2.0. The test projects target .NET Framework 4.6.2, 4.7.2, 4.8.1 and .NET 6, 7 and 8. To run the code analyzers you need the .NET 8 SDK.
DataStax C# drivers target .NET Standard 2.0. The test projects target .NET 6, 7 and 8. To run the code analyzers you need the .NET 8 SDK.

### Prerequisites

Expand All @@ -115,7 +115,7 @@ dotnet restore src
dotnet build src/Cassandra.sln
```

On Windows, the command `dotnet build src/Cassandra.sln` should succeed while on macOS / Linux it may fail due to the lack of support for .NET Framework builds on non-Windows platforms. In these environments you need to specify a .NET target framework in order to successfully build the project.
The command `dotnet build src/Cassandra.sln` should succeed. Otherwise, you need to specify a .NET target framework in order to successfully build the project.

You can build specific projects against specific target frameworks on any platform like this:

Expand All @@ -133,11 +133,8 @@ Alternatively you can set the `BuildCoreOnly` environment variable which will ca
dotnet test src/Cassandra.Tests/Cassandra.Tests.csproj -f net8
```

The target frameworks supported by the test projects are `net8` and `net481` (by default). If you set the `BuildAllTargets` environment variable, the test projects will support these targets:
The target framework supported by the test projects is `net8` (by default). If you set the `BuildAllTargets` environment variable, the test projects will support these targets:

- `net462`
- `net472`
- `net481`
- `net6`
- `net7`(not LTS, might be removed at some point)
- `net8`
Expand Down
132 changes: 33 additions & 99 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ ENVIRONMENT_EOF
'''
}

if (env.SERVER_VERSION == env.SERVER_VERSION_SNI && env.DOTNET_VERSION != 'mono') {
if (env.SERVER_VERSION == env.SERVER_VERSION_SNI) {
sh label: 'Update environment for SNI proxy tests', script: '''#!/bin/bash -le
# Load CCM and driver configuration environment variables
set -o allexport
Expand All @@ -172,11 +172,7 @@ ENVIRONMENT_EOF
. ${HOME}/environment.txt
set +o allexport

if [ ${DOTNET_VERSION} = 'mono' ]; then
mono --version
else
dotnet --version
fi
dotnet --version
printenv | sort
'''
}
Expand All @@ -201,18 +197,6 @@ def installDependencies() {
mkdir saxon
curl -L -o saxon/saxon9he.jar https://repo1.maven.org/maven2/net/sf/saxon/Saxon-HE/9.8.0-12/Saxon-HE-9.8.0-12.jar
'''

if (env.DOTNET_VERSION == 'mono') {
sh label: 'Install required packages for mono builds', script: '''#!/bin/bash -le
# Define alias for Nuget
nuget() {
mono /usr/local/bin/nuget.exe "$@"
}
export -f nuget

nuget install NUnit.Runners -Version 3.6.1 -OutputDirectory testrunner
'''
}
}
}

Expand All @@ -223,37 +207,23 @@ def buildDriver() {
dotnet restore src
'''
} else {
if (env.DOTNET_VERSION == 'mono') {
sh label: 'Build the driver for mono', script: '''#!/bin/bash -le
export BuildMonoOnly=True
export RunCodeAnalyzers=False
export MSBuildSDKsPath=/home/jenkins/dotnetcli/sdk/$(dotnet --version)/Sdks
msbuild /t:restore /v:m /p:RestoreDisableParallel=true src/Cassandra.sln || true
msbuild /t:restore /v:m /p:RestoreDisableParallel=true src/Cassandra.sln
msbuild /p:Configuration=Release /v:m /p:RestoreDisableParallel=true /p:DynamicConstants=LINUX src/Cassandra.sln || true
msbuild /p:Configuration=Release /v:m /p:RestoreDisableParallel=true /p:DynamicConstants=LINUX src/Cassandra.sln
'''
} else {
sh label: "Work around nuget issue", script: '''#!/bin/bash -le
mkdir -p /tmp/NuGetScratch
chmod -R ugo+rwx /tmp/NuGetScratch
'''
sh label: "Install required packages and build the driver for ${env.DOTNET_VERSION}", script: '''#!/bin/bash -le
dotnet restore src || true
dotnet restore src
'''
}
sh label: "Work around nuget issue", script: '''#!/bin/bash -le
mkdir -p /tmp/NuGetScratch
chmod -R ugo+rwx /tmp/NuGetScratch
'''
sh label: "Install required packages and build the driver for ${env.DOTNET_VERSION}", script: '''#!/bin/bash -le
dotnet restore src || true
dotnet restore src
'''
}
}

def executeTests(perCommitSchedule) {

if (perCommitSchedule) {
env.DOTNET_TEST_FILTER = "(TestCategory!=long)&(TestCategory!=memory)&(TestCategory!=realclusterlong)"
env.MONO_TEST_FILTER = "cat != long && cat != memory && cat != realclusterlong"
} else {
env.DOTNET_TEST_FILTER = "(TestCategory!=long)&(TestCategory!=memory)"
env.MONO_TEST_FILTER = "cat != long && cat != memory"
}

if (env.OS_VERSION.split('/')[0] == 'win') {
Expand All @@ -268,50 +238,28 @@ def executeTests(perCommitSchedule) {
java -jar saxon/saxon9he.jar -o:TestResult.xml TestResult_xunit.xml tools/JUnitXml.xslt
'''
} else {
if (env.DOTNET_VERSION == 'mono') {
catchError {
sh label: 'Execute tests for mono', script: '''#!/bin/bash -le
# Load CCM and driver configuration environment variables
set -o allexport
. ${HOME}/environment.txt
set +o allexport

# Fix Java version at Java8 for now because of dependencies in DSE.
# TODO: This should last us through testing against Cassandra 4.1.x at least but
# will eventually need to be made more generic.
. ${JABBA_SHELL}
jabba use 1.8

mono ./testrunner/NUnit.ConsoleRunner.3.6.1/tools/nunit3-console.exe src/Cassandra.IntegrationTests/bin/Release/net462/Cassandra.IntegrationTests.dll --where "$MONO_TEST_FILTER" --labels=All --result:"TestResult_nunit.xml"
'''
}
sh label: 'Convert the test results using saxon', script: '''#!/bin/bash -le
java -jar saxon/saxon9he.jar -o:TestResult.xml TestResult_nunit.xml tools/nunit3-junit.xslt
'''
} else {
catchError {
sh label: "Execute tests for ${env.DOTNET_VERSION}", script: '''#!/bin/bash -le
# Load CCM and driver configuration environment variables
set -o allexport
. ${HOME}/environment.txt
set +o allexport

# Fix Java version at Java8 for now because of dependencies in DSE.
# TODO: This should last us through testing against Cassandra 4.1.x at least but
# will eventually need to be made more generic.
. ${JABBA_SHELL}
jabba use 1.8

export OPENSSL_CONF=/home/jenkins/openssl.cnf

dotnet test src/Cassandra.IntegrationTests/Cassandra.IntegrationTests.csproj -v n -f ${DOTNET_VERSION} -c Release --filter $DOTNET_TEST_FILTER --logger "xunit;LogFilePath=../../TestResult_xunit.xml"
'''
}
sh label: 'Convert the test results using saxon', script: '''#!/bin/bash -le
java -jar saxon/saxon9he.jar -o:TestResult.xml TestResult_xunit.xml tools/JUnitXml.xslt
catchError {
sh label: "Execute tests for ${env.DOTNET_VERSION}", script: '''#!/bin/bash -le
# Load CCM and driver configuration environment variables
set -o allexport
. ${HOME}/environment.txt
set +o allexport

# Fix Java version at Java8 for now because of dependencies in DSE.
# TODO: This should last us through testing against Cassandra 4.1.x at least but
# will eventually need to be made more generic.
. ${JABBA_SHELL}
jabba use 1.8

export OPENSSL_CONF=/home/jenkins/openssl.cnf

dotnet test src/Cassandra.IntegrationTests/Cassandra.IntegrationTests.csproj -v n -f ${DOTNET_VERSION} -c Release --filter $DOTNET_TEST_FILTER --logger "xunit;LogFilePath=../../TestResult_xunit.xml"
'''
}
}
}
sh label: 'Convert the test results using saxon', script: '''#!/bin/bash -le
java -jar saxon/saxon9he.jar -o:TestResult.xml TestResult_xunit.xml tools/JUnitXml.xslt
'''
}
}

def notifySlack(status = 'started') {
Expand Down Expand Up @@ -448,35 +396,21 @@ pipeline {
values '3.11', // latest 3.11.x Apache Cassandra�
'4.1', // latest 4.x Apache Cassandra�
'5.0', // Development Apache Cassandra�
'dse-5.1.35', // latest 5.1.x DataStax Enterprise
'dse-6.8.30', // latest 6.7.x DataStax Enterprise
'dse-6.9.3', // latest DataStax Enterprise
'hcd-1.0.0' // Hyper-Converged Database
}
axis {
name 'DOTNET_VERSION'
values 'mono', 'net8', 'net6'
values 'net8', 'net6'
}
}
excludes {
exclude {
axis {
name 'DOTNET_VERSION'
values 'mono'
}
axis {
name 'SERVER_VERSION'
values '3.11', '4.1', 'dse-5.1.35', 'dse-6.8.30'
}
}
exclude {
axis {
name 'DOTNET_VERSION'
values 'net8'
}
axis {
name 'SERVER_VERSION'
values '3.11', '5.0', 'dse-6.9.3', 'hcd-1.0.0'
values '3.11', '5.0'
}
}
}
Expand Down
Loading