Skip to content

Commit bc9cb3e

Browse files
committed
Add API checks
1 parent 99a8305 commit bc9cb3e

File tree

4 files changed

+87
-2
lines changed

4 files changed

+87
-2
lines changed

.github/workflows/build.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,34 @@ jobs:
3939
./Artifacts/*
4040
./TestResults/*.trx
4141
42+
api-tests:
43+
name: "API tests"
44+
runs-on: ubuntu-latest
45+
env:
46+
DOTNET_NOLOGO: true
47+
steps:
48+
- uses: actions/checkout@v4
49+
with:
50+
fetch-depth: 0
51+
- name: Setup .NET SDKs
52+
uses: actions/setup-dotnet@v4
53+
with:
54+
dotnet-version: |
55+
6.0.x
56+
7.0.x
57+
8.0.x
58+
9.0.x
59+
- name: API checks
60+
run: ./build.sh ApiChecks
61+
- name: Upload artifacts
62+
if: always()
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: API-tests
66+
path: |
67+
./Artifacts/*
68+
./TestResults/*.trx
69+
4270
static-code-analysis:
4371
name: "Static code analysis"
4472
runs-on: ubuntu-latest
@@ -63,7 +91,7 @@ jobs:
6391

6492
publish-test-results:
6593
name: "Publish Tests Results"
66-
needs: [ unit-tests ]
94+
needs: [ api-tests, unit-tests ]
6795
runs-on: ubuntu-latest
6896
permissions:
6997
checks: write

.github/workflows/ci.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,34 @@ jobs:
3939
./Artifacts/*
4040
./TestResults/*.trx
4141
42+
api-tests:
43+
name: "API tests"
44+
runs-on: ubuntu-latest
45+
env:
46+
DOTNET_NOLOGO: true
47+
steps:
48+
- uses: actions/checkout@v4
49+
with:
50+
fetch-depth: 0
51+
- name: Setup .NET SDKs
52+
uses: actions/setup-dotnet@v4
53+
with:
54+
dotnet-version: |
55+
6.0.x
56+
7.0.x
57+
8.0.x
58+
9.0.x
59+
- name: API checks
60+
run: ./build.sh ApiChecks
61+
- name: Upload artifacts
62+
if: always()
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: API-tests
66+
path: |
67+
./Artifacts/*
68+
./TestResults/*.trx
69+
4270
static-code-analysis:
4371
name: "Static code analysis"
4472
if: ${{ github.actor != 'dependabot[bot]' }}
@@ -64,7 +92,7 @@ jobs:
6492

6593
publish-test-results:
6694
name: "Publish Tests Results"
67-
needs: [ unit-tests ]
95+
needs: [ api-tests, unit-tests ]
6896
runs-on: ubuntu-latest
6997
permissions:
7098
checks: write

.nuke/build.schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"ExecutableTarget": {
2525
"type": "string",
2626
"enum": [
27+
"ApiChecks",
2728
"CalculateNugetVersion",
2829
"Clean",
2930
"CodeAnalysis",

Pipeline/Build.ApiChecks.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using Nuke.Common;
2+
using Nuke.Common.ProjectModel;
3+
using Nuke.Common.Tooling;
4+
using Nuke.Common.Tools.DotNet;
5+
using static Nuke.Common.Tools.DotNet.DotNetTasks;
6+
7+
// ReSharper disable AllUnderscoreLocalParameterName
8+
9+
namespace Build;
10+
11+
partial class Build
12+
{
13+
Target ApiChecks => _ => _
14+
.DependsOn(Compile)
15+
.Executes(() =>
16+
{
17+
Project project = Solution.Tests.TestableIO_System_IO_Abstractions_Api_Tests;
18+
19+
DotNetTest(s => s
20+
.SetConfiguration(Configuration == Configuration.Debug ? "Debug" : "Release")
21+
.SetProcessEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
22+
.EnableNoBuild()
23+
.SetResultsDirectory(TestResultsDirectory)
24+
.CombineWith(cc => cc
25+
.SetProjectFile(project)
26+
.AddLoggers($"trx;LogFileName={project.Name}.trx")), completeOnFailure: true);
27+
});
28+
}

0 commit comments

Comments
 (0)