This repository has been archived by the owner on Sep 17, 2023. It is now read-only.
Update index.md #96
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: SonarCloud | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
name: Build and analyze | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: | | |
3.1.x | |
6.0.x | |
7.0.x | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 11 | |
distribution: 'zulu' | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v3 | |
with: | |
path: ~\sonar\cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache SonarCloud scanner | |
id: cache-sonar-scanner | |
uses: actions/cache@v3 | |
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: pwsh | |
run: | | |
New-Item -Path ./.sonar/scanner -ItemType Directory | |
dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner | |
- name: Cache Spark Files | |
id: cache-spark | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-spark-files | |
with: | |
path: | | |
./spark-3.2.1-bin-hadoop2.7 | |
./Microsoft.Spark.Worker.netcoreapp3.1.linux-x64-2.1.1 | |
key: spark-3.2.1 | |
- name: Setup Spark | |
if: steps.cache-spark.outputs.cache-hit != 'true' | |
run: | | |
wget -v https://archive.apache.org/dist/spark/spark-3.2.1/spark-3.2.1-bin-hadoop2.7.tgz | |
tar -xvf spark-3.2.1-bin-hadoop2.7.tgz | |
shell: bash | |
- name: Setup Spark.NET | |
if: steps.cache-spark.outputs.cache-hit != 'true' | |
run: | | |
wget -v https://github.com/dotnet/spark/releases/download/v2.1.1/Microsoft.Spark.Worker.netcoreapp3.1.linux-x64-2.1.1.tar.gz | |
tar -xvf Microsoft.Spark.Worker.netcoreapp3.1.linux-x64-2.1.1.tar.gz | |
shell: bash | |
- name: Build and analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
declare -x DOTNET_WORKER_DIR="$(echo -n $GITHUB_WORKSPACE)/Microsoft.Spark.Worker.netcoreapp3.1.linux-x64-2.1.1/Microsoft.Spark.Worker-2.1.1" | |
declare -x HADOOP_HOME="$(echo -n $GITHUB_WORKSPACE)/spark-3.2.1-bin-hadoop2.7" | |
declare -x SPARK_HOME="$(echo -n $GITHUB_WORKSPACE)/spark-3.2.1-bin-hadoop2.7" | |
declare -x PATH="$(echo $PATH):$(echo -n $SPARK_HOME):$(echo -n $HADOOP_HOME):$(echo -n $GITHUB_WORKSPACE)/spark-3.2.1-bin-hadoop2.7/bin" | |
declare -x SPARK_DOTNET_JAR_NAME=microsoft-spark-3-2_2.12-2.1.1.jar | |
export | |
./.sonar/scanner/dotnet-sonarscanner begin \ | |
/k:"bmazzarol_TypedSpark.NET" \ | |
/o:"bmazzarol" \ | |
/d:sonar.login="${{ secrets.SONAR_TOKEN }}" \ | |
/d:sonar.host.url="https://sonarcloud.io" \ | |
/d:sonar.cs.vstest.reportsPaths=/**/TestResults/*.trx \ | |
/d:sonar.cs.opencover.reportsPaths=/**/TestResults/**/coverage.opencover.xml \ | |
/d:sonar.dotnet.excludeTestProjects=true \ | |
/d:sonar.coverage.exclusions="**Test*.cs,**/Migrations/**/*.*,**autogenerated.cs,**.g.cs" | |
dotnet test \ | |
--verbosity normal \ | |
--logger "trx;LogFileName=test-results.trx" \ | |
--collect "XPlat Code Coverage" \ | |
-r "TestResults" \ | |
-- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover | |
./.sonar/scanner/dotnet-sonarscanner end \ | |
/d:sonar.login="${{ secrets.SONAR_TOKEN }}" |