Skip to content

Commit 7f716c8

Browse files
authored
chore: add GitHub actions and remove Package wapproj (#13)
Adds fmt, test and build jobs using dotnet. The fmt job currently doesn't match what Rider does, but I think that will be difficult to pull off without using a different formatting tool which I don't want to investigate for now. Removes the `Package` project in favor of making the `App` project include the necessary stuff for packaging itself. We weren't getting any benefit from it being in a separate package yet and it was not building correctly in dotnet (only in VS) when they were separated. Closes #7
1 parent 7b0e421 commit 7f716c8

36 files changed

+1509
-92
lines changed

Diff for: .github/workflows/ci.yaml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
fmt:
13+
runs-on: windows-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Setup dotnet
17+
uses: actions/setup-dotnet@v4
18+
with:
19+
dotnet-version: 8.0.x
20+
cache: true
21+
cache-dependency-path: '**/packages.lock.json'
22+
- name: dotnet restore
23+
run: dotnet restore --locked-mode
24+
- name: dotnet format
25+
run: dotnet format --verify-no-changes --no-restore
26+
27+
test:
28+
runs-on: windows-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
- name: Setup dotnet
32+
uses: actions/setup-dotnet@v4
33+
with:
34+
dotnet-version: 8.0.x
35+
cache: true
36+
cache-dependency-path: '**/packages.lock.json'
37+
- name: dotnet restore
38+
run: dotnet restore --locked-mode
39+
- name: dotnet test
40+
run: dotnet test --no-restore
41+
42+
build:
43+
runs-on: windows-latest
44+
steps:
45+
- uses: actions/checkout@v4
46+
- name: Setup dotnet
47+
uses: actions/setup-dotnet@v4
48+
with:
49+
dotnet-version: 8.0.x
50+
cache: true
51+
cache-dependency-path: '**/packages.lock.json'
52+
- name: dotnet restore
53+
run: dotnet restore --locked-mode
54+
- name: dotnet publish
55+
run: dotnet publish --no-restore --configuration Release --output .\publish
56+
- name: Upload artifact
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: publish
60+
path: .\publish\

Diff for: .gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ publish/
186186
*.azurePubxml
187187
# Note: Comment the next line if you want to checkin your web deploy settings,
188188
# but database connection strings (with potential passwords) will be unencrypted
189-
*.pubxml
189+
#*.pubxml
190190
*.publishproj
191191

192192
# Microsoft Azure Web App publish settings. Comment the next line if you want to
@@ -401,3 +401,5 @@ FodyWeavers.xsd
401401
.idea/**/workspace.xml
402402
.idea/**/usage.statistics.xml
403403
.idea/**/shelf
404+
405+
publish

Diff for: App/App.csproj

+43-5
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,38 @@
77
<ApplicationManifest>app.manifest</ApplicationManifest>
88
<Platforms>x86;x64;ARM64</Platforms>
99
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
10+
<PublishProfile>Properties\PublishProfiles\win-$(Platform).pubxml</PublishProfile>
1011
<UseWinUI>true</UseWinUI>
1112
<Nullable>enable</Nullable>
13+
<EnableMsixTooling>true</EnableMsixTooling>
14+
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
1215
</PropertyGroup>
1316

1417
<ItemGroup>
15-
<Manifest Include="$(ApplicationManifest)"/>
18+
<AppxManifest Include="Package.appxmanifest">
19+
<SubType>Designer</SubType>
20+
</AppxManifest>
1621
</ItemGroup>
1722

1823
<ItemGroup>
19-
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0"/>
24+
<Manifest Include="$(ApplicationManifest)" />
25+
</ItemGroup>
26+
27+
<ItemGroup>
28+
<Content Include="Images\SplashScreen.scale-200.png" />
29+
<Content Include="Images\Square150x150Logo.scale-200.png" />
30+
<Content Include="Images\Square44x44Logo.scale-200.png" />
31+
</ItemGroup>
32+
33+
<ItemGroup>
34+
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
2035
<PackageReference Include="DependencyPropertyGenerator" Version="1.5.0">
2136
<PrivateAssets>all</PrivateAssets>
2237
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2338
</PackageReference>
24-
<PackageReference Include="H.NotifyIcon.WinUI" Version="2.2.0"/>
25-
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742"/>
26-
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.250108002"/>
39+
<PackageReference Include="H.NotifyIcon.WinUI" Version="2.2.0" />
40+
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
41+
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.250108002" />
2742
</ItemGroup>
2843

2944
<ItemGroup>
@@ -38,10 +53,33 @@
3853
</Page>
3954
</ItemGroup>
4055

56+
<!--
57+
Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging
58+
Tools extension to be activated for this project even if the Windows App SDK Nuget
59+
package has not yet been restored.
60+
-->
61+
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
62+
<ProjectCapability Include="Msix" />
63+
</ItemGroup>
64+
65+
<!--
66+
Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution
67+
Explorer "Package and Publish" context menu entry to be enabled for this project even if
68+
the Windows App SDK Nuget package has not yet been restored.
69+
-->
70+
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
71+
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
72+
</PropertyGroup>
73+
4174
<!-- Publish Properties -->
4275
<PropertyGroup>
76+
<!--
77+
This does not work in CI at the moment, so we need to set it to false
78+
Error: C:\Program Files\dotnet\sdk\9.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(400,5): error NETSDK1094: Unable to optimize assemblies for performance: a valid runtime package was not found. Either set the PublishReadyToRun property to false, or use a supported runtime identifier when publishing. When targeting .NET 6 or higher, make sure to restore packages with the PublishReadyToRun property set to true. [D:\a\coder-desktop-windows\coder-desktop-windows\App\App.csproj]
4379
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
4480
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
81+
-->
82+
<PublishReadyToRun>False</PublishReadyToRun>
4583
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
4684
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
4785
</PropertyGroup>
File renamed without changes.

Diff for: App/Package.appxmanifest

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<Package
4+
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
5+
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
6+
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
7+
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
8+
IgnorableNamespaces="uap rescap">
9+
10+
<Identity
11+
Name="925b49fc-4648-4967-b4e6-b5473061ee62"
12+
Publisher="CN=Coder Technologies Inc."
13+
Version="1.0.0.0"/>
14+
15+
<mp:PhoneIdentity PhoneProductId="925b49fc-4648-4967-b4e6-b5473061ee62"
16+
PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
17+
18+
<Properties>
19+
<DisplayName>Coder Desktop (Package)</DisplayName>
20+
<PublisherDisplayName>Coder Technologies Inc.</PublisherDisplayName>
21+
<Logo>Images\StoreLogo.png</Logo>
22+
</Properties>
23+
24+
<Dependencies>
25+
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0"/>
26+
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0"/>
27+
</Dependencies>
28+
29+
<Resources>
30+
<Resource Language="x-generate"/>
31+
</Resources>
32+
33+
<Applications>
34+
<Application Id="App"
35+
Executable="$targetnametoken$.exe"
36+
EntryPoint="$targetentrypoint$">
37+
<uap:VisualElements
38+
DisplayName="Coder Desktop"
39+
Description="Coder"
40+
BackgroundColor="transparent"
41+
Square150x150Logo="Images\Square150x150Logo.png"
42+
Square44x44Logo="Images\Square44x44Logo.png">
43+
<uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png"/>
44+
<uap:SplashScreen Image="Images\SplashScreen.png"/>
45+
</uap:VisualElements>
46+
</Application>
47+
</Applications>
48+
49+
<Capabilities>
50+
<rescap:Capability Name="runFullTrust"/>
51+
</Capabilities>
52+
</Package>

Diff for: App/Properties/PublishProfiles/win-arm64.pubxml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
https://go.microsoft.com/fwlink/?LinkID=208121.
4+
-->
5+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
6+
<PropertyGroup>
7+
<PublishProtocol>FileSystem</PublishProtocol>
8+
<Platform>ARM64</Platform>
9+
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
10+
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
11+
<SelfContained>true</SelfContained>
12+
<PublishSingleFile>False</PublishSingleFile>
13+
</PropertyGroup>
14+
</Project>

Diff for: App/Properties/PublishProfiles/win-x64.pubxml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
https://go.microsoft.com/fwlink/?LinkID=208121.
4+
-->
5+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
6+
<PropertyGroup>
7+
<PublishProtocol>FileSystem</PublishProtocol>
8+
<Platform>x64</Platform>
9+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
10+
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
11+
<SelfContained>true</SelfContained>
12+
<PublishSingleFile>False</PublishSingleFile>
13+
</PropertyGroup>
14+
</Project>

Diff for: App/Properties/PublishProfiles/win-x86.pubxml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
https://go.microsoft.com/fwlink/?LinkID=208121.
4+
-->
5+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
6+
<PropertyGroup>
7+
<PublishProtocol>FileSystem</PublishProtocol>
8+
<Platform>x86</Platform>
9+
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
10+
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
11+
<SelfContained>true</SelfContained>
12+
<PublishSingleFile>False</PublishSingleFile>
13+
</PropertyGroup>
14+
</Project>

Diff for: App/Properties/launchSettings.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"profiles": {
3+
"App (Package)": {
4+
"commandName": "MsixPackage"
5+
},
6+
"App (Unpackaged)": {
7+
"commandName": "Project"
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)