Skip to content

ci: Add linter

ci: Add linter #143

Workflow file for this run

name: ci
on:
push:
branches: [release, alpha, beta, next-major, 'release-[0-9]+.x.x', master, main]
pull_request:
branches:
- '**'
paths-ignore:
- '**/**.md'
jobs:
lint:
name: Lint
runs-on: windows-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0'
- name: Install dependencies
run: dotnet restore
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: |
~/.nuget/packages
~/.local/share/NuGet/Cache
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Run linting
run: dotnet build --no-restore --configuration Release /warnaserror
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
- name: Save linting logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: stylecop-lint-log
path: lint-output.log
check-dotnet:
strategy:
matrix:
DOTNET_VERSION: ['6.0', '7.0', '8.0', '9.0']
fail-fast: false
name: .NET ${{ matrix.DOTNET_VERSION }}
runs-on: windows-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: |
~/.nuget/packages
~/.local/share/NuGet/Cache
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore NuGet packages
run: nuget restore Parse.sln
- name: Install Chocolatey packages
uses: crazy-max/ghaction-chocolatey@v1
with:
args: 'install opencover.portable codecov -y'
- name: Build
run: dotnet build Parse.sln --configuration Debug --no-restore /p:DebugType=full /p:GenerateFullPaths=true /p:CollectCoverage=false
- name: Run tests with coverage
run: |
OpenCover.Console.exe -returntargetcode -target:dotnet.exe -targetargs:"test --framework net${{ matrix.DOTNET_VERSION }} --configuration Debug --test-adapter-path:. --logger:console /p:DebugType=full .\Parse.Tests\Parse.Tests.csproj" -filter:"+[Parse*]* -[Parse.Tests*]*" -oldstyle -output:parse_sdk_dotnet_coverage.xml -register:user
- name: Upload code coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
# - name: Upload artifacts
# if: always()
# uses: actions/upload-artifact@v2
# with:
# name: Parse NuGet Package
# path: '**/*.nupkg'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true