Skip to content

Commit

Permalink
Combine build and test-with-code-coverage to streamline and accelerat…
Browse files Browse the repository at this point in the history
…e the build pipeline
  • Loading branch information
tjementum committed Nov 22, 2023
1 parent c4f01b4 commit c4a193d
Showing 1 changed file with 17 additions and 50 deletions.
67 changes: 17 additions & 50 deletions .github/workflows/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ permissions:
contents: read

jobs:
build:
name: Build
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
outputs:
version: ${{ steps.generate_version.outputs.version }}
Expand Down Expand Up @@ -61,43 +61,6 @@ jobs:
- name: Build
run: dotnet build application/PlatformPlatform.sln --no-restore --configuration Release /p:Version=${{ steps.generate_version.outputs.version }}

- 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/**/*

test-with-code-coverage:
name: Test and Code Coverage
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Bun
uses: oven-sh/setup-bun@v1

- name: Restore 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: Setup-java
uses: actions/setup-java@v3
with:
Expand All @@ -114,9 +77,19 @@ jobs:
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
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down Expand Up @@ -165,29 +138,23 @@ jobs:
account-management-publish:
name: Account Management Publish
needs: [build]
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.outputs.version }}
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,
test-with-code-coverage,
jetbrains-code-inspection,
account-management-publish,
]
needs: [build-and-test, account-management-publish]
uses: ./.github/workflows/_deploy-container.yml
secrets: inherit
with:
image_name: account-management
version: ${{ needs.build.outputs.version }}
version: ${{ needs.build-and-test.outputs.version }}

0 comments on commit c4a193d

Please sign in to comment.