Skip to content

Commit edb9ba8

Browse files
committed
Refactor build to separate library + test projects
Updated the workflow to explicitly restore, build, test, and package the library and test projects individually.
1 parent 4d3c627 commit edb9ba8

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

.github/workflows/build.yaml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ permissions:
1515
env:
1616
DOTNET_CLI_TELEMETRY_OPTOUT: 1 # Opt out of telemetry to speed up the build
1717
DOTNET_NOLOGO: 1 # Prevents the dotnet CLI logo from displaying that speeds up build times
18-
solutionPath: './DurationMancer.slnx'
18+
libraryPath: './src/DurationMancer/DurationMancer.csproj'
19+
testsPath: './tests/DurationMancer.Tests/DurationMancer.Tests.csproj'
1920
buildConfiguration: 'Release'
2021
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
2122

@@ -56,8 +57,10 @@ jobs:
5657
run: dotnet tool install dotnet-sonarscanner --global
5758

5859
# --- Restore ---
59-
- name: Restore dependencies
60-
run: dotnet restore ${{ env.solutionPath }}
60+
- name: Restore library
61+
run: dotnet restore ${{ env.libraryPath }}
62+
- name: Restore tests
63+
run: dotnet restore ${{ env.testsPath }}
6164

6265
# --- SonarCloud begin ---
6366
- name: Prepare SonarQube analyze
@@ -71,16 +74,21 @@ jobs:
7174
/d:sonar.coverage.exclusions="benchmarks/**"
7275
7376
# --- Build ---
74-
- name: Build ${{ env.GitVersion_FullSemVer }}
77+
- name: Build library ${{ env.GitVersion_FullSemVer }}
7578
run: >
76-
dotnet build ${{ env.solutionPath }}
79+
dotnet build ${{ env.libraryPath }}
80+
--no-restore
81+
-c ${{ env.buildConfiguration }}
82+
- name: Build tests
83+
run: >
84+
dotnet build ${{ env.testsPath }}
7785
--no-restore
7886
-c ${{ env.buildConfiguration }}
7987
8088
# --- Test ---
81-
- name: Test ${{ env.solutionPath }}
89+
- name: Test
8290
run: >
83-
dotnet test ${{ env.solutionPath }} --no-build -c ${{ env.buildConfiguration }}
91+
dotnet test ${{ env.testsPath }} --no-build -c ${{ env.buildConfiguration }}
8492
--logger trx
8593
--results-directory "./TestResults/"
8694
--logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true"
@@ -103,7 +111,7 @@ jobs:
103111
# --- NuGet Pack + Upload ---
104112
- name: Pack NuGet package
105113
run: >
106-
dotnet pack ${{ env.solutionPath }}
114+
dotnet pack ${{ env.libraryPath }}
107115
--no-build
108116
-c ${{ env.buildConfiguration }}
109117
-o ./nupkg

0 commit comments

Comments
 (0)