Skip to content

Commit

Permalink
fix(CI): Восстановить CI конвейер
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanProsin authored and Roman PROSIN committed Dec 1, 2023
1 parent 7c7b5f1 commit 6dee3a4
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 36 deletions.
46 changes: 17 additions & 29 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ on:
- 'hotfix/**'
- 'refactoring/**'
release:
types:
- released
types:
- released
jobs:
default:
name: Default Job
runs-on: ubuntu-latest
env:
PROJECT_KEY: 'Raiffeisen-DGTL_ViennaNET'
PROJECT_NAME: 'ViennaNET.sln'

ARTIFACTS_DIR: '${{ github.workspace }}/artifacts'
REPORTS_DIR: '${{ github.workspace }}/artifacts/reports'
steps:
- name: Setup GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
Expand Down Expand Up @@ -71,42 +72,29 @@ jobs:
SONAR_ORG: 'raiffeisen-dgtl'
SONAR_HOST_URL: https://sonarcloud.io
run: |
./.sonar/scanner/dotnet-sonarscanner begin \
/k:$PROJECT_KEY \
./.sonar/scanner/dotnet-sonarscanner begin /k:$PROJECT_KEY \
/o:$SONAR_ORG \
/v:$GITVERSION_SEMVER \
/n:$PROJECT_NAME \
/v:$GITVERSION_FULLSEMVER \
/s:"${{ github.workspace }}/SonarQube.Analysis.xml" \
/d:sonar.login=$SONAR_TOKEN \
/d:sonar.host.url=$SONAR_HOST_URL \
/d:sonar.cs.nunit.reportsPaths="**/TestResult/TestResults*.xml" \
/d:sonar.cs.opencover.reportsPaths="**/TestResult/coverage.opencover.xml"
/d:sonar.host.url=$SONAR_HOST_URL
- name: Restore dependencies
run: dotnet restore

- name: Build
run: |
dotnet build $PROJECT_NAME \
-c Release \
--no-restore \
--nologo \
/p:Company=Raiffeisenbank \
/p:Product=ViennaNET \
/p:AssemblyVersion=$GITVERSION_ASSEMBLYSEMVER \
/p:FileVersion=$GITVERSION_ASSEMBLYSEMFILEVER \
/p:InformationalVersion=$GITVERSION_INFORMATIONALVERSION
dotnet build "$PROJECT_NAME" -c Release --nologo --no-restore
- name: Test
run: |
dotnet test $PROJECT_NAME \
-c Release \
-r '${{ github.workspace }}/reports' \
--no-build \
--nologo \
--logger "nunit;LogFilePath=TestResult-{assembly}.xml" \
/p:CollectCoverage=true \
/p:CoverletOutputFormat=\"opencover\" \
/p:CoverletOutput=TestResult/
dotnet tool update -g dotnet-reportgenerator-globaltool;
dotnet test "$PROJECT_NAME" -c Release --nologo --no-restore --no-build \
--logger "nunit;LogFilePath=$REPORTS_DIR/{assembly}-nunit-tests-result.xml";
reportgenerator "-reports:${{ github.workspace }}/**/*.cobertura.xml" \
"-targetdir:$REPORTS_DIR/" \
"-reporttypes:SonarQube;TextSummary";
- name: End sonarscanner
env:
Expand All @@ -116,7 +104,7 @@ jobs:

- name: Pack
if: github.event_name == 'release'
run: dotnet pack $PROJECT_NAME -c Release -o ./nupkgs --nologo --no-build -p:PackageVersion=$GITVERSION_NUGETVERSIONV2
run: dotnet pack $PROJECT_NAME -c Release -o ./nupkgs --nologo --no-build

- name: Push nuget packages
if: github.event_name == 'release'
Expand Down
15 changes: 15 additions & 0 deletions SonarQube.Analysis.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<SonarQubeAnalysisProperties xmlns="http://www.sonarsource.com/msbuild/integration/2015/1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Property Name="sonar.host.url">https://sonarcloud.io</Property>
<Property Name="sonar.projectName">ViennaNET</Property>
<Property Name="sonar.projectDescription">
Библиотеки классов, предоставляющая набор API расширяющих платформы .NET и AspNetCore.
Оптимизирует производительность разработки, за счёт API решающего типовые задачи.
</Property>
<Property Name="sonar.links.homepage">https://github.com/Raiffeisen-DGTL/ViennaNET</Property>
<Property Name="sonar.exclusions">artifacts/reports/*</Property>
<Property Name="sonar.cs.junit.reportsPaths">artifacts/reports/*-nunit-tests-result.xml</Property>
<Property Name="sonar.coverageReportPaths">artifacts/reports/SonarQube.xml</Property>
<Property Name="sonar.qualitygate.wait">true</Property>
</SonarQubeAnalysisProperties>

8 changes: 4 additions & 4 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<RepositoryBranch>$(CI_COMMIT_REF_NAME)</RepositoryBranch>
<RepositoryCommit>$(CI_COMMIT_SHA)</RepositoryCommit>
<PackageProjectUrl>$(CI_PROJECT_URL)</PackageProjectUrl>
<PackageVersion>$(GitVersion_NuGetVersion)</PackageVersion>
<AssemblyVersion>$(GitVersion_AssemblySemVer)</AssemblyVersion>
<FileVersion>$(GitVersion_AssemblySemFileVer)</FileVersion>
<InformationalVersion>$(GitVersion_InformationalVersion)</InformationalVersion>
<PackageVersion>$(GITVERSION_NUGETVERSION)</PackageVersion>
<AssemblyVersion>$(GITVERSION_ASSEMBLYSEMVER)</AssemblyVersion>
<FileVersion>$(GITVERSION_ASSEMBLYSEMFILEVER)</FileVersion>
<InformationalVersion>$(GITVERSION_INFORMATIONALVERSION)</InformationalVersion>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2"/>
<PackageReference Include="NUnit" Version="3.13.3"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1"/>
<PackageReference Include="JunitXml.TestLogger" Version="3.0.114"/>
<PackageReference Include="NunitXml.TestLogger" Version="3.1.15"/>
<PackageReference Include="NUnit.Analyzers" Version="3.5.0"/>
<PackageReference Include="Moq" Version="4.18.2"/>
<PackageReference Include="coverlet.msbuild" Version="3.1.2">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using k8s;
using k8s.Models;
using Moq;
using ViennaNET.Extensions.Configuration.Kubernetes.Internals;

namespace ViennaNET.Extensions.Configuration.Kubernetes.Tests;

Expand Down Expand Up @@ -168,8 +167,13 @@ public void OnEvent_Extract_WithDefaultFileName_Returns_TestOption()
[Test]
public void Dispose_Throws_Nothing()
{
var k8sClient = Mock.Of<IKubernetes>();
var k8sClientBuilder = new Mock<IKubernetesClientBuilder>();

k8sClientBuilder.Setup(builder => builder.Build()).Returns(k8sClient);

var provider =
new ConfigMapConfigurationProvider(new KubernetesConfigurationSource(), new KubernetesClientBuilder());
new ConfigMapConfigurationProvider(new KubernetesConfigurationSource(), k8sClientBuilder.Object);

Assert.That(() => provider.Dispose(), Throws.Nothing);
}
Expand Down

0 comments on commit 6dee3a4

Please sign in to comment.