Skip to content

Commit 7d4e09c

Browse files
committed
chore: migrate to github actions
1 parent a407f5b commit 7d4e09c

File tree

11 files changed

+2538
-81
lines changed

11 files changed

+2538
-81
lines changed

.github/workflows/pipeline.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Pipeline
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- 'v*'
10+
11+
env:
12+
DOTNET_VERSION: '10.0.x'
13+
14+
jobs:
15+
16+
pipeline:
17+
runs-on: ubuntu-24.04
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v6
21+
with:
22+
fetch-depth: 0
23+
- name: Setup .NET ${{ env.DOTNET_VERSION }}
24+
uses: actions/setup-dotnet@v5
25+
with:
26+
dotnet-version: ${{ env.DOTNET_VERSION }}
27+
cache: true
28+
cache-dependency-path: '**/packages.lock.json'
29+
- name: Execute NUKE
30+
run: ./build.cmd UploadCodecov PushNuGet PushMyGet
31+
env:
32+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
33+
MYGET_API_KEY: ${{ secrets.MYGET_API_KEY }}
34+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
99
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
1010
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
11+
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
1112
</PropertyGroup>
1213

1314
<ItemGroup>

ExpressionCache.sln

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1111
ProjectSection(SolutionItems) = preProject
1212
.gitattributes = .gitattributes
1313
.gitignore = .gitignore
14-
appveyor.yml = appveyor.yml
1514
GitVersion.yml = GitVersion.yml
1615
LICENSE.txt = LICENSE.txt
1716
README.md = README.md
@@ -37,6 +36,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".vscode", ".vscode", "{DE84
3736
EndProject
3837
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{CE54894B-4446-4C4E-A5BB-9C2EBFEF9235}"
3938
EndProject
39+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{BDCE7E0E-9401-4733-BBF3-FC8E15C1DB1E}"
40+
EndProject
41+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{603FD4FF-C09D-433C-BC75-5A7437F78A92}"
42+
ProjectSection(SolutionItems) = preProject
43+
.github\workflows\pipeline.yml = .github\workflows\pipeline.yml
44+
EndProjectSection
45+
EndProject
4046
Global
4147
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4248
Debug|Any CPU = Debug|Any CPU
@@ -71,6 +77,8 @@ Global
7177
{DE84B09E-D95B-4FA5-B0F3-BAE35F5F38FA} = {0D3664A8-B03E-4BCF-839D-05B531696319}
7278
{C9B64175-438C-45CF-813D-080668803BF2} = {F72E828C-F7DE-4017-98C6-DA80131AF0D9}
7379
{E1933559-16AE-4A3F-B0B0-320EAF8566C6} = {F72E828C-F7DE-4017-98C6-DA80131AF0D9}
80+
{BDCE7E0E-9401-4733-BBF3-FC8E15C1DB1E} = {0D3664A8-B03E-4BCF-839D-05B531696319}
81+
{603FD4FF-C09D-433C-BC75-5A7437F78A92} = {BDCE7E0E-9401-4733-BBF3-FC8E15C1DB1E}
7482
EndGlobalSection
7583
GlobalSection(ExtensibilityGlobals) = postSolution
7684
SolutionGuid = {A299EE11-0232-400D-9A3B-DC506153B286}

appveyor.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

build/Build.cs

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,24 @@
1-
using System;
21
using System.Collections.Generic;
2+
using System.Diagnostics.CodeAnalysis;
33
using System.Linq;
44
using Nuke.Common;
55
using Nuke.Common.CI;
6-
using Nuke.Common.CI.AppVeyor;
6+
using Nuke.Common.CI.GitHubActions;
77
using Nuke.Common.Git;
88
using Nuke.Common.IO;
99
using Nuke.Common.ProjectModel;
10-
using Nuke.Common.Tooling;
1110
using Nuke.Common.Tools.Codecov;
1211
using Nuke.Common.Tools.Coverlet;
1312
using Nuke.Common.Tools.DotNet;
1413
using Nuke.Common.Tools.GitVersion;
15-
using Nuke.Common.Tools.NuGet;
1614
using Nuke.Common.Tools.ReportGenerator;
15+
using Nuke.Common.Utilities;
1716
using Nuke.Common.Utilities.Collections;
1817
using static Nuke.Common.Tools.Codecov.CodecovTasks;
1918
using static Nuke.Common.Tools.DotNet.DotNetTasks;
20-
using static Nuke.Common.Tools.NuGet.NuGetTasks;
2119
using static Nuke.Common.Tools.ReportGenerator.ReportGeneratorTasks;
2220

23-
// ReSharper disable AllUnderscoreLocalParameterName
24-
25-
[ShutdownDotNetAfterServerBuild]
26-
[AppVeyor(
27-
AppVeyorImage.VisualStudio2022,
28-
InvokedTargets =
29-
[
30-
nameof(UploadCodecov),
31-
nameof(PushNuGet),
32-
nameof(PushMyGet),
33-
])]
34-
[AppVeyorSecret("MYGET_API_KEY", "78qy8e6pKfJlQV7RAG5tJOWegzXpjASkUs3aFdVBoPYA5gi6+mWdjbuAmNa5OQPe")]
35-
[AppVeyorSecret("NUGET_API_KEY", "aMbj+EdePo74elFCi6lrQZcO81mru5j8cqD5FxGoDBWgXFFHwok/z4B+BtS4H1Sw")]
36-
[AppVeyorSecret("CODECOV_TOKEN", "3FxtGPNTgZyQGToJBaH68/oIjptV79CcViR9mHt2aOKGh3++oKTehBIuPSb7oYCE")]
21+
[SuppressMessage("ReSharper", "UnusedMember.Local")]
3722
class Build : NukeBuild
3823
{
3924
public static int Main () => Execute<Build>(x => x.Compile);
@@ -48,7 +33,7 @@ class Build : NukeBuild
4833
[Solution] readonly Solution Solution;
4934
[GitRepository] readonly GitRepository GitRepository;
5035
[GitVersion] readonly GitVersion GitVersion;
51-
[CI] readonly AppVeyor AppVeyor;
36+
[CI] readonly GitHubActions GitHubActions;
5237

5338
static AbsolutePath SourceDirectory => RootDirectory / "src";
5439
static AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";
@@ -63,14 +48,23 @@ class Build : NukeBuild
6348
.Before(Compile)
6449
.Executes(() =>
6550
{
51+
ArtifactsDirectory.CreateOrCleanDirectory();
52+
6653
SourceDirectory
6754
.GlobDirectories("**/bin", "**/obj")
6855
.ForEach(path => path.DeleteDirectory());
56+
});
6957

70-
ArtifactsDirectory.CreateOrCleanDirectory();
58+
Target Restore => _ => _
59+
.Executes(() =>
60+
{
61+
DotNetRestore(s => s
62+
.SetProjectFile(Solution)
63+
.EnableLockedMode());
7164
});
7265

7366
Target Compile => _ => _
67+
.DependsOn(Restore)
7468
.Executes(() =>
7569
{
7670
DotNetBuild(s => s
@@ -79,7 +73,8 @@ class Build : NukeBuild
7973
.SetAssemblyVersion(GitVersion.AssemblySemVer)
8074
.SetFileVersion(GitVersion.AssemblySemFileVer)
8175
.SetInformationalVersion(GitVersion.InformationalVersion)
82-
.EnableTreatWarningsAsErrors());
76+
.EnableTreatWarningsAsErrors()
77+
.EnableNoRestore());
8378
});
8479

8580
Target Test => _ => _
@@ -89,15 +84,18 @@ class Build : NukeBuild
8984
CoverageDirectory.CreateOrCleanDirectory();
9085
TestResultFolders.ForEach(directory => directory.DeleteDirectory());
9186

92-
DotNetTest(s => s
93-
.SetConfiguration(Configuration)
94-
.EnableNoRestore()
95-
.EnableNoBuild()
96-
.SetDataCollector("XPlat Code Coverage")
97-
.SetCoverletOutputFormat(CoverletOutputFormat.cobertura)
98-
.CombineWith(TestProjects, (ss, project) => ss
99-
.SetProjectFile(project)),
100-
degreeOfParallelism: Environment.ProcessorCount);
87+
foreach (var project in TestProjects)
88+
{
89+
DotNetTest(s => s
90+
.SetProjectFile(project)
91+
.SetConfiguration(Configuration)
92+
.SetDataCollector("XPlat Code Coverage")
93+
.SetCoverletOutputFormat(CoverletOutputFormat.cobertura)
94+
.EnableNoRestore()
95+
.EnableNoBuild()
96+
.When(GitHubActions != null, ss => ss
97+
.SetLoggers("GitHubActions")));
98+
}
10199

102100
ReportGenerator(s => s
103101
.SetReports(CoverageResults)
@@ -121,36 +119,38 @@ class Build : NukeBuild
121119

122120
DotNetPack(s => s
123121
.SetConfiguration(Configuration)
124-
.EnableNoRestore()
125-
.EnableNoBuild()
126122
.SetOutputDirectory(ArtifactsDirectory)
127-
.SetVersion(GitVersion.SemVer));
123+
.SetVersion(GitVersion.SemVer)
124+
.EnableNoRestore()
125+
.EnableNoBuild());
128126
});
129127

130128
Target PushMyGet => _ => _
131129
.DependsOn(Package)
132130
.OnlyWhenStatic(() => IsServerBuild && GitRepository.IsOnMainBranch())
133131
.Executes(() =>
134132
{
135-
NuGetPush(s => s
136-
.SetSource("https://www.myget.org/F/baunegaard/api/v2/package")
137-
.SetApiKey(MyGetApiKey)
138-
.CombineWith(Artifacts, (ss, artifact) => ss
139-
.SetTargetPath(artifact)),
140-
degreeOfParallelism: Environment.ProcessorCount);
133+
foreach (var artifact in Artifacts)
134+
{
135+
DotNetNuGetPush(s => s
136+
.SetTargetPath(artifact)
137+
.SetSource("https://www.myget.org/F/baunegaard/api/v2/package")
138+
.SetApiKey(MyGetApiKey));
139+
}
141140
});
142141

143142
Target PushNuGet => _ => _
144143
.DependsOn(Package)
145-
.OnlyWhenStatic(() => IsServerBuild && AppVeyor.RepositoryTag)
144+
.OnlyWhenStatic(() => IsServerBuild && GitHubActions.RefType == "tag")
146145
.Executes(() =>
147146
{
148-
NuGetPush(s => s
149-
.SetSource("https://api.nuget.org/v3/index.json")
150-
.SetApiKey(NuGetApiKey)
151-
.CombineWith(Artifacts, (ss, artifact) => ss
152-
.SetTargetPath(artifact)),
153-
degreeOfParallelism: Environment.ProcessorCount);
147+
foreach (var artifact in Artifacts)
148+
{
149+
DotNetNuGetPush(s => s
150+
.SetTargetPath(artifact)
151+
.SetSource("https://api.nuget.org/v3/index.json")
152+
.SetApiKey(NuGetApiKey));
153+
}
154154
});
155155

156156
Target UploadCodecov => _ => _

build/_build.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<NukeScriptDirectory>..</NukeScriptDirectory>
1010
<NukeTelemetryVersion>1</NukeTelemetryVersion>
1111
<IsPackable>false</IsPackable>
12+
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
1213
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
1314
</PropertyGroup>
1415

0 commit comments

Comments
 (0)