Skip to content

upgrade net version for test projects #165

upgrade net version for test projects

upgrade net version for test projects #165

Workflow file for this run

name: build
on:
push:
branches:
- master
tags-ignore:
- "*"
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 01 Checkout Code
uses: actions/checkout@v2
- name: 02 Setup .Net SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
7.0.100
- name: 03 Build with dotnet
run: dotnet build
code-check-format:
runs-on: ubuntu-latest
steps:
- name: 01 Checkout Code
uses: actions/checkout@v2
- name: 02 Setup .Net SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
7.0.100
- name: 03 Restore Dotnet Tool
run: dotnet tool restore
- name: 04 Check Code Format
run: dotnet format --verify-no-changes
code-scan-sonar:
runs-on: ubuntu-latest
steps:
- name: 01 Checkout Code
uses: actions/checkout@v2
- name: 02 Setup .Net SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
7.0.100
- name: 03 Setup JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: 04 Install SonarScanner
run: dotnet tool restore
- name: 05 Set Sonar Environments
run: |
SONAR_OWNER=$(echo ${GITHUB_REPOSITORY_OWNER} | tr 'A-Z' 'a-z')
SONAR_PROJECT=$(echo ${GITHUB_REPOSITORY} | tr 'A-Z' 'a-z' | tr '/' '_')
echo SONAR_OWNER=${SONAR_OWNER} >> $GITHUB_ENV
echo SONAR_PROJECT=${SONAR_PROJECT} >> $GITHUB_ENV
- name: 06 Begin Scan With SonarCloud
run: dotnet sonarscanner begin /k:${SONAR_PROJECT} /o:${SONAR_OWNER} /d:sonar.login="${{secrets.SONAR_TOKEN}}" /d:sonar.host.url="https://sonarcloud.io"
- name: 07 Build with dotnet
run: dotnet build
- name: 08 End Scan With SonarCloud
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: dotnet sonarscanner end /d:sonar.login="${{secrets.SONAR_TOKEN}}"
test:
runs-on: ubuntu-latest
steps:
- name: 01 Checkout Code
uses: actions/checkout@v1
- name: 02 Setup .Net SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
7.0.100
- name: 03 Restore Dotnet Tool
run: dotnet tool restore
- name: 04 Run Unit test
run: dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:Exclude="[*Test]*"
# - name: 05 Combin All Test Report
# run: dotnet reportgenerator -reports:test/**/coverage.cobertura.xml -reporttype:cobertura -targetdir:.
# - name: 06 Save Artifact
# uses: actions/upload-artifact@v3
# with:
# name: cobertura_report
# path: ./Cobertura.xml
# - name: 07 Upload coverage to Codecov
# uses: codecov/codecov-action@v2
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# flags: unittests
# fail_ci_if_error: true