diff --git a/.gitea/workflows/server.yaml b/.gitea/workflows/server.yaml index 95239b7..c476dd7 100644 --- a/.gitea/workflows/server.yaml +++ b/.gitea/workflows/server.yaml @@ -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 diff --git a/build/Build.cs b/build/Build.cs index d78a3f3..9ecaf5d 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -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")); diff --git a/global.json b/global.json index c65c9ea..e30c726 100644 --- a/global.json +++ b/global.json @@ -4,4 +4,4 @@ "rollForward": "latestMinor", "allowPrerelease": true } -} \ No newline at end of file +}