Skip to content

chore(deps): Bump the testing-packages group with 5 updates #45

chore(deps): Bump the testing-packages group with 5 updates

chore(deps): Bump the testing-packages group with 5 updates #45

Workflow file for this run

name: Backend CI
on:
push:
branches:
- main
paths:
- 'Backend/**'
- '.github/workflows/backend-ci.yml'
pull_request:
paths:
- 'Backend/**'
- '.github/workflows/backend-ci.yml'
workflow_dispatch:
env:
DOTNET_VERSION: '8.0.x'
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/podium-backend
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
working-directory: ./Backend/Podium
run: dotnet restore
- name: Build
working-directory: ./Backend/Podium
run: dotnet build --no-restore --configuration Release
- name: Run tests with coverage
working-directory: ./Backend/Podium
run: |
dotnet test --no-build --configuration Release \
--logger "trx;LogFileName=test-results.trx" \
--logger "console;verbosity=detailed" \
--collect:"XPlat Code Coverage" \
--results-directory ./TestResults
- name: Publish test results
uses: dorny/test-reporter@v1
if: always()
with:
name: Backend Test Results
path: '**/TestResults/*.trx'
reporter: dotnet-trx
fail-on-error: true
fail-on-empty: false
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: backend-test-results
path: Backend/Podium/TestResults/
retention-days: 30
- name: Code Coverage Summary
uses: irongut/CodeCoverageSummary@v1.3.0
if: always()
with:
filename: '**/TestResults/**/coverage.cobertura.xml'
badge: true
fail_below_min: false
format: markdown
hide_branch_rate: false
hide_complexity: false
indicators: true
output: both
thresholds: '60 80'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md
build:
name: Build Application
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
working-directory: ./Backend/Podium
run: dotnet restore
- name: Build application
working-directory: ./Backend/Podium
run: dotnet build --configuration Release --no-restore
- name: Publish application
working-directory: ./Backend/Podium/Podium.API
run: dotnet publish --configuration Release --output ./publish --no-build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: backend-build
path: Backend/Podium/Podium.API/publish/
retention-days: 7
docker:
name: Build and Push Docker Image
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr,prefix=pr-
type=sha,prefix=sha-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./Backend
file: ./Backend/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
- name: Image digest
run: echo "Image pushed with digest ${{ steps.meta.outputs.digest }}"