Skip to content

Commit

Permalink
Hide the codecov publish task if it won't run
Browse files Browse the repository at this point in the history
Instead of showing it as a skipped task, just hide it if we won't run it because no codecov_token is provided.
  • Loading branch information
AArnott committed Aug 5, 2022
1 parent 13d3a56 commit d69d108
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:
TreatWarningsAsErrors: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
BUILDCONFIGURATION: Release
codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/
# codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages/

jobs:
Expand Down
16 changes: 8 additions & 8 deletions azure-pipelines/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ steps:
displayName: 📢 Publish artifacts
condition: succeededOrFailed()

- powershell: |
$ArtifactStagingFolder = & "azure-pipelines/Get-ArtifactsStagingDirectory.ps1"
$CoverageResultsFolder = Join-Path $ArtifactStagingFolder "coverageResults-$(Agent.JobName)"
azure-pipelines/publish-CodeCov.ps1 -CodeCovToken "$(codecov_token)" -PathToCodeCoverage "$CoverageResultsFolder" -Name "$(Agent.JobName) Coverage Results" -Flags "$(Agent.JobName)Host,$(BuildConfiguration)"
displayName: 📢 Publish code coverage results to codecov.io
condition: ne(variables['codecov_token'], '')
timeoutInMinutes: 3
continueOnError: true
- ${{ if and(ne(variables['codecov_token'], ''), parameters.RunTests) }}:
- powershell: |
$ArtifactStagingFolder = & "azure-pipelines/Get-ArtifactsStagingDirectory.ps1"
$CoverageResultsFolder = Join-Path $ArtifactStagingFolder "coverageResults-$(Agent.JobName)"
azure-pipelines/publish-CodeCov.ps1 -CodeCovToken "$(codecov_token)" -PathToCodeCoverage "$CoverageResultsFolder" -Name "$(Agent.JobName) Coverage Results" -Flags "$(Agent.JobName)Host,$(BuildConfiguration)"
displayName: 📢 Publish code coverage results to codecov.io
timeoutInMinutes: 3
continueOnError: true

0 comments on commit d69d108

Please sign in to comment.