Skip to content

- Updated build;

- Updated build; #18

Workflow file for this run

name: Feature build
on:
push:
branches: [ 'feature/*' ]
paths-ignore:
- '**/README.md'
env:
DOTNET_VERSION: '8.0.x'
BUILD_CONFIGURATION: 'Release'
SONAR_CLOUD_PROJECT_KEY: 'Xhaguatende_api-demo'
defaults:
run:
working-directory: ./src
# Ensures only one execution per branch will run at a time.
concurrency:
group: ${{ github.ref }}
jobs:
build:
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:7
ports:
- 27017:27017
options: "--health-cmd \"mongosh --eval 'db.runCommand({ping: 1})'\" --health-interval 10s --health-timeout 5s --health-retries 5"
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore dependencies
run: dotnet restore
- name: Install SonarCloud
run: dotnet tool install --global dotnet-sonarscanner --version 5.15.1
- name: Begin SonarCloud Scan
run: |
dotnet sonarscanner begin /o:"${{ secrets.SONAR_CLOUD_ORGANIZATION }}" \
/k:"${{ env.SONAR_CLOUD_PROJECT_KEY }}" \
/v:"${{ steps.gitversion.outputs.nuGetVersionV2 }}" \
/d:sonar.host.url="${{ secrets.SONAR_CLOUD_URL }}" \
/d:sonar.login="${{ secrets.SONAR_TOKEN }}" \
/d:sonar.cs.opencover.reportsPaths=./CoverageResults/coverage.opencover.xml \
/d:sonar.coverage.exclusions="**Test*.cs" \
/d:sonar.qualitygate.wait=true
- name: Build
run: dotnet build --no-restore --configuration ${{ env.BUILD_CONFIGURATION }} -p:GeneratePackageOnBuild=false
- name: Test
run: |
dotnet test --no-restore --no-build --verbosity normal --configuration ${{ env.BUILD_CONFIGURATION }} \
/p:CollectCoverage=true \
/p:CoverletOutput=../CoverageResults/ \
/p:MergeWith="../CoverageResults/coverage.json" \
/p:CoverletOutputFormat=\"opencover,json\" \
-m:1
- name: End SonarCloud Scan
run: dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}