Skip to content

AB#65 Sonar Security Hotspots #59

AB#65 Sonar Security Hotspots

AB#65 Sonar Security Hotspots #59

Workflow file for this run

name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
DOTNET_VERSION: "10.0.x"
NODE_VERSION: "20"
jobs:
test:
name: Test
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
- name: Restore dependencies
run: dotnet restore
- name: Build project
run: dotnet build --no-restore --configuration Release
- name: Run unit tests
run: dotnet test --no-build --verbosity normal --configuration Release /p:CollectCoverage=true /p:Threshold=50 /p:ThresholdType=line /p:ThresholdStat=Average /p:CoverletOutputFormat=opencover /p:CoverletOutput=./TestResults/ /p:ExcludeByAttribute="GeneratedCodeAttribute"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de
with:
token: ${{ secrets.CODECOV_TOKEN }}
publish-github-packages:
name: Publish to GitHub Packages
runs-on: ubuntu-latest
if: github.repository_owner == 'BpsLogicBuilder'
permissions:
contents: read
packages: write
needs: test
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
source-url: https://nuget.pkg.github.com/bpsLogicBuilder/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Restore dependencies
run: dotnet restore
- name: Build project
run: dotnet build --no-restore --configuration Release
- name: Publish to GitHub Packages
run: |
dotnet pack --configuration Release --no-build -o ./nupkg
dotnet nuget push ./nupkg/*.nupkg --skip-duplicate --api-key ${{ env.GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}