⚙️ (Partially) implement CI #18

Merged
alexis.drai merged 1 commits from implement-ci into master 2 years ago

@ -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]

@ -1,3 +1,5 @@
[![Build Status](https://codefirst.iut.uca.fr/api/badges/alexis.drai/cat_cafe/status.svg)](https://codefirst.iut.uca.fr/alexis.drai/cat_cafe)
# cat_cafe
## To contribute (workflow)
@ -6,7 +8,7 @@ We are using the feature branch workflow ([details here](https://www.atlassian.c
### 1 - Sync with the remote
Make sure you're working with the latest version of the project
Make sure you're working with the latest version of the project
```
git checkout master
git fetch origin

@ -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;

@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32616.157
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cat_cafe", "cat_cafe.csproj", "{CC02D05A-3817-4D0A-8766-3FEE0C90941B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "cat_cafe", "cat_cafe.csproj", "{CC02D05A-3817-4D0A-8766-3FEE0C90941B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "..\Tests\Tests.csproj", "{674DDACC-DB0E-473B-81E2-E3CABB8CB65B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -15,6 +17,10 @@ Global
{CC02D05A-3817-4D0A-8766-3FEE0C90941B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC02D05A-3817-4D0A-8766-3FEE0C90941B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC02D05A-3817-4D0A-8766-3FEE0C90941B}.Release|Any CPU.Build.0 = Release|Any CPU
{674DDACC-DB0E-473B-81E2-E3CABB8CB65B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{674DDACC-DB0E-473B-81E2-E3CABB8CB65B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{674DDACC-DB0E-473B-81E2-E3CABB8CB65B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{674DDACC-DB0E-473B-81E2-E3CABB8CB65B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Loading…
Cancel
Save