Bump the mstest group (#43) #67
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: Build | |
on: | |
push: | |
branches: [ main ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
version: | |
runs-on: ubuntu-latest | |
outputs: | |
NuGetVersion: ${{ steps.gitversion.outputs.NuGetVersion }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v0.11.0 | |
with: | |
versionSpec: 5.x | |
- name: Determine Version | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v0.11.0 | |
with: | |
useConfigFile: true | |
buildAndTest: | |
needs: version | |
runs-on: windows-latest | |
steps: | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'zulu' | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup Chrome and Chrome Driver | |
uses: nanasess/setup-chromedriver@master | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v4 | |
with: | |
path: ~\sonar\cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache SonarCloud scanner | |
id: cache-sonar-scanner | |
uses: actions/cache@v4 | |
with: | |
path: .\.sonar\scanner | |
key: ${{ runner.os }}-sonar-scanner | |
restore-keys: ${{ runner.os }}-sonar-scanner | |
- name: Install SonarCloud scanner | |
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' | |
shell: powershell | |
run: | | |
New-Item -Path .\.sonar\scanner -ItemType Directory | |
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner | |
- name: Install Coverlet Console | |
shell: powershell | |
run: | | |
New-Item -Path .\.coverlet\console -ItemType Directory | |
dotnet tool install coverlet.console --tool-path .\.coverlet\console | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build and analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
shell: powershell | |
run: | | |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"WebExtensions.Net" /o:"mingyaulee" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /v:"v${{ needs.version.outputs.NuGetVersion }}" /d:sonar.cs.vstest.reportsPaths="test/TestResults/*.trx" /d:sonar.cs.opencover.reportsPaths="test/TestResults/**/*.opencover.xml" | |
dotnet build --no-restore --configuration Release | |
.\.coverlet\console\coverlet ./test/WebExtensions.Net.BrowserExtensionIntegrationTest/bin/Release/net8.0/browserextension/framework --include "[WebExtensions.Net]*" --target "dotnet" --targetargs "test . --no-restore --no-build --configuration Release" --format opencover --output ./test/TestResults/coverage --verbosity detailed | |
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" | |
tag: | |
needs: [version, buildAndTest] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check if tag exists | |
uses: mukunku/tag-exists-action@v1.6.0 | |
id: tagExistsCheck | |
with: | |
tag: 'v${{ needs.version.outputs.NuGetVersion }}' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create tag | |
if: steps.tagExistsCheck.outputs.exists == 'false' | |
uses: negz/create-tag@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
version: v${{ needs.version.outputs.NuGetVersion }} |