Skip to content

Workflow file for this run

name: Build
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows to run this workflow manually from the Actions tab
workflow_dispatch:
# Workflow jobs
jobs:
Build:
runs-on: ubuntu-latest
steps:
# Checkout
- name: Git checkout
uses: actions/checkout@v2
# Needs .NET
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
# Run dotnet restore
- name: Run dotnet restore
run: dotnet restore Cmf.CustomerPortal.Sdk.sln
# Run dotnet build
- name: Run dotnet build
run: dotnet build Cmf.CustomerPortal.Sdk.sln --no-restore --configuration Release
# Run tests with coverage
- name: Run Unit Tests with Coverage
run: |
dotnet test Cmf.CustomerPortal.Sdk.sln --no-build --no-restore --configuration Release \
--collect:"XPlat Code Coverage" \
--logger trx \
--results-directory TestResults
- name: Merge Coverage Reports
run: |
dotnet tool install --global dotnet-reportgenerator-globaltool
reportgenerator -reports:TestResults/**/coverage.cobertura.xml \
-targetdir:TestResults/MergedCoverage \
-reporttypes:Cobertura
- name: Code Coverage Report
uses: irongut/[email protected]
with:
filename: TestResults/MergedCoverage/Cobertura.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '7 7'
- 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
- name: Write to Job Summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
Build:

Check failure on line 66 in .github/workflows/build.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build.yml

Invalid workflow file

You have an error in your yaml syntax on line 66
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main-123694-PortalSDKUnitTestsInPipeline'
steps:
# Run build
- name: Build Windows
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
run: dotnet publish --no-build --no-restore --configuration Release --self-contained --runtime win-x64 Cmf.CustomerPortal.Sdk.sln
- name: Build Linux
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
run: dotnet publish --no-build --no-restore --configuration Release --self-contained --runtime linux-x64 Cmf.CustomerPortal.Sdk.sln
# Read version
- name: Read tool version
uses: QwerMike/xpath-action@v1
id: getver
with:
filename: src/Version.props
expression: '/Project/PropertyGroup/Version/text()'
# Archive
- name: Archive Console Win64
uses: actions/upload-artifact@v4
with:
name: Cmf.CustomerPortal.Sdk.Console-${{ steps.getver.outputs.result }}.win-x64
path: src/Console/bin/Release/net8.0/win-x64/publish/
- name: Archive Console Linux64
uses: actions/upload-artifact@v4
with:
name: Cmf.CustomerPortal.Sdk.Console-${{ steps.getver.outputs.result }}.linux-x64
path: src/Console/bin/Release/net8.0/linux-x64/publish/
- name: Archive PowerShell
uses: actions/upload-artifact@v4
with:
name: Cmf.CustomerPortal.Sdk.PowerShell-${{ steps.getver.outputs.result }}
path: src/Powershell/bin/Release/net8.0/linux-x64/publish/