Skip to content

pipelines using mssql service #12

pipelines using mssql service

pipelines using mssql service #12

name: Upload coverage to Codacy
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
services:
sqlserver:
image: mcr.microsoft.com/mssql/server
env:
SA_PASSWORD: "AMoreComplexPsw123!"
ACCEPT_EULA: "Y"
ports:
- 1433:1433
options: >-
--health-cmd "exit 0"
--health-interval 10s
--health-timeout 30s
--health-retries 5
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build solution
run: dotnet build --configuration Release --no-restore
- name: Run tests with coverage
env:
ConnectionStrings__DefaultConnection: "Server=localhost,1433;Database=master;User Id=sa;Password=AMoreComplexPsw123!;Trusted_Connection=False;MultipleActiveResultSets=true;"
run: dotnet test --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage/ --settings coverage.runsettings
- name: Upload coverage to Codacy
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
run: |
COBERTURA_FILE=$(find . -name coverage.cobertura.xml)
if [ -z "$COBERTURA_FILE" ]; then
echo "Coverage report not found!"
exit 1
fi
echo "Found coverage file at: ${COBERTURA_FILE}"
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r $COBERTURA_FILE