Merge branch 'develop' of https://github.com/AxaGuilDEv/webengine-dot… #98
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
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: Build WebEngine (Develop) | |
on: | |
push: | |
branches: | |
- develop | |
- main | |
- preview | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
# checkout | |
- uses: actions/[email protected] | |
- name: Setup .NET | |
uses: actions/[email protected] | |
with: | |
dotnet-version: 6.0.x | |
- name: Install .NET Coverage | |
run: | | |
dotnet tool install --global dotnet-coverage | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- uses: actions/[email protected] | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Replace tokens | |
uses: cschleiden/[email protected] | |
with: | |
tokenPrefix: '#{' | |
tokenSuffix: '}#' | |
files: '["**/Settings.cs"]' | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v1 | |
with: | |
path: ~\sonar\cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache SonarCloud scanner | |
id: cache-sonar-scanner | |
uses: actions/[email protected] | |
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 | |
dotnet tool install --global dotnet-sonarscanner --version 5.2.0 | |
# Restore | |
- name: Restore | |
run: dotnet restore "./src" | |
- name: Build and analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
shell: powershell | |
run: | | |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"AxaGuilDEv_webengine-dotnet" /o:"axaguildev" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml | |
dotnet build "./src" --no-restore --configuration Debug -p:Version=1.1.${{github.run_number}} | |
dotnet-coverage collect 'dotnet test "./src/WebEngine.Test" --filter TestCategory!=Mobile' -f xml -o 'coverage.xml' | |
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" | |
#Do not run dotnet pack because the project is already configured to generate nupkg during build. | |
#- name: Dotnet Pack | |
# run: dotnet pack "./src" --no-restore --no-build -p:PackageVersion=1.0.${{github.run_number}} -o "./nuget" | |
- name: Copy package to artifact folder | |
shell: powershell | |
run: | | |
mkdir "nuget" | |
Get-ChildItem ./src -Recurse -File -Filter Axa*.nupkg | % {Copy-Item -Path $_.FullName -Destination "./nuget/$_"} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifact | |
path: "./nuget" |