Update dotnet monorepo to v9 (major) #132
This file contains hidden or 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: build | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Output Run Number | |
run: echo ${{ github.run_number }} | |
- uses: actions/checkout@v2 | |
- name: Fetch Git Details for Semantic Versioning | |
run: git fetch --prune --unshallow --tags | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 3.1.301 | |
- name: Install dependencies | |
run: dotnet restore | |
working-directory: src/ElectricityMap.DotNet.Client | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v2 | |
with: | |
path: ~\sonar\cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache SonarCloud scanner | |
id: cache-sonar-scanner | |
uses: actions/cache@v2 | |
with: | |
path: .\.sonar\scanner | |
key: ${{ runner.os }}-sonar-scanner | |
restore-keys: ${{ runner.os }}-sonar-scanner | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
working-directory: src/ElectricityMap.DotNet.Client | |
- name: Test | |
run: dotnet test --blame --no-restore --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=opencover.xml | |
working-directory: test/ElectricityMap.DotNet.Client.Test | |
- name: SonarCloud Scan | |
uses: sonarsource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Publish NuGet Package | |
id: publish_nuget | |
uses: rohith/publish-nuget@v2 | |
with: | |
PROJECT_FILE_PATH: src/ElectricityMap.DotNet.Client/ElectricityMap.DotNet.Client.csproj | |
PACKAGE_NAME: ElectricityMap.DotNet.Client | |
NUGET_KEY: ${{ secrets.NUGET_API_KEY }} |