Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows #62
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 ] | |
pull_request: | |
release: | |
types: [ published ] | |
env: | |
# Disable the .NET logo in the console output. | |
DOTNET_NOLOGO: true | |
# Disable the .NET first time experience to skip caching NuGet packages and speed up the build. | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
# Disable sending .NET CLI telemetry to Microsoft. | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
BUILD_ARTIFACT_PATH: ${{github.workspace}}/build-artifacts | |
jobs: | |
build: | |
name: Build ${{matrix.os}} | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macOS-latest] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup dotnet (3.1 / 6.0) | |
uses: actions/setup-dotnet@v1 | |
with: | |
include-prerelease: true | |
dotnet-version: | | |
3.1.x | |
6.0.x | |
7.0.x | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore -c Release | |
- name: Test with Coverage | |
shell: pwsh | |
run: | | |
$env:COMPlus_EnableAVX2 = 1 | |
$env:COMPlus_EnableSSE41 = 1 | |
$env:COMPlus_EnableSSE2 = 1 | |
Write-Host "Test Environment: Normal" -ForegroundColor "Cyan" | |
dotnet test --no-restore --logger trx --results-directory ${{env.BUILD_ARTIFACT_PATH}}/coverage --collect "XPlat Code Coverage" --settings CodeCoverage.runsettings /p:SkipBuildVersioning=true | |
$env:COMPlus_EnableAVX2 = 0 | |
$env:COMPlus_EnableSSE41 = 1 | |
$env:COMPlus_EnableSSE2 = 1 | |
Write-Host "Test Environment: AVX2 Disabled" -ForegroundColor "Cyan" | |
dotnet test --no-restore --logger trx --results-directory ${{env.BUILD_ARTIFACT_PATH}}/coverage --collect "XPlat Code Coverage" --settings CodeCoverage.runsettings --framework net6.0 /p:SkipBuildVersioning=true | |
$env:COMPlus_EnableAVX2 = 0 | |
$env:COMPlus_EnableSSE41 = 0 | |
$env:COMPlus_EnableSSE2 = 1 | |
Write-Host "Test Environment: SSE41 Disabled" -ForegroundColor "Cyan" | |
dotnet test --no-restore --logger trx --results-directory ${{env.BUILD_ARTIFACT_PATH}}/coverage --collect "XPlat Code Coverage" --settings CodeCoverage.runsettings --framework net6.0 /p:SkipBuildVersioning=true | |
$env:COMPlus_EnableAVX2 = 0 | |
$env:COMPlus_EnableSSE41 = 0 | |
$env:COMPlus_EnableSSE2 = 0 | |
Write-Host "Test Environment: SSE2 Disabled" -ForegroundColor "Cyan" | |
dotnet test --no-restore --logger trx --results-directory ${{env.BUILD_ARTIFACT_PATH}}/coverage --collect "XPlat Code Coverage" --settings CodeCoverage.runsettings --framework net6.0 /p:SkipBuildVersioning=true | |
- name: Pack | |
run: dotnet pack --no-build -c Release /p:PackageOutputPath=${{env.BUILD_ARTIFACT_PATH}} | |
- name: Publish artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{matrix.os}} | |
path: ${{env.BUILD_ARTIFACT_PATH}} | |
coverage: | |
name: Process code coverage | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Download coverage reports | |
uses: actions/[email protected] | |
- name: Install ReportGenerator tool | |
run: dotnet tool install -g dotnet-reportgenerator-globaltool | |
- name: Prepare coverage reports | |
run: reportgenerator -reports:*/coverage/*/coverage.cobertura.xml -targetdir:./ -reporttypes:Cobertura | |
- name: Upload coverage report | |
uses: codecov/[email protected] | |
with: | |
file: Cobertura.xml | |
fail_ci_if_error: false | |
- name: Save combined coverage report as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: coverage-report | |
path: Cobertura.xml | |
push-to-github-packages: | |
name: 'Push GitHub Packages' | |
needs: build | |
if: github.ref == 'refs/heads/main' || github.event_name == 'release' | |
environment: | |
name: 'GitHub Packages' | |
url: https://github.com/TurnerSoftware/RobotsExclusionTools/packages | |
permissions: | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Download build' | |
uses: actions/[email protected] | |
with: | |
name: 'ubuntu-latest' | |
- name: 'Add NuGet source' | |
run: dotnet nuget add source https://nuget.pkg.github.com/TurnerSoftware/index.json --name GitHub --username Turnerj --password ${{secrets.GITHUB_TOKEN}} --store-password-in-clear-text | |
- name: 'Upload NuGet package' | |
run: dotnet nuget push *.nupkg --api-key ${{secrets.GH_PACKAGE_REGISTRY_API_KEY}} --source GitHub --skip-duplicate | |
push-to-nuget: | |
name: 'Push NuGet Packages' | |
needs: build | |
if: github.event_name == 'release' | |
environment: | |
name: 'NuGet' | |
url: https://www.nuget.org/packages/TurnerSoftware.RobotsExclusionTools | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Download build' | |
uses: actions/[email protected] | |
with: | |
name: 'ubuntu-latest' | |
- name: 'Upload NuGet package and symbols' | |
run: dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key ${{secrets.NUGET_API_KEY}} |