Skip to content

Request log file

Request log file #54

Workflow file for this run

name: .NET
on:
push:
branches: [ "Development" ]
pull_request:
branches: [ "Development" ]
env:
IMAGE_NAME: CargoHub
OWNER: "${{ github.repository_owner }}"
DOTNET_INSTALL_DIR: "./.dotnet"
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Add packages
run: |
dotnet add package Newtonsoft.Json
dotnet add package xunit
- name: Build
run: dotnet build --no-restore
test:
needs: build
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Build the application
run: dotnet build --configuration Release
- name: Run application
run: dotnet run --no-build --configuration Release --urls=http://0.0.0.0:3000 & sleep 5
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install httpx pytest coverage
- name: Run integration tests
run: coverage run -m pytest
- name: Generate code coverage report
run: |
coverage xml -o coverage.xml
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
coverage report --fail-under=90
- name: Check for coverage file
run: |
if [ ! -f "coverage.xml" ]; then
echo "coverage.xml file not found"
exit 1
fi
shell: bash
- name: Install ReportGenerator
run: |
dotnet tool install --global dotnet-reportgenerator-globaltool
echo "Installed tools:"
dotnet tool list --global
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
- name: Generate Coverage Report
run: |
# Find the .NET tools directory
DOTNET_TOOLS_DIR="$HOME/.dotnet/tools"
echo "DOTNET_TOOLS_DIR: $DOTNET_TOOLS_DIR"
# Add .NET tools to PATH
export PATH="$PATH:$DOTNET_TOOLS_DIR"
# Verify ReportGenerator is in PATH
which reportgenerator || echo "ReportGenerator not found in PATH"
# Run ReportGenerator using full path
$DOTNET_TOOLS_DIR/reportgenerator \
-reports:"coverage.xml" \
-targetdir:"coverage-report" \
-reporttypes:Html
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
#Upload Coverage Report as an artifact
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage-report