add deep inheritance chain for tests analyzer #117
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
on: | |
push: | |
paths-ignore: | |
- "**/*.md" | |
pull_request: | |
jobs: | |
test: | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
global-json-file: global.json | |
- name: Install dependencies | |
run: dotnet restore ./nunit-extensions.sln --verbosity minimal && dotnet tool restore | |
- name: Build | |
run: dotnet build --configuration Release ./nunit-extensions.sln | |
- name: Check codestyle | |
run: dotnet jb cleanupcode nunit-extensions.sln --profile=CatalogueCleanup --verbosity=WARN && git diff --exit-code | |
- name: Run tests | |
run: dotnet test --no-build --configuration Release ./NUnit.Extensions.Tests/NUnit.Extensions.Tests.csproj | |
publish: | |
runs-on: windows-2019 | |
needs: test | |
if: github.ref_type == 'tag' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
global-json-file: global.json | |
- name: Check version | |
run: | | |
$ErrorActionPreference = "Stop" | |
$tagName = "${{ github.ref_name }}" | |
$regex = "^(?<name>((\w+)\.)*\w+)\@(?<version>(\d+\.\d+\.\d+)(?:-.+)?)$" | |
$match = [Regex]::Match($tagName, $regex).Groups | |
$packageName = $match["name"].Value | |
$version = $match["version"].Value | |
if ([string]::IsNullOrWhitespace($packageName) -or [string]::IsNullOrWhitespace($version)) | |
{ | |
Write-Error "Cannot parse invalid tag $tagName" | |
} | |
$pre = $version.Contains("-") | |
$release = if ($pre) { "prerelease" } else { "release" } | |
Write-Host "Will create $release for package $packageName ($version)" -ForegroundColor "Green" | |
echo "RELEASE_NOTE=https://github.com/skbkontur/nunit-extensions/releases/tag/$tagName" >> $env:GITHUB_ENV | |
echo "PACKAGE_NAME=$packageName" >> $env:GITHUB_ENV | |
echo "VERSION=$version" >> $env:GITHUB_ENV | |
echo "PRE=$pre" >> $env:GITHUB_ENV | |
- name: Pack dotnet | |
run: dotnet pack --configuration Release ./$env:PACKAGE_NAME/$env:PACKAGE_NAME.csproj -p:Version=$env:VERSION -p:PackageReleaseNotes=$env:RELEASE_NOTE | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
path: "**/*.nupkg" | |
if-no-files-found: error | |
- name: Publish NuGet | |
run: dotnet nuget push "**/*.nupkg" --source https://api.nuget.org/v3/index.json --no-symbols --api-key $env:NUGET_API_KEY | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
fail_on_unmatched_files: true | |
draft: false | |
prerelease: ${{ env.PRE == 'True' }} | |
files: "**/*.nupkg" |