Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RCB-612: prepare for 1.24.0 release #113

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
Open
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,6 @@ test.bat
# Examples
rosette_apiExamples/*.exe
rosette_apiExamples/*.dll

# Sonar
.sonarqube/
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

60 changes: 60 additions & 0 deletions CI.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
node ("docker-light") {
def sourceDir = pwd()
try {
stage("Clean up") {
step([$class: 'WsCleanup'])
}
stage("Checkout Code") {
checkout scm
}
stage("Build & Test") {
withSonarQubeEnv {
// TODO: Remove if we branch references work, otherwise, pass these to the exe somehow.
//if ("${env.CHANGE_BRANCH}" != "null") {
// mySonarOpts="$mySonarOpts -Dsonar.pullrequest.key=${env.CHANGE_ID} -Dsonar.pullrequest.base=${env.CHANGE_TARGET} -Dsonar.pullrequest.branch=${env.CHANGE_BRANCH}"
//}
//echo("Sonar Options are: $mySonarOpts")
// https://github.com/KSP-CKAN/CKAN/wiki/SSL-certificate-errors#removing-expired-lets-encrypt-certificates
// Reference for sed command and cert sync steps.
sh "docker run --rm \
--pull always \
--volume ${sourceDir}:/source \
mono:6 \
bash -c \"apt-get update && \
apt-get install unzip default-jre-headless -y && \
sed -i 's,^mozilla/DST_Root_CA_X3.crt\$,!mozilla/DST_Root_CA_X3.crt,' /etc/ca-certificates.conf && \
update-ca-certificates && \
cert-sync /etc/ssl/certs/ca-certificates.crt && \
mkdir -p /opt/sonar-scanner && \
pushd /opt/sonar-scanner && \
curl --silent --output sonar-scanner.zip --location https://github.com/SonarSource/sonar-scanner-msbuild/releases/download/5.9.2.58699/sonar-scanner-msbuild-5.9.2.58699-net46.zip && \
unzip sonar-scanner.zip && \
chmod a+x /opt/sonar-scanner/sonar-scanner-*/bin/* && \
pushd /source && \
mono /opt/sonar-scanner/SonarScanner.MSBuild.exe begin /k:\"rosette-api-csharp-binding\" /d:sonar.login=\"${env.SONAR_AUTH_TOKEN}\" /d:sonar.host.url=\"${env.SONAR_HOST_URL}\" && \
nuget restore rosette_api.sln && \
msbuild /p:Configuration=Release rosette_api.sln /t:Rebuild && \
mono /opt/sonar-scanner/SonarScanner.MSBuild.exe end /d:sonar.login=\"${env.SONAR_AUTH_TOKEN}\" && \
mono ./packages/NUnit.Console.3.0.1/tools/nunit3-console.exe ./rosette_apiUnitTests/bin/Release/rosette_apiUnitTests.dll\""
// TODO: Finish coverage data gathering for Sonar.
///opt/maven-basis/bin/mvn --batch-mode clean install sonar:sonar $mySonarOpts\""
//pushd /tmp
//dotcover_version=2022.3.1
//curl --silent --location --output dotcover.tar.gz https://download.jetbrains.com/resharper/dotUltimate.2022.3.1/JetBrains.dotCover.CommandLineTools.linux-x64.2022.3.1.tar.gz
//tar xzf dotcover.tar.gz
}
}
slack(true)
} catch (e) {
currentBuild.result = "FAILED"
slack(false)
throw e
}
}

def slack(boolean success) {
def color = success ? "#00FF00" : "#FF0000"
def status = success ? "SUCCESSFUL" : "FAILED"
def message = status + ": Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})"
slackSend(color: color, channel: "#p-n-c_jenkins", message: message)
}
14 changes: 12 additions & 2 deletions rosette_api/EntityID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ public EntityID(string id)
/// Creates a link to the Wikipedia article for this EntityID's ID if it is a QID. If the ID is not a QID, this method returns null.
/// </summary>
/// <returns>The valid Wikipedia link or null.</returns>
public string GetWikipedaURL()
public string GetWikipediaURL()
{
string siteLink = ("https://www.wikidata.org/w/api.php?action=wbgetentities&ids=" + ID + "&sitefilter=enwiki&props=sitelinks&format=json");
try
{
string jsonStr = MakeRequest(siteLink).Result;
string jsonStr = MakeRequest(siteLink).Result;
int lengthOfTitle = jsonStr.IndexOf("\"badges\":") - jsonStr.IndexOf("\"title\":") - 11;
string title = jsonStr.Substring(jsonStr.IndexOf("\"title\":") + 9, lengthOfTitle);
title = title.Replace(" ", "_");
Expand All @@ -53,6 +53,16 @@ public string GetWikipedaURL()
}
}

/// <summary>
/// Creates a link to the Wikipedia article for this EntityID's ID if it is a QID. If the ID is not a QID, this method returns null.
/// </summary>
/// <returns>The valid Wikipedia link or null.</returns>
[Obsolete("GetWikipedaURL is deprecated, please use GetWikipediaURL instead.")]
public string GetWikipedaURL()
{
return GetWikipediaURL();
}

private async Task<string> MakeRequest(string requestUrl)
{
try
Expand Down
8 changes: 4 additions & 4 deletions rosette_api/packages.config
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
<package id="System.Net.Http" version="4.3.4" targetFramework="net45" />
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net45" />
<package id="System.Net.Http" version="4.3.4" targetFramework="net45" />
</packages>
6 changes: 3 additions & 3 deletions rosette_api/rosette_api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Address.cs" />
Expand Down
16 changes: 12 additions & 4 deletions rosette_apiExamples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,20 @@ Here are some methods for running the examples.
```
cd /csharp
nuget restore rosette_api.sln
xbuild /p:Configuration=Release rosette_api.sln
msbuild /p:Configuration=Release rosette_api.sln
```
- _Optional:_ Run the Unit Tests.
```
mono ./packages/NUnit.Console.3.0.1/tools/nunit3-console.exe ./rosette_apiUnitTests/bin/Release/rosette_apiUnitTests.dll
```
- First, fix the certificate store so we can download wikidata.
Per: https://github.com/KSP-CKAN/CKAN/wiki/SSL-certificate-errors#removing-expired-lets-encrypt-certificates
```
sed -i 's/^mozilla\/DST_Root_CA_X3.crt$/!mozilla\/DST_Root_CA_X3.crt/' /etc/ca-certificates.conf
update-ca-certificates
cert-sync /etc/ssl/certs/ca-certificates.crt
```
- Then run the tests.
```
mono ./packages/NUnit.Console.3.0.1/tools/nunit3-console.exe ./rosette_apiUnitTests/bin/Release/rosette_apiUnitTests.dll
```
- Copy the runtime binaries to the examples directory.
```
cp packages/Newtonsoft.Json.10.0.3/lib/net45/Newtonsoft.Json.dll rosette_apiExamples/.
Expand Down
26 changes: 13 additions & 13 deletions rosette_apiUnitTests/packages.config
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LinqToExcel" version="1.11.0" targetFramework="net452" />
<package id="log4net" version="2.0.10" targetFramework="net452" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net452" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net452" />
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net452" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net452" />
<package id="NUnit" version="3.8.1" targetFramework="net452" />
<package id="NUnit3TestAdapter" version="3.9.0" targetFramework="net452" />
<package id="NUnitTestAdapter" version="2.1.1" targetFramework="net452" />
<package id="RichardSzalay.MockHttp" version="3.2.1" targetFramework="net452" />
<package id="System.Net.Http" version="4.3.4" targetFramework="net452" />
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LinqToExcel" version="1.11.0" targetFramework="net452" />
<package id="log4net" version="2.0.15" targetFramework="net452" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net452" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net452" />
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net452" />
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net452" />
<package id="NUnit" version="3.13.3" targetFramework="net452" />
<package id="NUnit3TestAdapter" version="4.3.1" targetFramework="net452" />
<package id="NUnitTestAdapter" version="2.3.0" targetFramework="net452" />
<package id="RichardSzalay.MockHttp" version="6.0.0" targetFramework="net452" />
<package id="System.Net.Http" version="4.3.4" targetFramework="net452" />
</packages>
8 changes: 4 additions & 4 deletions rosette_apiUnitTests/rosette_apiUnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -787,22 +787,22 @@ public void EntityIDTestPassOnCreate()
EntityID pass = new EntityID("Q1") {
ID = "Q1"
};
Assert.AreEqual("https://en.wikipedia.org/wiki/Universe", pass.GetWikipedaURL());
Assert.AreEqual("https://en.wikipedia.org/wiki/Universe", pass.GetWikipediaURL());
}

[Test]
public void EntityIDTestLinkValidOnSet() {
EntityID tidAtFirst = new EntityID("T423");
Assert.AreEqual(null, tidAtFirst.GetWikipedaURL());
Assert.AreEqual(null, tidAtFirst.GetWikipediaURL());
tidAtFirst.ID = "Q2";
Assert.AreEqual("https://en.wikipedia.org/wiki/Earth", tidAtFirst.GetWikipedaURL());
Assert.AreEqual("https://en.wikipedia.org/wiki/Earth", tidAtFirst.GetWikipediaURL());
}

[Test]
public void EntityIDLinkNullOnSetToNull()
{
EntityID eid = new EntityID(null);
Assert.AreEqual(null, eid.GetWikipedaURL());
Assert.AreEqual(null, eid.GetWikipediaURL());
}

//------------------------- Language ----------------------------------------
Expand Down
35 changes: 17 additions & 18 deletions rosette_apiUnitTests/rosette_apiUnitTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit3TestAdapter.3.9.0\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.3.9.0\build\net35\NUnit3TestAdapter.props')" />
<Import Project="..\packages\NUnitTestAdapter.2.3.0\build\NUnitTestAdapter.props" Condition="Exists('..\packages\NUnitTestAdapter.2.3.0\build\NUnitTestAdapter.props')" />
<Import Project="..\packages\NUnit3TestAdapter.4.3.1\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.4.3.1\build\net35\NUnit3TestAdapter.props')" />
<Import Project="..\packages\NUnit.3.13.3\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -9,10 +11,8 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>rosette_apiUnitTests</RootNamespace>
<AssemblyName>rosette_apiUnitTests</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
Expand Down Expand Up @@ -48,15 +48,6 @@
<Reference Include="LinqToExcel, Version=1.11.0.0, Culture=neutral, PublicKeyToken=9c8ea65a58f03f1f, processorArchitecture=MSIL">
<HintPath>..\packages\LinqToExcel.1.11.0\lib\LinqToExcel.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.8.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="Remotion, Version=1.13.52.2, Culture=neutral, PublicKeyToken=0669cf0452175907, processorArchitecture=MSIL">
<HintPath>..\packages\LinqToExcel.1.11.0\lib\Remotion.dll</HintPath>
</Reference>
Expand All @@ -66,12 +57,8 @@
<Reference Include="Remotion.Interfaces, Version=1.13.52.2, Culture=neutral, PublicKeyToken=0669cf0452175907, processorArchitecture=MSIL">
<HintPath>..\packages\LinqToExcel.1.11.0\lib\Remotion.Interfaces.dll</HintPath>
</Reference>
<Reference Include="RichardSzalay.MockHttp, Version=3.2.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RichardSzalay.MockHttp.3.2.1\lib\net45\RichardSzalay.MockHttp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
Expand All @@ -83,6 +70,19 @@
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="log4net">
<HintPath>..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.3.13.3\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="RichardSzalay.MockHttp">
<HintPath>..\packages\RichardSzalay.MockHttp.6.0.0\lib\net45\RichardSzalay.MockHttp.dll</HintPath>
</Reference>
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
Expand Down Expand Up @@ -138,7 +138,6 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
<Error Condition="!Exists('..\packages\NUnit3TestAdapter.3.9.0\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.3.9.0\build\net35\NUnit3TestAdapter.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down