Skip to content

Commit 3e6375e

Browse files
authored
Fix exception name + add CI for pull requests (#24)
1 parent 6f9ff45 commit 3e6375e

File tree

5 files changed

+39
-5
lines changed

5 files changed

+39
-5
lines changed

.github/workflows/manual-publish-release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: .NET Core Build and Publish
22

33
on:
44
push:
5-
5+
66
env:
7-
NETCORE_VERSION: '3.1.x'
7+
NETCORE_VERSION: '7.0'
88
GIT_REPO_ROOT: src
99
MAJOR_MINOR_VERSION: 1.0.
1010
SOLUTION_FILE: DotnetBuildMetrics.sln

.github/workflows/pull-request.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: .NET Core Build
2+
3+
on:
4+
pull_request:
5+
6+
env:
7+
NETCORE_VERSION: '7.0'
8+
GIT_REPO_ROOT: src
9+
SOLUTION_FILE: DotnetBuildMetrics.sln
10+
DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX: 2
11+
12+
jobs:
13+
14+
build:
15+
name: Build Package
16+
runs-on: windows-latest # using windows agent for net472 build.
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Setup .NET Core SDK ${{ env.NETCORE_VERSION }}
21+
uses: actions/setup-dotnet@v1
22+
with:
23+
dotnet-version: ${{ env.NETCORE_VERSION }}
24+
25+
- name: Restore
26+
working-directory: ${{ env.GIT_REPO_ROOT }}
27+
run: dotnet restore ${{ env.SOLUTION_FILE }}
28+
29+
- name: Add MSBuild to PATH
30+
uses: microsoft/setup-msbuild@v1
31+
32+
- name: Build
33+
working-directory: ${{ env.GIT_REPO_ROOT }}
34+
run: dotnet build ${{ env.SOLUTION_FILE }} --configuration Debug --no-restore

src/Agoda.Builds.Metrics/MeasureBuildTime.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public override bool Execute()
5252

5353
DevFeedbackPublisher.Publish(ApiEndPoint, data);
5454
}
55-
catch (GitContextNotFoundException ex)
55+
catch (GitContextException ex)
5656
{
5757
Log.LogMessage($"The build time will not be published: {ex.Message}");
5858
}

src/Agoda.DevFeedback.AspNetStartup/TimedStartupHostedService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void OnStarted()
4949
{
5050
TimedStartupPublisher.Publish(type: ".AspNetStartup", timeTaken: diff);
5151
}
52-
catch (GitContextNotFoundException ex)
52+
catch (GitContextException ex)
5353
{
5454
_logger.LogInformation("The startup time will not be published: {reason}", ex.Message);
5555
}

src/Agoda.DevFeedback.AspNetStartup/TimedStartupMiddleware.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public async Task Invoke(HttpContext httpContext)
4545
{
4646
TimedStartupPublisher.Publish(type: ".AspNetResponse", timeTaken: diff);
4747
}
48-
catch (GitContextNotFoundException ex)
48+
catch (GitContextException ex)
4949
{
5050
_logger.LogInformation("The startup time until first response will not be published: {reason}", ex.Message);
5151
}

0 commit comments

Comments
 (0)