Landing page initial version #661
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v4 | |
- name: Generate version | |
id: generate_version | |
run: | | |
# Strip leading 0s of Hours and Minutes after midnight | |
MINUTE=$(printf "%s" $(date +"%-H%M") | sed 's/^0*//') | |
VERSION=$(date +"%Y.%-m.%-d.")$MINUTE | |
echo "Generated version: $VERSION" | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install Node modules | |
working-directory: application/account-management/WebApp | |
run: yarn install --frozen-lockfile | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v4 | |
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 JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "microsoft" | |
java-version: "17" | |
- name: Run tests with dotCover and SonarScanner reporting | |
working-directory: application | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
if [[ "${{ vars.SONAR_PROJECT_KEY }}" == "" ]]; then | |
echo "SonarCloud is not enabled. Skipping SonarCloud analysis." | |
dotnet build PlatformPlatform.sln --no-restore /p:Version=${{ steps.generate_version.outputs.version }} | |
else | |
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 build PlatformPlatform.sln --no-restore /p:Version=${{ steps.generate_version.outputs.version }} && | |
dotnet dotcover test PlatformPlatform.sln --no-build --dcOutput=coverage/dotCover.html --dcReportType=HTML --dcFilters="+:PlatformPlatform.*;-:*.Tests;-:type=*.AppHost.*" && | |
dotnet sonarscanner end /d:sonar.login="${SONAR_TOKEN}" | |
fi | |
- name: Publish frontend artifacts | |
working-directory: application/account-management/WebApp | |
run: yarn run publish | |
- name: Publish Account Management API build | |
working-directory: application/account-management | |
run: | | |
dotnet publish ./Api/Api.csproj --no-restore --configuration Release --output ./Api/publish /p:Version=${{ steps.generate_version.outputs.version }} | |
- name: Save Account Management API artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: account-management-api | |
path: application/account-management/Api/publish/**/* | |
- name: Publish Account Management Worker build | |
working-directory: application/account-management | |
run: | | |
dotnet publish ./Workers/Workers.csproj --no-restore --configuration Release --output ./Workers/publish /p:Version=${{ steps.generate_version.outputs.version }} | |
- name: Save Account Management Workers artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: account-management-workers | |
path: application/account-management/Workers/publish/**/* | |
- name: Publish App Gateway build | |
working-directory: application | |
run: | | |
dotnet publish ./AppGateway/AppGateway.csproj --no-restore --configuration Release --output ./AppGateway/publish /p:Version=${{ steps.generate_version.outputs.version }} | |
- name: Save App Gateway artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-gateway | |
path: application/AppGateway/publish/**/* | |
code-style-and-linting: | |
name: Code Style and Linting | |
if: github.ref != 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install Node modules | |
working-directory: application/account-management/WebApp | |
run: yarn install --frozen-lockfile | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v4 | |
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: Build backend solution | |
working-directory: application | |
run: dotnet build PlatformPlatform.sln --no-restore | |
- name: Run code inspections | |
working-directory: application | |
run: | | |
dotnet jb inspectcode PlatformPlatform.sln --no-build --output=result.json --severity=SUGGESTION | |
# Check if there are any issues. <Issues /> indicates no issues found. | |
if ! grep -q '\"results\": \[\],' result.json; then | |
cat result.json | |
echo "Code inspection issues found." | |
exit 1 | |
fi | |
- name: Check for code formatting issues | |
working-directory: application | |
run: | | |
dotnet jb cleanupcode PlatformPlatform.sln --no-build --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 | |
} | |
- name: Build frontend artifacts | |
working-directory: application/account-management/WebApp | |
run: yarn run build | |
- name: Run ESLint | |
working-directory: application/account-management/WebApp | |
run: yarn run lint | |
- name: Run Type Checking | |
working-directory: application/account-management/WebApp | |
run: yarn run typechecking | |
account-management-api-publish: | |
name: Account Management API Publish | |
needs: [build-and-test] | |
uses: ./.github/workflows/_publish-container.yml | |
secrets: inherit | |
with: | |
artifacts_name: account-management-api | |
artifacts_path: application/account-management/Api/publish | |
image_name: account-management-api | |
version: ${{ needs.build-and-test.outputs.version }} | |
docker_context: ./application/account-management | |
docker_file: ./Api/Dockerfile | |
account-management-api-deploy: | |
name: Account Management API Deploy | |
if: github.ref == 'refs/heads/main' | |
needs: [build-and-test, account-management-api-publish] | |
uses: ./.github/workflows/_deploy-container.yml | |
secrets: inherit | |
with: | |
image_name: account-management-api | |
version: ${{ needs.build-and-test.outputs.version }} | |
account-management-workers-publish: | |
name: Account Management Workers Publish | |
needs: [build-and-test] | |
uses: ./.github/workflows/_publish-container.yml | |
secrets: inherit | |
with: | |
artifacts_name: account-management-workers | |
artifacts_path: application/account-management/Workers/publish | |
image_name: account-management-workers | |
version: ${{ needs.build-and-test.outputs.version }} | |
docker_context: ./application/account-management | |
docker_file: ./Workers/Dockerfile | |
account-management-workers-deploy: | |
name: Account Management Workers Deploy | |
if: github.ref == 'refs/heads/main' | |
needs: [build-and-test, account-management-workers-publish] | |
uses: ./.github/workflows/_deploy-container.yml | |
secrets: inherit | |
with: | |
image_name: account-management-workers | |
version: ${{ needs.build-and-test.outputs.version }} | |
app-gateway-publish: | |
name: App Gateway Publish | |
needs: [build-and-test] | |
uses: ./.github/workflows/_publish-container.yml | |
secrets: inherit | |
with: | |
artifacts_name: app-gateway | |
artifacts_path: application/AppGateway/publish | |
image_name: app-gateway | |
version: ${{ needs.build-and-test.outputs.version }} | |
docker_context: ./application | |
docker_file: ./AppGateway/Dockerfile | |
app-gateway-deploy: | |
name: App Gateway Deploy | |
if: github.ref == 'refs/heads/main' | |
needs: [build-and-test, app-gateway-publish] | |
uses: ./.github/workflows/_deploy-container.yml | |
secrets: inherit | |
with: | |
image_name: app-gateway | |
version: ${{ needs.build-and-test.outputs.version }} |