-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from SimCubeLtd/develop
Swap out to simpler cake build script and integrate minver
- Loading branch information
Showing
10 changed files
with
180 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Main CI-CD | ||
|
||
env: | ||
SIMCUBE_NUGET_SERVER: https://api.nuget.org/v3/index.json | ||
SIMCUBE_NUGET_API_KEY: ${{ secrets.PUBLIC_NUGET_TOKEN }} | ||
DOTNET_NOLOGO: true | ||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | ||
DOTNET_CLI_TELEMETRY_OPTOUT: true | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
build-test-pull-request: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: '7.0.x' | ||
|
||
- name: Build, Test and Pack | ||
run: | | ||
dotnet tool restore | ||
dotnet cake --pack true | ||
- name: Push to nuget | ||
working-directory: artifacts/ | ||
run: dotnet nuget push *.nupkg -s $SIMCUBE_NUGET_SERVER -k $SIMCUBE_NUGET_API_KEY |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -352,3 +352,5 @@ MigrationBackup/ | |
Artifacts/ | ||
tools/ | ||
.idea/ | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#addin nuget:?package=SimpleExec&version=11.0.0 | ||
#addin "nuget:?package=Cake.MinVer&version=3.0.0" | ||
|
||
using System.Text.Json; | ||
using SimpleExec; | ||
|
||
var target = Argument("Target", "Default"); | ||
|
||
var configuration = | ||
HasArgument("Configuration") ? Argument<string>("Configuration") : | ||
EnvironmentVariable("Configuration", "Release"); | ||
|
||
var shouldPack = HasArgument("pack") ? Argument<bool>("pack") : false; | ||
|
||
var settings = new MinVerSettings() | ||
{ | ||
AutoIncrement = MinVerAutoIncrement.Minor, | ||
DefaultPreReleasePhase = "preview", | ||
MinimumMajorMinor = "1.0", | ||
TagPrefix = "v", | ||
Verbosity = MinVerVerbosity.Trace, | ||
}; | ||
|
||
var version = MinVer(settings); | ||
|
||
Task("Clean") | ||
.Description("Cleans the artifacts, bin and obj directories.") | ||
.Does(() => | ||
{ | ||
DeleteDirectories(GetDirectories("**/bin"), new DeleteDirectorySettings() { Force = true, Recursive = true }); | ||
DeleteDirectories(GetDirectories("**/obj"), new DeleteDirectorySettings() { Force = true, Recursive = true }); | ||
CleanDirectory("./artifacts"); | ||
CleanDirectory("./test-output"); | ||
}); | ||
|
||
Task("Restore") | ||
.Description("Restores NuGet packages.") | ||
.IsDependentOn("Clean") | ||
.Does(() => | ||
{ | ||
DotNetRestore(); | ||
}); | ||
|
||
Task("Build") | ||
.Description("Builds the solution.") | ||
.IsDependentOn("Restore") | ||
.Does(() => | ||
{ | ||
DotNetBuild( | ||
".", | ||
new DotNetBuildSettings() | ||
{ | ||
Configuration = configuration, | ||
NoRestore = true, | ||
ArgumentCustomization = args => | ||
args | ||
.Append($"-p:Version={version}") | ||
.Append($"-p:InformationalVersion={version}"), | ||
}); | ||
}); | ||
|
||
Task("Test") | ||
.Description("Runs unit tests and outputs test results to the artifacts directory.") | ||
.Does(() => | ||
{ | ||
DotNetTest( | ||
"tests/Cake.Buildah.Tests/Cake.Buildah.Tests.csproj", | ||
new DotNetTestSettings() | ||
{ | ||
Blame = true, | ||
Configuration = configuration, | ||
ResultsDirectory = "./test-output", | ||
NoBuild = true, | ||
NoRestore = true, | ||
Collectors = new string[] { "Code Coverage", "XPlat Code Coverage" }, | ||
}); | ||
}); | ||
|
||
Task("Pack") | ||
.Description("Packs the Required Project") | ||
.IsDependentOn("Test") | ||
.WithCriteria(shouldPack) | ||
.Does(() => | ||
{ | ||
DotNetPack("src/Cake.Buildah/Cake.Buildah.csproj", | ||
new DotNetPackSettings() | ||
{ | ||
NoBuild = true, | ||
NoRestore = true, | ||
NoLogo = true, | ||
OutputDirectory = "./artifacts", | ||
Verbosity = DotNetVerbosity.Minimal, | ||
Configuration = configuration, | ||
ArgumentCustomization = builder => builder.Append($"-p:PackageVersion={version}") | ||
}); | ||
}); | ||
|
||
Task("Default") | ||
.Description("Cleans, restores NuGet packages, builds the solution and then runs unit tests.") | ||
.IsDependentOn("Build") | ||
.IsDependentOn("Test") | ||
.IsDependentOn("Pack"); | ||
|
||
RunTarget(target); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"cake.tool": { | ||
"version": "3.0.0", | ||
"commands": [ | ||
"dotnet-cake" | ||
] | ||
}, | ||
"minver-cli": { | ||
"version": "4.2.0", | ||
"commands": [ | ||
"minver" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"sdk": { | ||
"version": "7.0.100", | ||
"rollForward": "latestMajor", | ||
"allowPrerelease": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters