Skip to content

Use GHATL for test reports #21

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

Merged
merged 4 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions .github/workflows/relase.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release to NuGet

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0

- name: Setup dotnet
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # v3.0.3

- name: Build
run: dotnet build --configuration Release

- name: Test
run: >
dotnet test
--no-build
--framework net462
--configuration Release
--logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true"
--
RunConfiguration.CollectSourceInformation=true

- name: Pack nugets
run: >
dotnet pack
--configuration Release
--no-build
--output .

- name: Push to NuGet
run: >
dotnet nuget push *.nupkg
--source https://api.nuget.org/v3/index.json
--api-key ${{secrets.nuget_api_key}}
74 changes: 47 additions & 27 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ jobs:
clean_name: ${{steps.clean_branch_name.outputs.CLEAN_BRANCH_NAME}}

steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0

- name: Setup dotnet
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a #v3.0.3
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # v3.0.3
# with:
# dotnet-version: ${{ matrix.dotnet-version }}

# You can test your matrix by printing the current dotnet version
- name: Display dotnet version
run: dotnet --version
Expand All @@ -35,36 +38,43 @@ jobs:
run: dotnet restore --locked-mode

- name: Build
run: dotnet build -f net6.0 --verbosity minimal --no-restore
run: >
dotnet build
--no-restore
--framework net6.0
--configuration Release
--verbosity minimal

- name: Check Format
run: dotnet format --verify-no-changes --no-restore

- name: Test with the dotnet CLI
run: dotnet test --no-build --no-restore --framework net6.0 --logger "trx;LogFileName=pw-test-results.trx"
run: >
dotnet test
--no-build
--no-restore
--framework net6.0
--configuration Release
--logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true"
--
RunConfiguration.CollectSourceInformation=true

- id: clean_branch_name
name: Clean Branch Name
run: echo "CLEAN_BRANCH_NAME=${BRANCH_NAME/\//-}" >> "$GITHUB_OUTPUT"
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

- name: Report test results
uses: dorny/test-reporter@c9b3d0e2bd2a4e96aaf424dbaa31c46b42318226 # v1.6.0
if: always()
with:
name: Test Results
path: "**/*-test-results.trx"
reporter: dotnet-trx
fail-on-error: true

build-framework:
runs-on: windows-latest
needs: build-dotnet
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0

# - name: Setup dotnet
# uses: setup msbuild?

- name: Display dotnet version
run: |
dotnet --version
Expand All @@ -75,29 +85,39 @@ jobs:

- name: Build
# Don't specify a framework here so we build both .NET and .NET Framework so we can pack both
run: dotnet build --verbosity minimal --no-restore
run: >
dotnet build
--no-restore
--configuration Release
--verbosity minimal

# Don't bother running formatting for this build

- name: Test with the dotnet CLI
# We will have already ran the tests on ubuntu, so only do .NET Framework ones here
run: dotnet test --no-build --no-restore --framework net462 --logger "trx;LogFileName=pw-framework-test-results.trx"

- name: Report test results
uses: dorny/test-reporter@c9b3d0e2bd2a4e96aaf424dbaa31c46b42318226 # v1.6.0
if: always()
with:
name: Test Results
path: "**/*-test-results.trx"
reporter: dotnet-trx
fail-on-error: true
run: >
dotnet test
--no-build
--no-restore
--framework net462
--configuration Release
--logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true"
--
RunConfiguration.CollectSourceInformation=true

- name: Pack NuGet Packages
run: dotnet pack --no-build --version-suffix "ci-${{ env.CLEAN_BRANCH_NAME }}-${{ github.run_id }}"
run: >
dotnet pack
--no-build
--configuration Release
--version-suffix "ci-${{ env.CLEAN_BRANCH_NAME }}-${{ github.run_id }}"
env:
CLEAN_BRANCH_NAME: ${{needs.build-dotnet.outputs.clean_name}}

- name: Publish NuGet Packages
run: dotnet nuget push **/*.nupkg --source https://nuget.pkg.github.com/passwordless/index.json --api-key ${{env.GITHUB_TOKEN}}
run: >
dotnet nuget push **/*.nupkg
--source https://nuget.pkg.github.com/passwordless/index.json
--api-key ${{env.GITHUB_TOKEN}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 3 additions & 8 deletions tests/Sdk.Tests/Sdk.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" PrivateAssets="all" />
<PackageReference Include="coverlet.collector" Version="3.2.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down