Skip to content

Improve client app router configuration (#231) #205

Improve client app router configuration (#231)

Improve client app router configuration (#231) #205

Workflow file for this run

name: Application - Build and Deploy
on:
push:
branches:
- main
paths:
- "application/**"
- ".github/workflows/application.yml"
- "!**.md"
pull_request:
paths:
- "application/**"
- ".github/workflows/application.yml"
- "!**.md"
workflow_dispatch:
permissions:
id-token: write
contents: read
jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
outputs:
version: ${{ steps.generate_version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Generate version
id: generate_version
run: |
VERSION=$(date +"%Y.%m.%d").$GITHUB_RUN_NUMBER
echo "Generated version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Install Bun
uses: oven-sh/setup-bun@v1
- name: Install Node modules
working-directory: application/account-management/WebApp
run: bun install --frozen-lockfile
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Restore .NET tools
working-directory: application
run: |
dotnet tool restore &&
dotnet workload install aspire
- name: Restore .NET dependencies
working-directory: application
run: dotnet restore
- name: Setup-java
uses: actions/setup-java@v3
with:
distribution: "microsoft"
java-version: "17"
- name: Run Test with dotCover and SonarScanner reporting
working-directory: application
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
dotnet sonarscanner begin /k:"${{ vars.SONAR_PROJECT_KEY }}" /o:"${{ vars.SONAR_ORGANIZATION }}" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.dotcover.reportsPaths="coverage/dotCover.html" &&
dotnet dotcover test PlatformPlatform.sln --dcOutput="coverage/dotCover.html" --dcReportType=HTML &&
dotnet sonarscanner end /d:sonar.login="${SONAR_TOKEN}"
- name: Publish Account Management build
working-directory: application/account-management
run: |
dotnet publish ./Api/Api.csproj --no-restore --configuration Release --output ./Api/publish --version-suffix ${{ steps.generate_version.outputs.version }}
- name: Save Account Management artifacts
uses: actions/upload-artifact@v3
with:
name: account-management
path: application/account-management/Api/publish/**/*
jetbrains-code-inspection:
name: JetBrains Code Inspections
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Bun
uses: oven-sh/setup-bun@v1
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Restore .NET tools
working-directory: application
run: |
dotnet tool restore &&
dotnet workload install aspire
- name: Restore .NET dependencies
working-directory: application
run: dotnet restore
- name: Run code inspections
working-directory: application
run: |
dotnet jb inspectcode PlatformPlatform.sln --build --output=result.xml --severity=SUGGESTION
# Check if there are any issues. <Issues /> indicates no issues found.
if ! grep -q '<Issues />' result.xml; then
cat result.xml
echo "Code inspection issues found."
exit 1
fi
- name: Check for code formatting issues
working-directory: application
run: |
dotnet jb cleanupcode PlatformPlatform.sln --profile=".NET only"
# Check for any changes made by the code formatter
git diff --exit-code || {
echo "Formatting issues detected. Please run 'dotnet jb cleanupcode PlatformPlatform.sln --profile=\".NET only\"' locally and commit the formatted code."
exit 1
}
account-management-publish:
name: Account Management Publish
needs: [build-and-test]
uses: ./.github/workflows/_publish-container.yml
secrets: inherit
with:
artifacts_name: account-management
artifacts_path: application/account-management/Api/publish
image_name: account-management
version: ${{ needs.build-and-test.outputs.version }}
docker_context: ./application/account-management
docker_file: ./Api/Dockerfile
account-management-deploy:
name: Account Management Deploy
if: github.ref == 'refs/heads/main'
needs: [build-and-test, account-management-publish]
uses: ./.github/workflows/_deploy-container.yml
secrets: inherit
with:
image_name: account-management
version: ${{ needs.build-and-test.outputs.version }}