Code improvements (#2) #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: ci | |
on: | |
push: | |
tags: | |
- v* | |
branches: [main, releases/*] | |
pull_request: | |
branches: [main, feature/*, releases/*] | |
jobs: | |
build: | |
env: | |
APP: "${{ github.workspace }}/src" | |
PROJECT_TEST: "${{ github.workspace }}/src/ByReplace.Test" | |
PROJECT_SLN: "./src/ByReplace.sln" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
dotnet-version: ["8.0.*"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get Build Version 🏷️ | |
run: | | |
Import-Module .\nupkgs\GetBuildVersion.psm1 | |
Write-Host $Env:GITHUB_REF | |
$version = GetBuildVersion -VersionString $Env:GITHUB_REF | |
echo "BUILD_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
shell: pwsh | |
- name: Setup NuGet 🔧 | |
uses: NuGet/setup-nuget@v1.0.5 | |
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }} 🔧 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: ${{ matrix.dotnet-version }} | |
- name: Install dotnet-format tool 🔧 | |
run: dotnet tool install -g dotnet-format | |
- name: Clean Dependencies 📦 | |
run: dotnet clean ${{env.PROJECT_SLN }} | |
- name: Restore Dependencies 📦 | |
run: dotnet restore ${{env.PROJECT_SLN }} | |
- name: Build ⚙️ | |
run: dotnet build ${{env.PROJECT_SLN }} -c Release -p:Version=$BUILD_VERSION --no-restore | |
- name: Format ♻️ | |
run: dotnet format ${{env.APP }} -v diag --severity error --no-restore | |
- name: Test 🧪 | |
run: dotnet test ${{env.PROJECT_SLN }} --configuration Release --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover |