Merge pull request #14 from managedcode/dependabot/nuget/ManagedCode.… #127
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: .NET | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
# run build and test | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore | |
- name: Test and Collect Code Coverage | |
run: dotnet test -p:CollectCoverage=true -p:CoverletOutput=coverage/ | |
- name: Copy coverage files | |
run: | | |
mkdir '${{ github.workspace }}/coverage' | |
find . -name "*.opencover.xml" -exec sh -c 'cp "$0" "coverage/coverage-$(basename $0)"' {} \; | |
- name: List coverage files | |
run: ls '${{ github.workspace }}/coverage/' | |
- name: SonarCloud Scan | |
uses: sonarsource/sonarcloud-github-action@master | |
with: | |
args: > | |
-Dsonar.organization=managedcode | |
-Dsonar.projectKey=managedcode_Communication | |
-Dsonar.token=${{ secrets.SONAR_TOKEN }} | |
-Dsonar.cs.opencover.reportsPaths=${{ github.workspace }}/coverage/ | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: NDepend | |
uses: ndepend/ndepend-action@v1 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
license: ${{ secrets.NDEPENDLICENSE }} | |
coveragefolder: ${{ github.workspace }}/coverage/ | |
baseline: main_recent | |
retention-days: 15 | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
# - name: coveralls | |
# uses: coverallsapp/github-action@master | |
# with: | |
# github-token: ${{secrets.GITHUB_TOKEN }} | |
# path-to-lcov: coverage/coverage.info |