diff --git a/.github/workflows/dotnet.yml b/.github/workflows/DeployGithubPage.yml similarity index 75% rename from .github/workflows/dotnet.yml rename to .github/workflows/DeployGithubPage.yml index c29c871..93b098f 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/DeployGithubPage.yml @@ -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: @@ -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 diff --git a/.github/workflows/UnitTest.yml b/.github/workflows/UnitTest.yml new file mode 100644 index 0000000..40e7dd1 --- /dev/null +++ b/.github/workflows/UnitTest.yml @@ -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 }} \ No newline at end of file diff --git a/src/InterfaceAdapter/Gaas.GobbletGobblers.Core.WebApi/Program.cs b/src/InterfaceAdapter/Gaas.GobbletGobblers.Core.WebApi/Program.cs index d408646..8e4822c 100644 --- a/src/InterfaceAdapter/Gaas.GobbletGobblers.Core.WebApi/Program.cs +++ b/src/InterfaceAdapter/Gaas.GobbletGobblers.Core.WebApi/Program.cs @@ -30,6 +30,7 @@ logging.ClearProviders(); logging.AddConsole(); }); +builder.Services.AddHealthChecks(); var app = builder.Build(); @@ -50,6 +51,8 @@ app.UseMiddleware(); +app.MapHealthChecks("/health"); + app.Run(); public partial class Program { }