Skip to content

Improve MA0155 to report async void local functions #1241

Improve MA0155 to report async void local functions

Improve MA0155 to report async void local functions #1241

Workflow file for this run

name: publish
on:
workflow_dispatch:
push:
branches:
- 'main'
paths-ignore:
- "docs/**"
- "renovate.json"
- "GenerateDocumentation.cmd"
- ".markdownlint.json"
- ".github/ISSUE_TEMPLATE/**"
- ".github/FUNDING.yml"
pull_request:
branches:
- '*'
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
NuGetDirectory: ${{ github.workspace}}/nuget
defaults:
run:
shell: pwsh
jobs:
compute_package_version:
runs-on: ubuntu-latest
outputs:
package_version: ${{ steps.compute-version.outputs.package_version }}
steps:
- id: compute-version
name: Compute version
run: |
$(Invoke-WebRequest "https://www.nuget.org/api/v2/package/Meziantou.Analyzer/").BaseResponse.RequestMessage.RequestUri -match "meziantou\.analyzer\.2\.0\.([0-9]+).nupkg$"
$NewVersion = "2.0.$([int]$Matches.1 + 1)"
if ($env:GITHUB_REF -ne 'refs/heads/main') {
$NewVersion = $NewVersion + '-build.${{ github.run_id }}'
}
Write-Host "New version: $NewVersion"
"package_version=$NewVersion" >> $env:GITHUB_OUTPUT
create_nuget:
runs-on: ubuntu-latest
needs: [ compute_package_version ]
env:
RepositoryBranch: ${{github.ref}}
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
- run: dotnet run --project src/ListDotNetTypes/ListDotNetTypes.csproj -- src/Meziantou.Analyzer/Resources/
- run: dotnet build src/Meziantou.Analyzer/Meziantou.Analyzer.csproj --configuration Release /p:RoslynVersion=roslyn3.8 /p:Version=${{ needs.compute_package_version.outputs.package_version }}
- run: dotnet build src/Meziantou.Analyzer/Meziantou.Analyzer.csproj --configuration Release /p:RoslynVersion=roslyn4.2 /p:Version=${{ needs.compute_package_version.outputs.package_version }}
- run: dotnet build src/Meziantou.Analyzer/Meziantou.Analyzer.csproj --configuration Release /p:RoslynVersion=roslyn4.4 /p:Version=${{ needs.compute_package_version.outputs.package_version }}
- run: dotnet build src/Meziantou.Analyzer/Meziantou.Analyzer.csproj --configuration Release /p:RoslynVersion=roslyn4.6 /p:Version=${{ needs.compute_package_version.outputs.package_version }}
- run: dotnet build src/Meziantou.Analyzer/Meziantou.Analyzer.csproj --configuration Release /p:RoslynVersion=roslyn4.8 /p:Version=${{ needs.compute_package_version.outputs.package_version }}
- run: dotnet build src/Meziantou.Analyzer.CodeFixers/Meziantou.Analyzer.CodeFixers.csproj --configuration Release /p:RoslynVersion=roslyn3.8 /p:Version=${{ needs.compute_package_version.outputs.package_version }}
- run: dotnet build src/Meziantou.Analyzer.CodeFixers/Meziantou.Analyzer.CodeFixers.csproj --configuration Release /p:RoslynVersion=roslyn4.2 /p:Version=${{ needs.compute_package_version.outputs.package_version }}
- run: dotnet build src/Meziantou.Analyzer.CodeFixers/Meziantou.Analyzer.CodeFixers.csproj --configuration Release /p:RoslynVersion=roslyn4.4 /p:Version=${{ needs.compute_package_version.outputs.package_version }}
- run: dotnet build src/Meziantou.Analyzer.CodeFixers/Meziantou.Analyzer.CodeFixers.csproj --configuration Release /p:RoslynVersion=roslyn4.6 /p:Version=${{ needs.compute_package_version.outputs.package_version }}
- run: dotnet build src/Meziantou.Analyzer.CodeFixers/Meziantou.Analyzer.CodeFixers.csproj --configuration Release /p:RoslynVersion=roslyn4.8 /p:Version=${{ needs.compute_package_version.outputs.package_version }}
- run: dotnet restore src/Meziantou.Analyzer.pack.csproj
- run: dotnet pack src/Meziantou.Analyzer.pack.csproj --configuration Release --no-build /p:Version=${{ needs.compute_package_version.outputs.package_version }}
- run: dotnet pack src/Meziantou.Analyzer.Annotations/Meziantou.Analyzer.Annotations.csproj --configuration Release
- uses: actions/upload-artifact@v4
with:
name: nuget
if-no-files-found: error
retention-days: 3
path: '**/*.nupkg'
validate_nuget:
runs-on: ubuntu-latest
needs: [ create_nuget ]
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core (global.json)
uses: actions/setup-dotnet@v4
- uses: actions/download-artifact@v4
with:
name: nuget
path: ${{ env.NuGetDirectory }}
- name: Run dotnet validate
run: |
dotnet tool update Meziantou.Framework.NuGetPackageValidation.Tool --global
$files = Get-ChildItem "${{ env.NuGetDirectory }}/*" -Recurse -Include *.nupkg
$Errors = $false
foreach($file in $files) {
& meziantou.validate-nuget-package "$file"
if ($LASTEXITCODE -ne 0) {
$Errors = $true
}
}
if ($Errors) {
exit 1
}
build_and_test:
runs-on: ${{ matrix.runs-on }}
env:
TestResultsDirectory: ${{ github.workspace}}/TestResults
strategy:
matrix:
runs-on: [ ubuntu-latest, windows-latest ]
configuration: [ Release ]
roslyn-version: [ 'roslyn3.8', 'roslyn4.2', 'roslyn4.4', 'roslyn4.6', 'roslyn4.8', 'default' ]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core (global.json)
uses: actions/setup-dotnet@v4
- run: dotnet test --configuration ${{ matrix.configuration }} --logger trx --logger "GitHubActions;report-warnings=false" --collect:"XPlat Code Coverage" --blame-hang --blame-hang-timeout 2min --results-directory "${{ env.TestResultsDirectory }}" /p:WarningsAsErrors=true /p:RoslynVersion=${{ matrix.roslyn-version}}
name: Run tests
- uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.runs-on }}-${{ matrix.roslyn-version }}-${{ matrix.configuration }}
if-no-files-found: error
retention-days: 3
path: ${{ env.TestResultsDirectory }}/**/*
deploy:
runs-on: 'ubuntu-latest'
needs: [ validate_nuget, build_and_test ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: actions/download-artifact@v4
with:
name: nuget
path: ${{ env.NuGetDirectory }}
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
- run: |
Write-Host "Current ref: $env:GITHUB_REF"
Write-Host "Searching nupkg in folder: ${{ env.NuGetDirectory }}"
$files = Get-ChildItem "${{ env.NuGetDirectory }}/*" -Recurse -Include *.nupkg
foreach($file in $files) {
Write-Host "Pushing NuGet package: $($file.FullName)"
if ($env:GITHUB_REF -eq 'refs/heads/main')
{
& dotnet nuget push "$($file.FullName)" --api-key "$env:NuGetApiKey" --source https://api.nuget.org/v3/index.json --force-english-output --skip-duplicate
}
else
{
& dotnet nuget push "$($file.FullName)" --api-key "$env:FeedzApiKey" --source https://f.feedz.io/meziantou/meziantou-analyzer/nuget/index.json --force-english-output --skip-duplicate
}
}
name: Publish NuGet packages
if: always()
env:
NuGetApiKey: ${{ secrets.NUGETAPIKEY }}
FeedzApiKey: ${{ secrets.FEEDZ_APIKEY }}
create_release:
runs-on: 'ubuntu-latest'
if: ${{ github.ref == 'refs/heads/main' }}
needs: [ compute_package_version, deploy ]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- run: 'gh release create "${{ needs.compute_package_version.outputs.package_version }}" --generate-notes --notes "NuGet package: <https://www.nuget.org/packages/Meziantou.Analyzer/${{ needs.compute_package_version.outputs.package_version }}>"'
env:
GH_TOKEN: ${{ github.token }}