Skip to content

Commit

Permalink
Merge 2d36a13 into 6b42d11
Browse files Browse the repository at this point in the history
  • Loading branch information
helto4real committed Jul 5, 2021
2 parents 6b42d11 + 2d36a13 commit 7e7f431
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 32 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/ci_analyze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#### Build and tests all pushes, also code coverage
name: 🛠️ CI build check
on:
push:
branches:
- main
- dev
jobs:
analyze:
name: 🔍 Analyze sources (CI)
environment: CI - analyze environment
runs-on: ubuntu-latest
steps:
- name: 📤 Checkout the repository
uses: actions/checkout@main
with:
# Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0
- name: 🔍 Analyze code
uses: highbyte/sonarscan-dotnet@v2.1-beta
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
sonarOrganization: net-daemon
sonarProjectKey: net-daemon_netdaemon
sonarProjectName: netdaemon

dotnetTestArguments: --logger trx /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
sonarBeginArguments: >-
/d:sonar.inclusions="**/src/**"
/d:sonar.test.inclusions="**/tests/**"
/d:sonar.cs.xunit.reportsPaths="**/tests/**/TestResults/*.trx"
/d:sonar.cs.opencover.reportsPaths="**/tests/**/coverage.opencover.xml"
35 changes: 7 additions & 28 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: echo "::add-matcher::.github/matchers/dotnet.json"

- name: 🛠️ Build code
run: dotnet build
run: dotnet build /warnaserror

- name: 👀 Test code
run: dotnet test -v minimal /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=${{github.workspace}}/codecover/lcov.info
Expand All @@ -36,31 +36,10 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{github.workspace}}/codecover/lcov.info

analyze:
name: 🔍 Analyze sources (CI)
environment: CI - analyze environment
runs-on: ubuntu-latest
steps:
- name: 📤 Checkout the repository
uses: actions/checkout@main
with:
# Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0

- name: 🔍 Analyze code
uses: highbyte/sonarscan-dotnet@v2.1-beta
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: 📨 Publish coverage to codecov
uses: codecov/codecov-action@v1
with:
sonarOrganization: net-daemon
sonarProjectKey: net-daemon_netdaemon
sonarProjectName: netdaemon

dotnetTestArguments: --logger trx /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
sonarBeginArguments: >-
/d:sonar.inclusions="**/src/**"
/d:sonar.test.inclusions="**/tests/**"
/d:sonar.cs.xunit.reportsPaths="**/tests/**/TestResults/*.trx"
/d:sonar.cs.opencover.reportsPaths="**/tests/**/coverage.opencover.xml"
flags: unittests # optional
name: codecov-umbrella # optional
fail_ci_if_error: true # optional (default = false)
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public async Task RefreshAsync()
public void Store(HassState newState) => InternalState[newState.EntityId] = newState;

private readonly string[] _supportedDomains = {"binary_sensor", "sensor", "switch"};

public async Task<HassState?> SetStateAndWaitForResponseAsync(string entityId, string? state,
object? attributes, bool waitForResponse)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public void YamlScalarNodeToObjectUsingDecimal()
Assert.Equal((float) 1.5f, scalarValue.ToObject(typeof(float), null));
Assert.Equal((double) 1.5, scalarValue.ToObject(typeof(double), null));
}

[Fact]
public void YamlScalarNodeToObjectUsingEnum()
{
Expand Down Expand Up @@ -290,7 +290,7 @@ public void YamlAdvancedObjectsShouldReturnCorrectData()
Assert.Equal("command2", instance?.Devices?.First()?.Commands?.ElementAt(1).Name);
Assert.Equal("some code2", instance?.Devices?.First()?.Commands?.ElementAt(1).Data);
}

[Fact]
public void YamlMultilevelObjectShouldReturnCorrectData()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class MultilevelMappingConfig : Common.Reactive.NetDaemonRxApp
public class Node
{
public string? Data { get; set; }

public Node? Child { get; set; }
}
}

0 comments on commit 7e7f431

Please sign in to comment.