-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #697 from bUnit-dev/release/v1.7
Release of new minor version v1.7
- Loading branch information
Showing
52 changed files
with
803 additions
and
180 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: Verification against .NET 7 nightly failed | ||
labels: input needed | ||
--- | ||
|
||
The nightly build failed against the nightly .NET 7 SDK. Please investigate. | ||
|
||
## Additional information | ||
|
||
`dotnet --version`: `{{env.DOTNET_VERSION}}` |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,15 +28,20 @@ jobs: | |
- name: ⚙️ Setup GIT versioning | ||
uses: dotnet/[email protected] | ||
|
||
- name: ⚙️ Setup dotnet 5.0.x | ||
uses: actions/setup-dotnet@v1 | ||
- name: ⚙️ Setup dotnet versions | ||
uses: actions/setup-dotnet@v2 | ||
with: | ||
dotnet-version: '5.0.x' | ||
|
||
- name: ⚙️ Setup dotnet 6.0.x | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 6.0.x | ||
dotnet-version: | | ||
3.1.x | ||
5.0.x | ||
6.0.x | ||
7.0.x | ||
include-prerelease: true | ||
|
||
- name: 🎨 Setup color | ||
run: | | ||
echo "DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION=1" >> $GITHUB_ENV | ||
echo "TERM=xterm" >> $GITHUB_ENV | ||
- name: 🛠️ Update tokens in project files | ||
uses: cschleiden/replace-tokens@v1 | ||
|
@@ -50,8 +55,8 @@ jobs: | |
dotnet pack src/bunit.template/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true -p:publicrelease=true | ||
- name: 🛠️ Upload library to GitHub Package Repository | ||
run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/*.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/bunit-dev/index.json --skip-duplicate --no-symbols true | ||
run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/*.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/bunit-dev/index.json --skip-duplicate --no-symbols | ||
|
||
- name: 🛠️ Upload library to NuGet.org repository | ||
if: github.event.inputs.nugetRelease == 'true' | ||
run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols true | ||
run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,15 +59,15 @@ jobs: | |
with: | ||
setAllVars: true | ||
|
||
- name: ⚙️ Setup dotnet 5.0.x | ||
uses: actions/setup-dotnet@v1 | ||
- name: ⚙️ Setup dotnet versions | ||
uses: actions/setup-dotnet@v2 | ||
with: | ||
dotnet-version: '5.0.x' | ||
|
||
- name: ⚙️ Setup dotnet 6.0.x | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 6.0.x | ||
dotnet-version: | | ||
3.1.x | ||
5.0.x | ||
6.0.x | ||
7.0.x | ||
include-prerelease: true | ||
|
||
- name: 🛠️ Update changelog | ||
uses: thomaseizinger/[email protected] | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: verification-dotnet-nightly | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
verify-bunit: | ||
name: 👌 Verify bUnit | ||
runs-on: ubuntu-latest | ||
container: | ||
image: mcr.microsoft.com/dotnet/nightly/sdk:7.0 | ||
|
||
steps: | ||
- name: 🌛 Show dotnet version | ||
run: | | ||
dotnet --info | ||
- name: 🛒 Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: 🎨 Setup color | ||
run: | | ||
echo "DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION=1" >> $GITHUB_ENV | ||
echo "TERM=xterm" >> $GITHUB_ENV | ||
- name: 📦 Setup nuget nightly builds | ||
run: | | ||
dotnet restore --verbosity normal -s https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json -s https://api.nuget.org/v3/index.json | ||
- name: 🧪 Run unit tests | ||
run: | | ||
dotnet test ./tests/bunit.core.tests/bunit.core.tests.csproj -c release --no-restore -f net7.0 --logger:"console;verbosity=normal" --blame-hang --blame-hang-timeout 1m --blame-hang-dump-type none | ||
dotnet test ./tests/bunit.web.tests/bunit.web.tests.csproj -c release --no-restore -f net7.0 --logger:"console;verbosity=normal" --blame-hang --blame-hang-timeout 1m --blame-hang-dump-type none | ||
dotnet test ./tests/bunit.web.testcomponents.tests/bunit.web.testcomponents.tests.csproj -c release --no-restore -f net7.0 --logger:"console;verbosity=normal" --blame-hang --blame-hang-timeout 1m --blame-hang-dump-type none | ||
- name: 🧾 Collect dotnet information | ||
if: failure() | ||
run: | | ||
echo "DOTNET_VERSION=$(dotnet --version)" >> $GITHUB_ENV | ||
echo $DOTNET_VERSION | ||
- name: ⚡ Create issue if failed | ||
if: failure() | ||
uses: JasonEtco/create-an-issue@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
ADJECTIVE: DOTNET_VERSION | ||
with: | ||
filename: .github/nightly-failed.md | ||
update_existing: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,20 +31,20 @@ jobs: | |
with: | ||
fetch-depth: 0 | ||
|
||
- name: ⚙️ Setup dotnet 3.1.x | ||
uses: actions/setup-dotnet@v1 | ||
- name: ⚙️ Setup dotnet versions | ||
uses: actions/setup-dotnet@v2 | ||
with: | ||
dotnet-version: '3.1.x' | ||
|
||
- name: ⚙️ Setup dotnet 5.0.x | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: '5.0.x' | ||
|
||
- name: ⚙️ Setup dotnet 6.0.x | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 6.0.x | ||
dotnet-version: | | ||
3.1.x | ||
5.0.x | ||
6.0.x | ||
7.0.x | ||
include-prerelease: true | ||
|
||
- name: 🎨 Setup color | ||
run: | | ||
echo "DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION=1" >> $GITHUB_ENV | ||
echo "TERM=xterm" >> $GITHUB_ENV | ||
- name: ⚙️ Setup GIT versioning | ||
uses: dotnet/[email protected] | ||
|
@@ -63,9 +63,9 @@ jobs: | |
|
||
- name: 🧪 Run unit tests | ||
run: | | ||
dotnet test ./tests/bunit.core.tests/bunit.core.tests.csproj -c release --logger GitHubActions --blame-hang --blame-hang-timeout 1m --blame-hang-dump-type none | ||
dotnet test ./tests/bunit.web.tests/bunit.web.tests.csproj -c release --logger GitHubActions --blame-hang --blame-hang-timeout 1m --blame-hang-dump-type none | ||
dotnet test ./tests/bunit.web.testcomponents.tests/bunit.web.testcomponents.tests.csproj -c release --logger GitHubActions --blame-hang --blame-hang-timeout 1m --blame-hang-dump-type none | ||
dotnet test ./tests/bunit.core.tests/bunit.core.tests.csproj -c release --logger:"console;verbosity=normal" --blame-hang --blame-hang-timeout 1m --blame-hang-dump-type none | ||
dotnet test ./tests/bunit.web.tests/bunit.web.tests.csproj -c release --logger:"console;verbosity=normal" --blame-hang --blame-hang-timeout 1m --blame-hang-dump-type none | ||
dotnet test ./tests/bunit.web.testcomponents.tests/bunit.web.testcomponents.tests.csproj -c release --logger:"console;verbosity=normal" --blame-hang --blame-hang-timeout 1m --blame-hang-dump-type none | ||
- name: 🗳️ Pack library | ||
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@using Microsoft.AspNetCore.Components.Routing | ||
@implements IDisposable | ||
@inject NavigationManager NavigationManager | ||
@code { | ||
[Parameter] public Action<string> LocationChangedCallback { get; set; } | ||
|
||
protected override void OnInitialized() | ||
{ | ||
NavigationManager.LocationChanged += OnLocationChanged; | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
NavigationManager.LocationChanged -= OnLocationChanged; | ||
} | ||
|
||
private void OnLocationChanged(object sender, LocationChangedEventArgs e) | ||
{ | ||
LocationChangedCallback(e.Location); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
docs/samples/components/ExceptionInDisposeAsyncComponent.razor
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@implements IAsyncDisposable | ||
@code { | ||
public async ValueTask DisposeAsync() | ||
{ | ||
await Task.Delay(10); | ||
throw new NotSupportedException(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@implements IDisposable | ||
@code { | ||
public void Dispose() | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using Microsoft.AspNetCore.Components; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Xunit; | ||
|
||
namespace Bunit.Docs.Samples; | ||
|
||
public class DisposeComponentsTest | ||
{ | ||
[Fact] | ||
public void DisposeElements() | ||
{ | ||
using var ctx = new TestContext(); | ||
var calledTimes = 0; | ||
var cut = ctx.RenderComponent<DisposableComponent>(parameters => parameters | ||
.Add(p => p.LocationChangedCallback, url => calledTimes++) | ||
); | ||
|
||
ctx.DisposeComponents(); | ||
|
||
ctx.Services.GetRequiredService<NavigationManager>().NavigateTo("newurl"); | ||
|
||
Assert.Equal(0, calledTimes); | ||
} | ||
|
||
[Fact] | ||
public void ShouldCatchExceptionInDispose() | ||
{ | ||
using var ctx = new TestContext(); | ||
ctx.RenderComponent<ExceptionInDisposeComponent>(); | ||
|
||
var act = ctx.DisposeComponents; | ||
|
||
Assert.Throws<NotSupportedException>(act); | ||
} | ||
|
||
#if NET5_0_OR_GREATER | ||
[Fact] | ||
public void ShouldCatchExceptionInDisposeAsync() | ||
{ | ||
using var ctx = new TestContext(); | ||
ctx.RenderComponent<ExceptionInDisposeAsyncComponent>(); | ||
|
||
ctx.DisposeComponents(); | ||
var exception = ctx.Renderer.UnhandledException.Result; | ||
Assert.IsType<NotSupportedException>(exception); | ||
} | ||
#endif | ||
} |
Oops, something went wrong.