Workflow file for this run
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: Continuous Integration | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
pull_request: | |
types: [ opened, edited, synchronize ] | |
branches: | |
- '**' | |
env: | |
BUILD_CONFIGURATION: Debug | |
jobs: | |
build: | |
name: Build | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@main | |
with: | |
fetch-depth: 0 | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@main | |
with: | |
msbuild-architecture: x64 | |
- name: Setup .NET 6 | |
uses: actions/setup-dotnet@main | |
with: | |
dotnet-version: 6.x | |
- name: Setup .NET 7 | |
uses: actions/setup-dotnet@main | |
with: | |
dotnet-version: 7.0.306 # TEMP FIX: SDK 7.0.400 broke the Android builds | |
- name: Setup .NET workload Android | |
run: dotnet workload install android | |
- name: Setup JDK 17 | |
uses: actions/setup-java@main | |
with: | |
java-version: 17 | |
java-package: jdk | |
distribution: 'zulu' | |
- name: Restore | |
run: dotnet restore src/PDFtoImage.sln | |
- name: Build | |
run: msbuild src/PDFtoImage.sln /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:VersionSuffix=ci /p:RestorePackages=false | |
- name: Pack | |
run: msbuild src/PDFtoImage/PDFtoImage.csproj /t:pack /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:VersionSuffix=ci /p:RestorePackages=false | |
- name: Publish libraries | |
uses: actions/upload-artifact@main | |
with: | |
name: Library assemblies | |
path: | | |
src/PDFtoImage/bin/${{env.BUILD_CONFIGURATION}} | |
!**/*.nupkg | |
!**/*.snupkg | |
if-no-files-found: error | |
- name: Publish tests | |
uses: actions/upload-artifact@main | |
with: | |
name: Test assemblies | |
path: src/Tests/bin/${{env.BUILD_CONFIGURATION}} | |
if-no-files-found: error | |
- name: Publish NuGet packages | |
uses: actions/upload-artifact@main | |
with: | |
name: NuGet packages | |
path: | | |
src/PDFtoImage/bin/${{env.BUILD_CONFIGURATION}}/*.nupkg | |
src/PDFtoImage/bin/${{env.BUILD_CONFIGURATION}}/*.snupkg | |
if-no-files-found: error | |
test: | |
name: Test (${{ matrix.os }}) | |
needs: build | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Setup .NET 6 | |
uses: actions/setup-dotnet@main | |
with: | |
dotnet-version: 6.x | |
- name: Setup .NET 7 | |
uses: actions/setup-dotnet@main | |
with: | |
dotnet-version: 7.x | |
- name: Download test assemblies | |
uses: actions/download-artifact@main | |
with: | |
name: Test assemblies | |
- name: .NET Framework 4.6.2 | |
if: runner.os == 'Windows' | |
run: dotnet test net462/*.Tests.dll --logger trx | |
- name: .NET Framework 4.8.1 | |
if: runner.os == 'Windows' | |
run: dotnet test net481/*.Tests.dll --logger trx | |
- name: .NET 6 | |
run: dotnet test net6.0/*.Tests.dll --logger trx | |
- name: .NET 7 | |
run: dotnet test net7.0/*.Tests.dll --logger trx | |
- name: Publish test results | |
uses: EnricoMi/publish-unit-test-result-action/composite@master | |
if: always() | |
with: | |
files: /**/*.trx | |
check_name: Test results (${{ matrix.os }}) | |
sonarcloud: | |
name: SonarCloud | |
needs: build | |
runs-on: windows-latest | |
if: github.repository == 'sungaila/PDFtoImage' | |
steps: | |
- uses: actions/checkout@main | |
with: | |
fetch-depth: 0 | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@main | |
with: | |
msbuild-architecture: x64 | |
- name: Setup .NET 6 | |
uses: actions/setup-dotnet@main | |
with: | |
dotnet-version: 6.x | |
- name: Setup .NET 7 | |
uses: actions/setup-dotnet@main | |
with: | |
dotnet-version: 7.0.306 # TEMP FIX: SDK 7.0.400 broke the Android builds | |
- name: Setup .NET workload Android | |
run: dotnet workload install android | |
- name: Setup JDK 17 | |
uses: actions/setup-java@main | |
with: | |
java-version: 17 | |
java-package: jdk | |
distribution: 'zulu' | |
- 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: powershell | |
run: | | |
New-Item -Path .\.sonar\scanner -ItemType Directory | |
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner | |
- name: 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:"sungaila_PDFtoImage" /o:"sungaila" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml | |
dotnet restore src/PDFtoImage.sln | |
msbuild src/PDFtoImage.sln /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:RestorePackages=false | |
dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml" | |
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" |