Merge pull request #578 from thompson-tomo/chore/#573_AddAdditionalTFM #97
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: CI | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
build: | |
name: Build | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@master | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 3.1.x | |
- name: Clean package cache as a temporary workaround for https://github.com/actions/setup-dotnet/issues/155 | |
working-directory: ./source | |
run: dotnet clean -c Release && dotnet nuget locals all --clear | |
- name: Build | |
working-directory: ./source | |
run: dotnet build -c Release | |
test: | |
name: Tests on ${{ matrix.os }} | |
needs: [build] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ macos-latest, ubuntu-latest, windows-2019 ] | |
steps: | |
- uses: actions/checkout@master | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: | | |
2.1.x | |
3.1.x | |
6.0.x | |
- name: Clean package cache as a temporary workaround for https://github.com/actions/setup-dotnet/issues/155 | |
working-directory: ./source | |
run: dotnet clean -c Release && dotnet nuget locals all --clear | |
- name: Test | |
working-directory: ./source | |
run: dotnet test --logger:trx --logger:GitHubActions | |
sonar-ci: | |
name: SonarCloud | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: | | |
2.1.x | |
3.1.x | |
6.0.x | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: '21' # The JDK version to make available on the path. | |
distribution: 'zulu' | |
- name: Clean package cache as a temporary workaround for https://github.com/actions/setup-dotnet/issues/155 | |
working-directory: ./source | |
run: dotnet clean -c Release && dotnet nuget locals all --clear | |
- 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/cache@v1 | |
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: Run tests | |
run: dotnet test source/Handlebars.sln --logger:trx --collect:"XPlat Code Coverage" --settings source/Handlebars.Test/coverlet.runsettings | |
- name: Build and analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: 22a5e1c1df52b7200ac14fc139ed1dfbe53dda4d | |
shell: powershell | |
run: | | |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"Handlebars-Net_Handlebars.Net" /o:"handlebars-net" /d:sonar.login="${{ env.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="**/*.opencover.xml" /d:sonar.cs.vstest.reportsPaths="**/*.trx" /d:sonar.coverage.exclusions="**/*.md;source/Handlebars.Benchmark/**/*.*" /d:sonar.cpd.exclusions="source/Handlebars/Iterators/**/*.*" | |
dotnet build source/Handlebars.sln -c Release | |
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ env.SONAR_TOKEN }}" | |
benchmark: | |
name: Run Benchmark.Net | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: | | |
2.1.x | |
3.1.x | |
6.0.x | |
- name: Clean package cache as a temporary workaround for https://github.com/actions/setup-dotnet/issues/155 | |
working-directory: ./source | |
run: dotnet clean -c Release && dotnet nuget locals all --clear | |
- name: Run benchmark | |
working-directory: ./source/Handlebars.Benchmark | |
run: dotnet run -c Release --exporters json --filter '*' -m --join | |
- name: Get benchmark file name | |
id: benchmarkfilename | |
working-directory: ./source/Handlebars.Benchmark/BenchmarkDotNet.Artifacts/results | |
run: | | |
filePath=$(find . -type f -name 'BenchmarkRun-joined-*-report-full-compressed.json' | rev | cut -d '/' -f1 | rev) | |
echo $filePath | |
echo "::set-output name=file::$filePath" | |
- name: Store benchmark result | |
uses: Happypig375/github-action-benchmark@v1.8.2 | |
with: | |
name: Benchmark.Net Benchmark | |
tool: 'benchmarkdotnet' | |
output-file-path: source/Handlebars.Benchmark/BenchmarkDotNet.Artifacts/results/${{ steps.benchmarkfilename.outputs.file }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
auto-push: true | |
# Show alert with commit comment on detecting possible performance regression | |
alert-threshold: '200%' | |
comment-on-alert: true | |
fail-on-alert: false | |
alert-comment-cc-users: '@zjklee' | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Benchmark | |
path: source/Handlebars.Benchmark/BenchmarkDotNet.Artifacts/results/ | |
update_release_draft: | |
name: Release Drafter | |
runs-on: ubuntu-latest | |
needs: [build, test, sonar-ci] | |
steps: | |
- uses: release-drafter/release-drafter@v5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |