ci: use nuke and sonar for ci
Some checks failed
Test if Server can be built / build-server (push) Failing after 11s

This commit is contained in:
Timothy Schenk 2023-10-27 19:47:17 +02:00
parent 20931b5751
commit 39bfd21be7
3 changed files with 27 additions and 5 deletions

View file

@ -9,5 +9,6 @@ jobs:
- name: Setup dotnet
uses: https://github.com/actions/setup-dotnet@v3
with:
global-json-file: global.json
- run: dotnet build Server
dotnet-version: |
7.0
- run: nuke

View file

@ -18,6 +18,12 @@ class Build : NukeBuild
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
[Parameter] readonly string SonarToken;
[Parameter] readonly string SonarHostUrl;
[Parameter]
readonly string SonarProjectKey
GitRepository GitRepository => GitRepository.FromLocalDirectory(RootDirectory);
Target Information => _ => _
@ -45,7 +51,7 @@ class Build : NukeBuild
});
Target Pack => _ => _
.DependsOn(Compile)
.DependsOn(SonarScan)
.Executes(() =>
{
DockerTasks.DockerBuild(settings => settings
@ -56,10 +62,25 @@ class Build : NukeBuild
.SetProgress(ProgressType.auto));
if (!IsLocalBuild)
{
DockerTasks.DockerPush(settings => settings.SetName("continuity-server:latest"));
//DockerTasks.DockerPush(settings => settings.SetName("continuity-server:latest"));
}
});
Target SonarScan => _ => _.DependsOn(Compile).Executes(() =>
{
if (IsLocalBuild)
{
return;
}
var sonarScannerSettings = new SonarScannerBeginSettings()
.SetLogin(SonarToken)
.SetProjectKey(SonarProjectKey())
.SetProjectName("Continuity")
.SetProjectVersion(GitRepository.Branch)
.SetServer(SonarHostUrl);
})
Target Deploy => _ => _.DependsOn(Pack).Executes(() =>
{
DockerTasks.DockerPull(settings => settings.SetName("postgres:16.0-alpine"));