File tree Expand file tree Collapse file tree 6 files changed +69
-2
lines changed
Expand file tree Collapse file tree 6 files changed +69
-2
lines changed Original file line number Diff line number Diff line change 1+ set -e
2+
3+ dotnet tool install -g dotnet-reportgenerator-globaltool
4+
5+ dotnet restore
6+ dotnet build --no-restore
7+
8+ cd ./tests/TestDynamo.Tests.CSharp
9+ dotnet test --no-build --verbosity normal
10+
11+ cd ../TestDynamo.Tests
12+ echo " Running tests with coverage..."
13+
14+ # Print to stdout and to variable
15+ # https://stackoverflow.com/questions/12451278/capture-stdout-to-a-variable-but-still-display-it-in-the-console
16+ exec 5>&1
17+
18+ test_results=$( dotnet test --no-build --verbosity normal --collect:" XPlat Code Coverage" | tee /dev/fd/5)
19+ cd ../..
20+
21+ test_results_file=$( echo " $test_results " | grep -oP " ([^\s]).+/coverage\.cobertura\.xml(?=\s|$)" | tail -1)
22+
23+ # "grep line-rate" is a bit of a hack. The code coverage just happens
24+ # to be the first instance of line-rate="xxx" in the file
25+ # Also, not rounding results, flooring because bash cannot round
26+ code_coverage=$( cat " $test_results_file " | grep -oP " (?<=line-rate=\" 0\.)\d{1,2}" | head -1)
27+ echo " Code coverage: $code_coverage %"
28+ echo " {\" projects\" :{\" TestDynamo\" :{\" coverage\" :\" $code_coverage %\" }}}" >> " ./automatedBuildResults.json"
29+
Original file line number Diff line number Diff line change 1+ # This workflow will build a .NET project
2+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+ name : .NET
5+
6+ on :
7+ push :
8+ branches : [ "main" ]
9+ pull_request :
10+ branches : [ "main" ]
11+
12+ jobs :
13+ build :
14+
15+ runs-on : ubuntu-latest
16+
17+ steps :
18+ - uses : actions/checkout@v4
19+ with :
20+ repository : ${{ github.event.pull_request.head.repo.full_name }}
21+ ref : ${{ github.event.pull_request.head.ref }}
22+ - name : Setup .NET
23+ uses : actions/setup-dotnet@v4
24+ with :
25+ dotnet-version : 9.0.x
26+ - name : Run build script
27+ run : chmod +x ./.github/workflows/build.sh && ./.github/workflows/build.sh
28+ - name : Add & Commit
29+ uses : EndBug/add-and-commit@v9.1.4
30+ with :
31+ add : ' ./automatedBuildResults.json'
32+ message : ' Automated build results'
33+ committer_name : GitHub Actions
34+ committer_email : 41898282+github-actions[bot]@users.noreply.github.com
35+
Original file line number Diff line number Diff line change 22
33An in-memory dynamodb client for automated testing
44
5+ [ Code coverage] ( https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2FShaneGH%2FTestDynamo%2Frefs%2Fheads%2Fmain%2FbuildResults.json&query=%24.projects.TestDynamo.coverage&label=Code%20Coverage )
6+
57TestDynamo is a rewrite of dynamodb in dotnet designed for testing and debugging.
68It implements a partial feature set of ` IAmazonDynamoDb ` to manage schemas and read and write items.
79
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk" >
22
33 <PropertyGroup >
4- <TargetFramework >net9.0</ TargetFramework >
4+ <TargetFrameworks >net9.0;net8.0</ TargetFrameworks >
55 <ImplicitUsings >enable</ImplicitUsings >
66 <Nullable >enable</Nullable >
77
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ type SmokeTests(output: ITestOutputHelper) =
5151 if not DynamoDbVersion.isLatestVersion then ()
5252 else
5353 let slnRoot = slnRoot
54- use vFile = System.IO.File.OpenRead( $@" {slnRoot.FullName}\ tests\ testVersion.txt" );
54+ use vFile = System.IO.File.OpenRead( $@" {slnRoot.FullName}/ tests/ testVersion.txt" );
5555 use vData = new System.IO.StreamReader( vFile);
5656
5757 let target = Version.Parse( Regex.Replace( vData.ReadToEnd(), @" [^\d\.].*" , " " )) |> normalizeVersion;
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk" >
22
33 <PropertyGroup >
4+ <!-- target single version to make generating code coverage reports easier -->
45 <TargetFramework >net9.0</TargetFramework >
56
67 <IsPackable >false</IsPackable >
You can’t perform that action at this time.
0 commit comments