Skip to content

Commit

Permalink
Publishing dev builds to myget.org (#4631)
Browse files Browse the repository at this point in the history
* Added myget publish workflow/action.

* Update name

* Namechange

* Fix modifier

* fix mod 2

* Using minver

* Update cmd

* fix cake script error

* more script error fixes

* cake version issues

* minver version fixed

* a small change

* getting all history for minver to work with

* Setting minor version to increment after RTM tag. We're working towards new minor version by default.

* Changed name of CI build.
  • Loading branch information
OsirisTerje committed Feb 20, 2024
1 parent 829e304 commit 3a35f8c
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 6 deletions.
8 changes: 7 additions & 1 deletion .config/dotnet-tools.json
Expand Up @@ -3,11 +3,17 @@
"isRoot": true,
"tools": {
"cake.tool": {
"version": "3.1.0",
"version": "3.2.0",
"commands": [
"dotnet-cake"
]
},
"minver-cli": {
"version": "4.3.0",
"commands": [
"minver"
]
},
"signclient": {
"version": "1.3.155",
"commands": [
Expand Down
File renamed without changes.
65 changes: 65 additions & 0 deletions .github/workflows/NUnit.Myget.Publish.yml
@@ -0,0 +1,65 @@
name: NUnit.Myget.Publish
env:
MinVerAutoIncrement: minor
on:
push:
branches:
- main
- master
- release
- 'v3'
- myget

defaults:
run:
shell: pwsh
jobs:
build-windows:
name: Windows Build
runs-on: windows-latest

steps:
- name: ⤵️ Checkout Source
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 🛠️ Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json

- name: 🛠️ Install dotnet tools
run: dotnet tool restore

- name: 🔨 Build and Test
run: dotnet tool run dotnet-cake --target=Test --test-run-name=Windows --configuration=Release

- name: 🔨 Windows Specific Tests
run: dotnet test --no-build --configuration=Release src/NUnitFramework/windows-tests/windows-tests.csproj

- name: 📦 Package
run: dotnet tool run dotnet-cake --target=Package

- name: 💾 Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: Package
path: package

- name: 💾 Upload test results
uses: actions/upload-artifact@v4
with:
name: Test results (Windows)
path: test-results
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}

- name: Publish nupkg and snupkg to Myget.org
run: |
foreach($file in (Get-ChildItem package -Recurse -Include *.nupkg)) {
dotnet nuget push $file --api-key "${{ secrets.PUBLISHMYGET }}" --source https://www.myget.org/F/nunit/api/v3/index.json --skip-duplicate
}
foreach($file in (Get-ChildItem "package" -Recurse -Include *.snupkg)) {
dotnet nuget push $file --api-key "${{ secrets.PUBLISHMYGET }}" --source https://www.myget.org/F/nunit/api/v3/index.json --skip-duplicate
}
31 changes: 27 additions & 4 deletions build.cake
@@ -1,9 +1,13 @@
#addin "nuget:?package=Cake.MinVer&version=3.0.0"

//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////

var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var modifier = Argument("modifier", "-alocal");
var prerelease = Argument("prerelease", "");

//////////////////////////////////////////////////////////////////////
// SET ERROR LEVELS
Expand All @@ -15,11 +19,14 @@ var ErrorDetail = new List<string>();
// SET PACKAGE VERSION
//////////////////////////////////////////////////////////////////////

var version = "4.0.1";
var modifier = "";
// var version = "4.1.0";

var version = MinVer();

// var dbgSuffix = configuration.ToLower() == "debug" ? "-dbg" : "";
// var packageVersion = version + modifier + dbgSuffix;

var dbgSuffix = configuration.ToLower() == "debug" ? "-dbg" : "";
var packageVersion = version + modifier + dbgSuffix;
var packageVersion = version;

//////////////////////////////////////////////////////////////////////
// DEFINE RUN CONSTANTS
Expand Down Expand Up @@ -73,6 +80,21 @@ Setup(context =>
Information("Building {0} version {1} of NUnit.", configuration, packageVersion);
});

//////////////////////////////////////////////////////////////////////
// VERSIONING
//////////////////////////////////////////////////////////////////////
Task("Version")
.Does(context =>
{
context.Information($"Version: {version.Version}");
context.Information($"Major: {version.Major}");
context.Information($"Minor: {version.Minor}");
context.Information($"Patch: {version.Patch}");
context.Information($"PreRelease: {version.PreRelease}");
context.Information($"BuildMetadata: {version.BuildMetadata}");
});


//////////////////////////////////////////////////////////////////////
// CLEAN
//////////////////////////////////////////////////////////////////////
Expand All @@ -93,6 +115,7 @@ Task("Clean")

Task("NuGetRestore")
.Description("Restores NuGet Packages")
.IsDependentOn("Version")
.Does(() =>
{
DotNetRestore(SOLUTION_FILE);
Expand Down
3 changes: 2 additions & 1 deletion nunit.sln
Expand Up @@ -69,7 +69,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{AA24
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{8C31C709-FAC1-445C-BAD6-7FFFB3F1D39E}"
ProjectSection(SolutionItems) = preProject
.github\workflows\continuous_integration.yml = .github\workflows\continuous_integration.yml
.github\workflows\NUnit.Myget.Publish.yml = .github\workflows\NUnit.Myget.Publish.yml
.github\workflows\NUnit.CI.yml = .github\workflows\NUnit.CI.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".config", ".config", "{08744334-2350-4885-B57E-347010A27ABB}"
Expand Down

0 comments on commit 3a35f8c

Please sign in to comment.