Compare commits
118 Commits
Arthur_EF_
...
master
@ -0,0 +1,92 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: mcr.microsoft.com/dotnet/sdk:6.0
|
||||
volumes:
|
||||
- name: docs
|
||||
path: /docs
|
||||
commands:
|
||||
- cd EntityFramework_LoL/Sources/
|
||||
- dotnet restore LeagueOfLegends.sln
|
||||
- dotnet build LeagueOfLegends.sln -c Release --no-restore
|
||||
- dotnet publish LeagueOfLegends.sln -c Release --no-restore -o CI_PROJECT_DIR/build/release
|
||||
# docker image build
|
||||
- name: docker-build-and-push
|
||||
image: plugins/docker
|
||||
settings:
|
||||
dockerfile: EntityFramework_LoL/Sources/API_LoL_Project/Dockerfile
|
||||
context: EntityFramework_LoL/Sources/
|
||||
registry: hub.codefirst.iut.uca.fr
|
||||
repo: hub.codefirst.iut.uca.fr/arthur.valin/league-of-legends_project
|
||||
username:
|
||||
from_secret: SECRET_REGISTRY_USERNAME
|
||||
password:
|
||||
from_secret: SECRET_REGISTRY_PASSWORD
|
||||
|
||||
- name: tests
|
||||
image: mcr.microsoft.com/dotnet/sdk:6.0
|
||||
ADMINS: davidd_almeida,arthurvalin
|
||||
commands:
|
||||
- cd EntityFramework_LoL/Sources/
|
||||
- dotnet restore LeagueOfLegends.sln
|
||||
- dotnet test LeagueOfLegends.sln --no-restore
|
||||
depends_on: [build]
|
||||
|
||||
|
||||
|
||||
- name: generate-and-deploy-docs
|
||||
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-docdeployer
|
||||
failure: ignore
|
||||
volumes:
|
||||
- name: docs
|
||||
path: /docs
|
||||
commands:
|
||||
#- cd Documentation/doxygen
|
||||
#- doxygen Doxyfile
|
||||
- /entrypoint.sh
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
depends_on: [ build ]
|
||||
|
||||
- name: deploy-container
|
||||
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
|
||||
environment:
|
||||
IMAGENAME: hub.codefirst.iut.uca.fr/arthur.valin/league-of-legends_project:latest
|
||||
CONTAINERNAME: lolcontainer
|
||||
COMMAND: create
|
||||
OVERWRITE: true
|
||||
ADMINS: davidd_almeida,arthurvalin
|
||||
depends_on: [ docker-build-and-push ]
|
||||
|
||||
- name: code-analysis
|
||||
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6
|
||||
ADMINS: davidd_almeida,arthurvalin
|
||||
commands:
|
||||
- cd EntityFramework_LoL/Sources/
|
||||
- dotnet restore LeagueOfLegends.sln
|
||||
- dotnet sonarscanner begin /k:LOLProject /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 LeagueOfLegends.sln -c Release --no-restore
|
||||
- dotnet test LeagueOfLegends.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 LeagueOfLegends.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]
|
||||
|
||||
volumes:
|
||||
- name: docs
|
||||
temp: {}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,25 @@
|
||||
**/.classpath
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/azds.yaml
|
||||
**/bin
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
@ -1,33 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace API_LoL_Project.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
private static readonly string[] Summaries = new[]
|
||||
{
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
};
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
{
|
||||
Date = DateTime.Now.AddDays(index),
|
||||
TemperatureC = Random.Shared.Next(-20, 55),
|
||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["API_LoL_Project/API_LoL_Project.csproj", "API_LoL_Project/"]
|
||||
COPY ["StubLib/StubLib.csproj", "StubLib/"]
|
||||
COPY ["Model/Model.csproj", "Model/"]
|
||||
COPY ["Shared/Shared.csproj", "Shared/"]
|
||||
COPY ["DTO/DTO.csproj", "DTO/"]
|
||||
RUN dotnet restore "API_LoL_Project/API_LoL_Project.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/API_LoL_Project"
|
||||
RUN dotnet build "API_LoL_Project.csproj" -c Release -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "API_LoL_Project.csproj" -c Release -o /app/publish
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
RUN ls -R
|
||||
ENTRYPOINT ["dotnet", "API_LoL_Project.dll"]
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,25 +1,107 @@
|
||||
using Business;
|
||||
using Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Mvc.ApiExplorer;
|
||||
using Microsoft.AspNetCore.Mvc.Versioning;
|
||||
using Model;
|
||||
using StubLib;
|
||||
using API_LoL_Project;
|
||||
using API_LoL_Project.JsonConverter;
|
||||
using API_LoL_Project.Middleware.Auth;
|
||||
using Microsoft.OpenApi.Models;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
var connectionString = builder.Configuration.GetConnectionString("LolDatabase");
|
||||
builder.Services.AddDbContext<LolDbContext>(options =>
|
||||
options.UseSqlite(connectionString), ServiceLifetime.Singleton);
|
||||
|
||||
builder.Services.AddControllers().AddJsonOptions(options =>
|
||||
{
|
||||
options.JsonSerializerOptions.Converters.Add(new ReadOnlyDictionaryConverter<string, int>());
|
||||
});
|
||||
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
builder.Services.AddSwaggerGen( cont =>
|
||||
{
|
||||
cont.AddSecurityDefinition("ApiKey", new Microsoft.OpenApi.Models.OpenApiSecurityScheme
|
||||
{
|
||||
Description = "The Key to acces to the API",
|
||||
Type = SecuritySchemeType.ApiKey,
|
||||
Name = "x-api-key",
|
||||
In = ParameterLocation.Header,
|
||||
Scheme = "ApiKeyScheme"
|
||||
});
|
||||
|
||||
var scheme = new OpenApiSecurityScheme
|
||||
{
|
||||
Reference = new OpenApiReference
|
||||
{
|
||||
Type = ReferenceType.SecurityScheme,
|
||||
Id = "ApiKey"
|
||||
},
|
||||
In = ParameterLocation.Header
|
||||
};
|
||||
|
||||
var requirement = new OpenApiSecurityRequirement
|
||||
{
|
||||
{
|
||||
scheme, new List<string>()
|
||||
}
|
||||
};
|
||||
cont.AddSecurityRequirement(requirement);
|
||||
|
||||
}
|
||||
|
||||
|
||||
);
|
||||
|
||||
builder.Services.AddApiVersioning(opt =>
|
||||
{
|
||||
opt.DefaultApiVersion = new Microsoft.AspNetCore.Mvc.ApiVersion(1, 0);
|
||||
opt.AssumeDefaultVersionWhenUnspecified = true;
|
||||
opt.ReportApiVersions = true;
|
||||
opt.ApiVersionReader = ApiVersionReader.Combine(new UrlSegmentApiVersionReader());
|
||||
});
|
||||
builder.Services.ConfigureOptions<LolSwaggerOptions>();
|
||||
builder.Services.AddVersionedApiExplorer(setup =>
|
||||
{
|
||||
setup.GroupNameFormat = "'v'VVV";
|
||||
setup.SubstituteApiVersionInUrl = true;
|
||||
});
|
||||
|
||||
|
||||
builder.Services.AddScoped<AuthMiddlewareFliter>();
|
||||
|
||||
builder.Services.AddSingleton<IDataManager, DbData>();
|
||||
//builder.Services.AddSingleton<IDataManager, StubData>();
|
||||
|
||||
var app = builder.Build();
|
||||
var apiVersionDescriptionProvider = app.Services.GetRequiredService<IApiVersionDescriptionProvider>();
|
||||
|
||||
app?.Services?.GetService<LolDbContext>()?.Database.EnsureCreated();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
app.UseSwaggerUI(options =>
|
||||
{
|
||||
foreach (var description in apiVersionDescriptionProvider.ApiVersionDescriptions)
|
||||
{
|
||||
options.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json",
|
||||
description.GroupName.ToUpperInvariant());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
|
||||
app.Run();
|
||||
|
@ -1,13 +0,0 @@
|
||||
namespace API_LoL_Project
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"LolDatabase": "Data Source=Entities.LolDatabase.db"
|
||||
}
|
||||
}
|
@ -1,9 +1,16 @@
|
||||
{
|
||||
|
||||
"Authentification": {
|
||||
"ApiKey" : "ViveC#"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"LolDatabase": "Data Source=Entities.LolDatabase.db"
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ApiMappeur\ApiMappeur.csproj" />
|
||||
<ProjectReference Include="..\DTO\DTO.csproj" />
|
||||
<ProjectReference Include="..\Model\Model.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Mapper\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DTO\DTO.csproj" />
|
||||
<ProjectReference Include="..\Entities\Entities.csproj" />
|
||||
<ProjectReference Include="..\Model\Model.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Entities\Entities.csproj" />
|
||||
<ProjectReference Include="..\Model\Model.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"profiles": {
|
||||
"Model": {
|
||||
"commandName": "Project"
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue