Skip to content

Commit 60bd13c

Browse files
committed
Update build-time dependencies
1 parent a152830 commit 60bd13c

6 files changed

Lines changed: 21 additions & 30 deletions

File tree

.github/workflows/dotnetpackage.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
steps:
1717
- name: Clone
18-
uses: actions/checkout@v3.5.0
18+
uses: actions/checkout@v4
1919

2020
- name: Initialize test reporting
2121
uses: testspace-com/setup-testspace@v1
@@ -28,30 +28,32 @@ jobs:
2828
- name: Build
2929
run: dotnet build --no-restore --configuration Release --verbosity normal
3030

31+
- name: Pack
32+
run: dotnet pack ${{ env.ProjectName }} --no-build --configuration Release --verbosity normal
33+
3134
- name: Test
3235
run: |
3336
dotnet test --no-build --verbosity normal --configuration Release --collect:"XPlat Code Coverage" --settings Test/coverlet.runsettings --logger "trx;LogFileName=TestResults.xml"
3437
Out-File -InputObject "TEST_EXIT_CODE=$LASTEXITCODE" -FilePath $env:GITHUB_ENV -Append -Encoding UTF8
35-
mv Test/TestResults/*/coverage.info Test/TestResults
38+
Copy-Item Test/TestResults/*/coverage.info Test/TestResults -ErrorAction Continue
3639
exit 0
3740
3841
- name: Upload test report
3942
run: testspace Test/TestResults/TestResults.xml
4043

4144
- name: Upload coverage
42-
uses: coverallsapp/github-action@master
45+
uses: coverallsapp/github-action@v2
4346
with:
4447
github-token: ${{ secrets.GITHUB_TOKEN }}
45-
path-to-lcov: Test/TestResults/coverage.info
48+
files: Test/TestResults/coverage.info
49+
format: lcov
4650

4751
- name: Stop if tests failed
4852
run: exit $env:TEST_EXIT_CODE
4953

50-
- name: Pack
51-
run: dotnet pack ${{ env.ProjectName }} --no-build --configuration Release --verbosity normal
52-
5354
- name: Upload package
54-
uses: actions/upload-artifact@v3.1.2
55+
uses: actions/upload-artifact@v4
5556
with:
5657
name: ${{ env.ProjectName }}.nupkg
57-
path: ${{ env.ProjectName }}/bin/Release/*.*nupkg
58+
path: ${{ env.ProjectName }}/bin/Release/*.*nupkg
59+
if-no-files-found: error

Kasa/IKasaOutlet.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,20 +154,11 @@ public interface ISingleSocket: ISystemCommands {
154154
/// <inheritdoc cref="IsSocketOn" />
155155
[Obsolete($"This method was poorly named, and has been renamed to {nameof(IsSocketOn)}", false)]
156156
[EditorBrowsable(EditorBrowsableState.Never)]
157-
/*[CodeTemplate(searchTemplate: $"$this$.{nameof(IsOutletOn)}()",
158-
Message = $"This method was poorly named, and has been renamed to {nameof(IsSocketOn)}",
159-
ReplaceTemplate = $"$this$.{nameof(IsSocketOn)}()",
160-
ReplaceMessage = $"Replace deprecated method call with {nameof(IsSocketOn)}")]*/
161-
// [CodeTemplate] requires both the JETBRAINS_ANNOTATIONS compilation symbol and a dependency on the JetBrains.Annotations package, WITHOUT its PrivateAssets set to All
162157
Task<bool> IsOutletOn();
163158

164159
/// <inheritdoc cref="SetSocketOn" />
165160
[Obsolete($"This method was poorly named, and has been renamed to {nameof(SetSocketOn)}", false)]
166161
[EditorBrowsable(EditorBrowsableState.Never)]
167-
/*[CodeTemplate(searchTemplate: $"$this$.{nameof(SetOutletOn)}($args$)",
168-
Message = $"This method was poorly named, and has been renamed to {nameof(SetSocketOn)}",
169-
ReplaceTemplate = $"$this$.{nameof(SetSocketOn)}($args$)",
170-
ReplaceMessage = $"Replace deprecated method call with {nameof(SetSocketOn)}")]*/
171162
Task SetOutletOn(bool turnOn);
172163

173164
}

Kasa/Kasa.csproj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<Version>1.1.0-beta3</Version>
4+
<Version>1.1.0</Version>
55
<Title>Kasa</Title>
66
<PackageId>Kasa</PackageId>
77
<Product>Kasa</Product>
@@ -30,7 +30,6 @@
3030
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
3131
<GenerateDocumentationFile>true</GenerateDocumentationFile>
3232
<NoWarn>$(NoWarn),1701,1702</NoWarn>
33-
<!--<DefineConstants>$(DefineConstants);JETBRAINS_ANNOTATIONS</DefineConstants>--><!-- Required for [CodeTemplate] to be exposed to dependents (undocumented) -->
3433
</PropertyGroup>
3534

3635
<ItemGroup>
@@ -39,8 +38,7 @@
3938
</ItemGroup>
4039

4140
<ItemGroup>
42-
<!--<PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />--><!-- setting PrivateAssets to All breaks anything that tries to load ISystemCommands.ISingleSocket, which uses CodeTemplate -->
43-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" /><!-- Do not upgrade because version 9 bitches about targeting net6.0, and setting a max version breaks dependents with a higher version -->
41+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3" /><!-- Do not upgrade because version 9 bitches about targeting net6.0, and setting a max version breaks dependents with a higher version -->
4442
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
4543
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
4644
</ItemGroup>

Sample/Sample.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder
66
.ClearProviders()
7-
.SetMinimumLevel(LogLevel.Trace)
7+
.SetMinimumLevel(LogLevel.Trace) // control actual level in NLog.config
88
.AddNLog());
99
ILogger logger = loggerFactory.CreateLogger("Sample");
1010
Options options = new() { MaxAttempts = 1, LoggerFactory = loggerFactory };
1111

12-
using IKasaOutlet phoneCharger = new KasaOutlet("phonecharger.outlets.aldaviva.com", options);
13-
logger.LogInformation("{info}", (await phoneCharger.System.GetInfo()).ToString());
14-
bool isPhoneCharging = await phoneCharger.System.IsSocketOn();
15-
logger.LogInformation("Phone {is} charging", isPhoneCharging ? "is" : "is not");
12+
using IKasaOutlet washingMachine = new KasaOutlet("washingmachine.outlets.aldaviva.com", options);
13+
logger.LogInformation("{info}", (await washingMachine.System.GetInfo()).ToString());
14+
PowerUsage usage = await washingMachine.EnergyMeter.GetInstantaneousPowerUsage();
15+
logger.LogInformation("Washing machine is currently drawing {a:N1} amps, {w:N1} watts", usage.Current / 1000.0, usage.Power / 1000.0);
1616

1717
using IMultiSocketKasaOutlet ep40 = new MultiSocketKasaOutlet("192.168.1.189", options);
1818
SystemInfo systemInfo = await ep40.System.GetInfo();

Sample/Sample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<ItemGroup>
1313
<PackageReference Include="Microsoft.Extensions.Logging" Version="[8.0.1,9.0.0)" />
14-
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.15" />
14+
<PackageReference Include="NLog.Extensions.Logging" Version="5.4.0" />
1515
</ItemGroup>
1616

1717
<ItemGroup>

Test/Test.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
<PackageReference Include="FakeItEasy" Version="8.3.0" />
1414
<PackageReference Include="FluentAssertions" Version="[7.1.0,8.0.0)" />
1515
<PackageReference Include="Microsoft.Extensions.Logging" Version="[8.0.1,9.0.0)" />
16-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
16+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
1717
<PackageReference Include="xunit" Version="2.9.3" />
18-
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1">
18+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
1919
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2020
<PrivateAssets>all</PrivateAssets>
2121
</PackageReference>

0 commit comments

Comments
 (0)