Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Update azure-pipelines.yml for Azure Pipelines #340

Update azure-pipelines.yml for Azure Pipelines

Update azure-pipelines.yml for Azure Pipelines #340

Workflow file for this run

name: SonarCloud Build
on:
push:
branches:
- develop
- test
- main
- feature/*
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
- name: Restore Dependencies
run: dotnet restore DevOpsAPI.sln
- name: Build
run: dotnet build DevOpsAPI.sln --configuration Release --no-restore
- name: Install SonarCloud scanner
run: |
dotnet tool update dotnet-sonarscanner --global
- name: SonarCloud Scan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
dotnet tool install --global dotnet-coverage
dotnet-sonarscanner begin /k:"funkysi1701_DevOpsAPI" /o:"funkysi1701" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
dotnet build --no-incremental DevOpsAPI.sln
dotnet-coverage collect 'dotnet test DevOpsAPI.sln' -f xml -o 'coverage.xml'
dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
- name: CodeCov
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov