-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Improve CI-Pipeline. Add more unit tests. Remove integration tests. * Fixed ci * Fix thread issues * Fix ci pipeline * Fix pipeline * Fix pipeline * Fix filename * Remove warnings * Update coverage to allow gradual improvement. * Remove warnings * Fix encoding
- Loading branch information
Showing
30 changed files
with
1,021 additions
and
604 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Auto approve | ||
|
||
on: | ||
pull_request_target | ||
|
||
jobs: | ||
auto-approve: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: hmarr/auto-approve-action@v2 | ||
if: github.actor == 'Gitii' | ||
with: | ||
github-token: "${{ secrets.GITHUB_TOKEN }}" |
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ on: | |
- main | ||
|
||
jobs: | ||
build: | ||
test: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout | ||
|
@@ -30,3 +30,40 @@ jobs: | |
run: dotnet build --configuration Release | ||
- name: Test | ||
run: dotnet test --configuration Release --no-build --filter TestCategory!=Integration | ||
- name: Generate coverage | ||
run: ./generate-coverage.cmd | ||
- name: Upload code coverage results | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: code-coverage-report | ||
path: CoverageResults | ||
|
||
verify: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Download code coverage resilts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: code-coverage-report | ||
path: CoverageResults | ||
- name: Code Coverage Summary Report | ||
uses: irongut/[email protected] | ||
with: | ||
filename: CoverageResults/coverage.cobertura.xml | ||
badge: true | ||
fail_below_min: true | ||
format: markdown | ||
hide_branch_rate: false | ||
hide_complexity: true | ||
indicators: true | ||
output: both | ||
thresholds: '53 44' | ||
- name: Add Coverage PR Comment | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
if: github.event_name == 'pull_request' | ||
with: | ||
recreate: true | ||
path: code-coverage-results.md |
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,45 @@ | ||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.IO; | ||
using System.Threading; | ||
|
||
namespace Community.Wsl.Sdk.Tests; | ||
|
||
[ExcludeFromCodeCoverage] | ||
public class BlockingReadOnlyStream : Stream | ||
{ | ||
public override void Flush() { } | ||
|
||
public override int Read(byte[] buffer, int offset, int count) | ||
{ | ||
Thread.Sleep(5000); | ||
return 0; | ||
} | ||
|
||
public override long Seek(long offset, SeekOrigin origin) | ||
{ | ||
throw new Exception(); | ||
} | ||
|
||
public override void SetLength(long value) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override void Write(byte[] buffer, int offset, int count) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override bool CanRead { get; } = true; | ||
public override bool CanSeek { get; } = false; | ||
public override bool CanWrite { get; } = false; | ||
|
||
public override long Length => throw new Exception(); | ||
|
||
public override long Position | ||
{ | ||
get { throw new Exception(); } | ||
set { throw new Exception(); } | ||
} | ||
} |
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,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using FluentAssertions; | ||
using NUnit.Framework; | ||
|
||
namespace Community.Wsl.Sdk.Tests; | ||
|
||
public class CommandExecutionOptionsTests | ||
{ | ||
[Test] | ||
public void Constructor_ShouldEqualKnownValuesTests() | ||
{ | ||
var ceo = new CommandExecutionOptions() | ||
{ | ||
FailOnNegativeExitCode = true, | ||
StdErrDataProcessingMode = DataProcessingMode.External, | ||
StdInDataProcessingMode = DataProcessingMode.Binary, | ||
StdoutDataProcessingMode = DataProcessingMode.String, | ||
StderrEncoding = Encoding.ASCII, | ||
StdinEncoding = Encoding.Default, | ||
StdoutEncoding = Encoding.Latin1 | ||
}; | ||
|
||
ceo.FailOnNegativeExitCode.Should().BeTrue(); | ||
ceo.StdErrDataProcessingMode.Should().Be(DataProcessingMode.External); | ||
ceo.StdInDataProcessingMode.Should().Be(DataProcessingMode.Binary); | ||
ceo.StdoutDataProcessingMode.Should().Be(DataProcessingMode.String); | ||
ceo.StderrEncoding.Should().BeSameAs(Encoding.ASCII); | ||
ceo.StdinEncoding.Should().BeSameAs(Encoding.Default); | ||
ceo.StdoutEncoding.Should().BeSameAs(Encoding.Latin1); | ||
} | ||
} |
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,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using FluentAssertions; | ||
using NUnit.Framework; | ||
|
||
namespace Community.Wsl.Sdk.Tests; | ||
|
||
public class CommandResultTests | ||
{ | ||
[Test] | ||
public void Constructor_ShouldEqualKnownValuesTests() | ||
{ | ||
var cr = new CommandResult() | ||
{ | ||
ExitCode = 0, | ||
Stderr = "a", | ||
StderrData = new byte[] { 1 }, | ||
Stdout = "b", | ||
StdoutData = new byte[] { 2 } | ||
}; | ||
|
||
cr.ExitCode.Should().Be(0); | ||
cr.Stderr.Should().Be("a"); | ||
cr.StderrData.Should().Equal(1); | ||
cr.Stdout.Should().Be("b"); | ||
cr.StdoutData.Should().Equal(2); | ||
} | ||
} |
Oops, something went wrong.