♻️ Implement CI
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
baace3a0b8
commit
dfd9d88e61
@ -0,0 +1,44 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: default
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build
|
||||||
|
image: mcr.microsoft.com/dotnet/sdk:6.0
|
||||||
|
commands:
|
||||||
|
- cd cat_cafe/
|
||||||
|
- dotnet restore cat_cafe.sln
|
||||||
|
- dotnet build cat_cafe.sln -c Release --no-restore
|
||||||
|
- dotnet publish cat_cafe.sln -c Release --no-restore -o CI_PROJECT_DIR/build/release
|
||||||
|
|
||||||
|
- name: tests
|
||||||
|
image: mcr.microsoft.com/dotnet/sdk:6.0
|
||||||
|
commands:
|
||||||
|
- cd cat_cafe/
|
||||||
|
- dotnet restore cat_cafe.sln
|
||||||
|
- dotnet test cat_cafe.sln --no-restore
|
||||||
|
depends_on: [build]
|
||||||
|
|
||||||
|
# - name: code-analysis
|
||||||
|
# image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6
|
||||||
|
# commands:
|
||||||
|
# - cd cat_cafe/
|
||||||
|
# - dotnet restore cat_cafe.sln
|
||||||
|
# - dotnet sonarscanner begin /k:"cat_cafe" /d:sonar.host.url=$${PLUGIN_SONAR_HOST} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions="Tests/**" /d:sonar.login=$${PLUGIN_SONAR_TOKEN}
|
||||||
|
# - dotnet build cat_cafe.sln -c Release --no-restore
|
||||||
|
# - dotnet test cat_cafe.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage"
|
||||||
|
# - reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport"
|
||||||
|
# - dotnet publish cat_cafe.sln -c Release --no-restore -o CI_PROJECT_DIR/build/release
|
||||||
|
# - dotnet sonarscanner end /d:sonar.login=$${PLUGIN_SONAR_TOKEN}
|
||||||
|
# secrets: [ sonar_token ]
|
||||||
|
# settings:
|
||||||
|
# # accessible en ligne de commande par ${PLUGIN_SONAR_HOST}
|
||||||
|
# sonar_host: https://codefirst.iut.uca.fr/sonar/
|
||||||
|
# # accessible en ligne de commande par ${PLUGIN_SONAR_TOKEN}
|
||||||
|
# sonar_token:
|
||||||
|
# from_secret: sonar_token
|
||||||
|
# depends_on: [tests]
|
@ -0,0 +1,28 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
|
||||||
|
<PackageReference Include="xunit" Version="2.4.1" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="coverlet.collector" Version="3.1.2">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\cat_cafe\cat_cafe.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,23 @@
|
|||||||
|
using cat_cafe.Entities;
|
||||||
|
|
||||||
|
namespace Tests
|
||||||
|
{
|
||||||
|
public class UnitTest1
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Test1()
|
||||||
|
{
|
||||||
|
String name = "Margot";
|
||||||
|
int id = 1337;
|
||||||
|
|
||||||
|
Cat cat = new()
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
Name = name
|
||||||
|
};
|
||||||
|
|
||||||
|
Assert.Equal(name, cat.Name);
|
||||||
|
Assert.Equal(id, cat.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
global using Xunit;
|
Loading…
Reference in new issue