Skip to content

Commit 7f37a5b

Browse files
HelloHimclaude
andcommitted
ci: repair the build workflows
Both workflows were inherited from upstream and had drifted out of step with the project. They installed the .NET 8 SDK while the solution has targeted net10.0-windows7.0 since the fork began, so neither of them could restore, let alone build. The test step also ran a bare "dotnet test", which resolves the Debug configuration. The test project is deliberately left out of Debug and Release; only the Tests configurations define MAKE_TESTS, which stubs out the real keyboard and mouse injection so a test run cannot type into the desktop of whoever is running it. Asking for the wrong configuration therefore failed with a missing test assembly rather than a missing configuration, which reads as a broken checkout rather than a wrong command. Neither workflow ran on push or pull request, so any of this stayed invisible until someone triggered a run by hand. Build and test now runs on both, which is the point of having it once the repository is public and taking contributions. The publish workflow pinned its artifact name to version 0.0.20, long stale, and drove msbuild through "nuget restore", which is not on the runner by default. It now reads the version from the project file and publishes with the dotnet CLI. Platform stays pinned to x64 with no runtime identifier: the bundled FakerInputWrapper reference and the native libVIIPER and SDL3 libraries all resolve through libs\$(Platform), and passing a runtime identifier moves that path out from under them, so the build stops resolving FakerInputWrapper. It is also renamed from action_demo.yml, which said nothing about what it produced. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019QqG6aas4Z2YEUTqcDxBV4
1 parent 5d51b29 commit 7f37a5b

3 files changed

Lines changed: 71 additions & 149 deletions

File tree

.github/workflows/action_demo.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Produces a downloadable x64 build of the application.
2+
#
3+
# Published without a runtime identifier and with Platform pinned to x64. The
4+
# bundled FakerInputWrapper reference and the native libVIIPER and SDL3
5+
# libraries are all resolved through libs\$(Platform), so passing a runtime
6+
# identifier instead moves that path out from under them and the build fails
7+
# to resolve FakerInputWrapper.
8+
9+
name: Build artifact
10+
11+
on: workflow_dispatch
12+
13+
jobs:
14+
build:
15+
runs-on: windows-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Install .NET
22+
uses: actions/setup-dotnet@v4
23+
with:
24+
dotnet-version: 10.0.x
25+
26+
# Taken from the project file so a release build cannot be published under
27+
# a version that was last correct several releases ago.
28+
- name: Read version
29+
id: version
30+
shell: pwsh
31+
run: |
32+
[xml]$project = Get-Content DS4MapperTest\DS4MapperTest.csproj
33+
$version = $project.Project.PropertyGroup.Version | Where-Object { $_ } | Select-Object -First 1
34+
if (-not $version) { throw "No Version property found in DS4MapperTest.csproj" }
35+
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
36+
37+
- name: Publish
38+
run: dotnet publish DS4MapperTest\DS4MapperTest.csproj -c Release -p:Platform=x64 -o build
39+
40+
- name: Upload artifact
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: DS4MapperTest_${{ steps.version.outputs.version }}
44+
path: build
Lines changed: 27 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,43 @@
1-
# This workflow uses actions that are not certified by GitHub.
2-
# They are provided by a third-party and are governed by
3-
# separate terms of service, privacy policy, and support
4-
# documentation.
5-
6-
# This workflow will build, test, sign and package a WPF or Windows Forms desktop application
7-
# built on .NET Core.
8-
# To learn how to migrate your existing application to .NET Core,
9-
# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework
10-
#
11-
# To configure this workflow:
12-
#
13-
# 1. Configure environment variables
14-
# GitHub sets default environment variables for every workflow run.
15-
# Replace the variables relative to your project in the "env" section below.
16-
#
17-
# 2. Signing
18-
# Generate a signing certificate in the Windows Application
19-
# Packaging Project or add an existing signing certificate to the project.
20-
# Next, use PowerShell to encode the .pfx file using Base64 encoding
21-
# by running the following Powershell script to generate the output string:
22-
#
23-
# $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte
24-
# [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt'
1+
# Builds the application and runs the unit test suite.
252
#
26-
# Open the output file, SigningCertificate_Encoded.txt, and copy the
27-
# string inside. Then, add the string to the repo as a GitHub secret
28-
# and name it "Base64_Encoded_Pfx."
29-
# For more information on how to configure your signing certificate for
30-
# this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing
31-
#
32-
# Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key".
33-
# See "Build the Windows Application Packaging project" below to see how the secret is used.
34-
#
35-
# For more information on GitHub Actions, refer to https://github.com/features/actions
36-
# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications,
37-
# refer to https://github.com/microsoft/github-actions-for-desktop-apps
38-
39-
name: .NET Core Desktop
40-
41-
on: workflow_dispatch
3+
# The tests only build under the "Release Tests" solution configuration. That
4+
# configuration defines MAKE_TESTS, which stubs out the real keyboard and mouse
5+
# injection so a test run cannot type into the desktop of whoever is running
6+
# it. Under the plain Release configuration the test project is deliberately
7+
# left out of the build, so a bare "dotnet test" reports a missing test
8+
# assembly rather than running anything.
9+
10+
name: Build and test
11+
12+
on:
13+
push:
14+
branches: [ master ]
15+
pull_request:
16+
branches: [ master ]
17+
workflow_dispatch:
4218

4319
jobs:
44-
4520
build:
46-
47-
strategy:
48-
matrix:
49-
configuration: [Release]
50-
51-
runs-on: windows-latest # For a list of available runner types, refer to
52-
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
21+
runs-on: windows-latest
5322

5423
env:
55-
Solution_Name: DS4MapperTest.sln # Replace with your solution name, i.e. MyWpfApp.sln.
56-
Test_Project_Path: DS4MapperUnitTests\DS4MapperUnitTests.csproj # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj.
57-
#Wap_Project_Directory: your-wap-project-directory-name # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package.
58-
#Wap_Project_Path: your-wap-project-path # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj.
24+
Solution_Name: DS4MapperTest.sln
25+
Test_Configuration: Release Tests
5926

6027
steps:
6128
- name: Checkout
6229
uses: actions/checkout@v4
63-
with:
64-
fetch-depth: 0
6530

66-
# Install the .NET Core workload
67-
- name: Install .NET Core
31+
- name: Install .NET
6832
uses: actions/setup-dotnet@v4
6933
with:
70-
dotnet-version: 8.0.x
71-
72-
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
73-
- name: Setup MSBuild.exe
74-
uses: microsoft/setup-msbuild@v2
75-
76-
# Execute all unit tests in the solution
77-
- name: Execute unit tests
78-
run: dotnet test
79-
80-
# Restore the application to populate the obj folder with RuntimeIdentifiers
81-
- name: Restore the application
82-
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration /p:Platform=$env:Platform
83-
env:
84-
Configuration: ${{ matrix.configuration }}
85-
Platform: "x64"
86-
87-
# Decode the base 64 encoded pfx and save the Signing_Certificate
88-
#- name: Decode the pfx
89-
# run: |
90-
# $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}")
91-
# $certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx
92-
# [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)
34+
dotnet-version: 10.0.x
9335

94-
# Create the app package by building and packaging the Windows Application Packaging project
95-
#- name: Create the app package
96-
# run: msbuild $env:Wap_Project_Path /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:PackageCertificatePassword=${{ secrets.Pfx_Key }}
97-
# env:
98-
# Appx_Bundle: Always
99-
# Appx_Bundle_Platforms: x86|x64
100-
# Appx_Package_Build_Mode: StoreUpload
101-
# Configuration: ${{ matrix.configuration }}
36+
- name: Restore
37+
run: dotnet restore ${{ env.Solution_Name }}
10238

103-
# Remove the pfx
104-
#- name: Remove the pfx
105-
# run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx
39+
- name: Build
40+
run: dotnet build ${{ env.Solution_Name }} -c "${{ env.Test_Configuration }}" --no-restore
10641

107-
# Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact
108-
#- name: Upload build artifacts
109-
# uses: actions/upload-artifact@v4
110-
# with:
111-
# name: MSIX Package
112-
# path: ${{ env.Wap_Project_Directory }}\AppPackages
42+
- name: Test
43+
run: dotnet test ${{ env.Solution_Name }} -c "${{ env.Test_Configuration }}" --no-build

0 commit comments

Comments
 (0)