Skip to content

Commit

Permalink
Add health check
Browse files Browse the repository at this point in the history
  • Loading branch information
oneheed committed Aug 22, 2023
1 parent c1a3815 commit a1e5124
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET
name: Deploy Github Page

on:
push:
branches: [ "main" ]
paths: ['src/InterfaceAdapter/Gaas.GobbletGobblers.Client/**']
pull_request:
branches: [ "main" ]
paths: ['src/InterfaceAdapter/Gaas.GobbletGobblers.Client/**']

env:
REPOSITORY_NAME: 'Gobblet-Gobblers'
DOTNET_APP_PUBLISH_PROJECT_PATH: './src/InterfaceAdapter/Gaas.GobbletGobblers.Core.WebApi'
DOTNET_CLINET_PUBLISH_PROJECT_PATH: './src/InterfaceAdapter/Gaas.GobbletGobblers.Client'
DOTNET_Test_PUBLISH_PROJECT_PATH: './test/Gaas.GobbletGobblers.Core.Tests'

jobs:
build:
Expand All @@ -26,13 +26,7 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore ${{ env.DOTNET_APP_PUBLISH_PROJECT_PATH }}
- name: Build
run: dotnet build ${{ env.DOTNET_APP_PUBLISH_PROJECT_PATH }} --no-restore
- name: Test
run: dotnet test ${{ env.DOTNET_Test_PUBLISH_PROJECT_PATH }}


# 修改成專案名稱
- name: Publish .NET Core Project
run: dotnet publish ${{ env.DOTNET_CLINET_PUBLISH_PROJECT_PATH }}/Gaas.GobbletGobblers.Client.csproj -c Release -o release --nologo
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/UnitTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: Gaas.GobbletGobblers.Core.WebApi Test

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
DOTNET_APP_PUBLISH_PROJECT_PATH: './src/InterfaceAdapter/Gaas.GobbletGobblers.Core.WebApi'
DOTNET_Test_PUBLISH_PROJECT_PATH: './test/Gaas.GobbletGobblers.Core.Tests'

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore ${{ env.DOTNET_APP_PUBLISH_PROJECT_PATH }}
- name: Build
run: dotnet build ${{ env.DOTNET_APP_PUBLISH_PROJECT_PATH }} --no-restore
- name: Test
run: dotnet test ${{ env.DOTNET_Test_PUBLISH_PROJECT_PATH }}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
logging.ClearProviders();
logging.AddConsole();
});
builder.Services.AddHealthChecks();

var app = builder.Build();

Expand All @@ -50,6 +51,8 @@

app.UseMiddleware<ExceptionHandlingMiddleWare>();

app.MapHealthChecks("/health");

app.Run();

public partial class Program { }

0 comments on commit a1e5124

Please sign in to comment.