Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add macos, linux in ci #513

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
22 changes: 19 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,28 @@ on:

jobs:
build:
runs-on: windows-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@main
- name: Setup .NET
uses: actions/setup-dotnet@main
with:
global-json-file: ./global.json
- name: dotnet test
run: dotnet test ./src/nunit.analyzers.tests/

- name: .NET6.0 Test
run: |
dotnet tool install --global dotnet-coverage
dotnet test --collect:"XPlat Code Coverage" -f net6.0 ./src/nunit.analyzers.tests/
dotnet-coverage merge -o merged.cobertura.xml -f cobertura -r coverage.cobertura.xml
Comment on lines +24 to +26
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need for the coverlet nuget package. Dotnet can output cobertura natively..
You can call it like: dotnet test --collect:"Code Coverage;Format=Cobertura"


- name: .NET Framework Test
if: runner.os == 'Windows'
run: |
dotnet test -f net462 ./src/nunit.analyzers.tests/

- name: Post Coverage
uses: k1LoW/octocov-action@v0
if: runner.os == 'Linux'
Comment on lines +33 to +35
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs align with the nunit/nunit#4286 to use coverlet.

21 changes: 21 additions & 0 deletions .octocov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
coverage:
paths:
- merged.covertura.xml

codeToTestRatio:
code: # files to count as "Code"
- 'src/nunit.analyzers/**/*.cs'
test: # files to count as "Test"
- 'src/nunit.analyzers.tests/**/*.cs'

comment:
if: is_pull_request

report:
if: is_default_branch
datastores:
- artifact://${GITHUB_REPOSITORY}

diff:
datastores:
- artifact://${GITHUB_REPOSITORY}
Comment on lines +1 to +21
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs align with the nunit changes to use coverlet.

7 changes: 5 additions & 2 deletions src/nunit.analyzers.tests/nunit.analyzers.tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Comment on lines +8 to +11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary anymore.

<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.1.0" />
</ItemGroup>

Expand All @@ -17,8 +21,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\nunit.analyzers\nunit.analyzers.csproj"
OutputItemType="Analyzer" />
<ProjectReference Include="..\nunit.analyzers\nunit.analyzers.csproj" OutputItemType="Analyzer" />
</ItemGroup>

</Project>