Skip to content

Commit d58455a

Browse files
authored
Merge pull request #574 from TheJoeFin/dev
Dev
2 parents 467df0f + 7ce9d37 commit d58455a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+17485
-1038
lines changed

.claude/settings.local.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
"Bash(./Tests.exe --help)",
1010
"Bash(dotnet --version)",
1111
"Bash(dotnet build:*)",
12-
"Bash(dotnet test:*)"
12+
"Bash(dotnet test:*)",
13+
"Bash(gh pr list:*)",
14+
"Bash(/mnt/c/Program Files/dotnet/dotnet.exe:*)"
1315
],
1416
"deny": []
1517
}
16-
}
18+
}

.github/workflows/Release.yml

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
name: Release CI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Tag name for the release (e.g., v1.0.0). If empty, a tag will be generated from the run number.'
8+
required: false
9+
default: ''
10+
name:
11+
description: 'Release title (optional). If empty, a title will be generated using the tag.'
12+
required: false
13+
default: ''
14+
15+
permissions:
16+
contents: write
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
20+
cancel-in-progress: true
21+
22+
env:
23+
PROJECT: 'Text-Grab'
24+
PROJECT_PATH: 'Text-Grab/Text-Grab.csproj'
25+
TEST_PATH: 'Tests/Tests.csproj'
26+
BUILD_X64: 'bld/x64'
27+
BUILD_X64_SC: 'bld/x64/Text-Grab-Self-Contained'
28+
BUILD_ARM64: 'bld/arm64'
29+
BUILD_ARM64_SC: 'bld/arm64/Text-Grab-Self-Contained'
30+
31+
jobs:
32+
build:
33+
runs-on: windows-latest
34+
steps:
35+
- uses: actions/checkout@v5
36+
37+
- name: Setup .NET
38+
uses: actions/setup-dotnet@v5
39+
with:
40+
dotnet-version: '9.0.x'
41+
42+
- name: Install dependencies
43+
run: dotnet restore ${{ env.PROJECT_PATH }}
44+
45+
- name: Run tests
46+
run: dotnet test ${{ env.TEST_PATH }} -r win-x64
47+
48+
- name: Compute build version, archive paths, and release metadata
49+
id: compute
50+
shell: pwsh
51+
run: |
52+
$version = Get-Date -Format 'yyyy-MM-dd'
53+
$archiveX64SC = "${{ env.BUILD_X64 }}/${{ env.PROJECT }}-x64-Self-Contained-$version.zip"
54+
$archiveArm64SC = "${{ env.BUILD_ARM64 }}/${{ env.PROJECT }}-Self-Contained-$version.zip"
55+
56+
$tag = "${{ github.event.inputs.tag }}"
57+
if ([string]::IsNullOrWhiteSpace($tag)) { $tag = "v${{ github.run_number }}" }
58+
59+
$name = "${{ github.event.inputs.name }}"
60+
if ([string]::IsNullOrWhiteSpace($name)) { $name = "Text Grab $tag" }
61+
62+
echo "version=$version" >> $env:GITHUB_OUTPUT
63+
echo "archive_x64_sc=$archiveX64SC" >> $env:GITHUB_OUTPUT
64+
echo "archive_arm64_sc=$archiveArm64SC" >> $env:GITHUB_OUTPUT
65+
echo "release_tag=$tag" >> $env:GITHUB_OUTPUT
66+
echo "release_name=$name" >> $env:GITHUB_OUTPUT
67+
68+
- name: Clean build directories
69+
shell: pwsh
70+
run: |
71+
if (Test-Path '${{ env.BUILD_X64 }}') { Remove-Item '${{ env.BUILD_X64 }}' -Recurse -Force }
72+
if (Test-Path '${{ env.BUILD_ARM64 }}') { Remove-Item '${{ env.BUILD_ARM64 }}' -Recurse -Force }
73+
New-Item -ItemType Directory -Path '${{ env.BUILD_X64 }}' -Force | Out-Null
74+
New-Item -ItemType Directory -Path '${{ env.BUILD_ARM64 }}' -Force | Out-Null
75+
76+
- name: Build x64 framework-dependent
77+
run: >-
78+
dotnet publish ${{ env.PROJECT_PATH }}
79+
--runtime win-x64
80+
--self-contained false
81+
-c Release
82+
-v minimal
83+
-o ${{ env.BUILD_X64 }}
84+
-p:EnableMsixTooling=true
85+
-p:PublishReadyToRun=false
86+
-p:PublishSingleFile=true
87+
-p:CopyOutputSymbolsToPublishDirectory=false
88+
--nologo
89+
90+
- name: Build x64 self-contained
91+
run: >-
92+
dotnet publish ${{ env.PROJECT_PATH }}
93+
--runtime win-x64
94+
--self-contained true
95+
-c Release
96+
-v minimal
97+
-o ${{ env.BUILD_X64_SC }}
98+
-p:EnableMsixTooling=true
99+
-p:PublishReadyToRun=true
100+
-p:PublishSingleFile=true
101+
-p:CopyOutputSymbolsToPublishDirectory=false
102+
--nologo
103+
104+
- name: Build ARM64 framework-dependent
105+
run: >-
106+
dotnet publish ${{ env.PROJECT_PATH }}
107+
--runtime win-arm64
108+
--self-contained false
109+
-c Release
110+
-v minimal
111+
-o ${{ env.BUILD_ARM64 }}
112+
-p:PublishSingleFile=true
113+
-p:EnableMsixTooling=true
114+
-p:CopyOutputSymbolsToPublishDirectory=false
115+
--nologo
116+
117+
- name: Build ARM64 self-contained
118+
run: >-
119+
dotnet publish ${{ env.PROJECT_PATH }}
120+
--runtime win-arm64
121+
--self-contained true
122+
-c Release
123+
-v minimal
124+
-o ${{ env.BUILD_ARM64_SC }}
125+
-p:PublishSingleFile=true
126+
-p:EnableMsixTooling=true
127+
-p:CopyOutputSymbolsToPublishDirectory=false
128+
--nologo
129+
130+
- name: Rename ARM64 executables
131+
shell: pwsh
132+
run: |
133+
if (Test-Path "${{ env.BUILD_ARM64 }}/${{ env.PROJECT }}.exe") {
134+
Rename-Item "${{ env.BUILD_ARM64 }}/${{ env.PROJECT }}.exe" 'Text-Grab-arm64.exe'
135+
}
136+
if (Test-Path "${{ env.BUILD_ARM64_SC }}/${{ env.PROJECT }}.exe") {
137+
Rename-Item "${{ env.BUILD_ARM64_SC }}/${{ env.PROJECT }}.exe" 'Text-Grab-arm64.exe'
138+
}
139+
140+
- name: Create self-contained archives
141+
shell: pwsh
142+
run: |
143+
$x64SCZip = "${{ steps.compute.outputs.archive_x64_sc }}"
144+
$arm64SCZip = "${{ steps.compute.outputs.archive_arm64_sc }}"
145+
146+
if (Test-Path $x64SCZip) { Remove-Item -Force $x64SCZip }
147+
if (Test-Path $arm64SCZip) { Remove-Item -Force $arm64SCZip }
148+
149+
Compress-Archive -Path "${{ env.BUILD_X64_SC }}\*" -DestinationPath $x64SCZip -Force
150+
Compress-Archive -Path "${{ env.BUILD_ARM64_SC }}\*" -DestinationPath $arm64SCZip -Force
151+
152+
- name: Version information
153+
shell: pwsh
154+
run: |
155+
$exe = Join-Path '${{ env.BUILD_X64 }}' '${{ env.PROJECT }}.exe'
156+
if (Test-Path $exe) {
157+
$vi = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($exe)
158+
Write-Host "Product Version: $($vi.ProductVersion)"
159+
Write-Host "File Version: $($vi.FileVersion)"
160+
}
161+
162+
- name: Upload build artifact (x64 framework-dependent)
163+
uses: actions/upload-artifact@v4
164+
with:
165+
name: Text-Grab-win-x64-framework-dependent
166+
path: ${{ env.BUILD_X64 }}
167+
168+
- name: Upload build artifact (x64 self-contained)
169+
uses: actions/upload-artifact@v4
170+
with:
171+
name: Text-Grab-win-x64-self-contained
172+
path: ${{ steps.compute.outputs.archive_x64_sc }}
173+
174+
- name: Upload build artifact (ARM64 framework-dependent)
175+
uses: actions/upload-artifact@v4
176+
with:
177+
name: Text-Grab-win-arm64-framework-dependent
178+
path: ${{ env.BUILD_ARM64 }}
179+
180+
- name: Upload build artifact (ARM64 self-contained)
181+
uses: actions/upload-artifact@v4
182+
with:
183+
name: Text-Grab-win-arm64-self-contained
184+
path: ${{ steps.compute.outputs.archive_arm64_sc }}
185+
186+
- name: Create draft GitHub release and upload assets
187+
uses: softprops/action-gh-release@v2
188+
env:
189+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
190+
with:
191+
tag_name: ${{ steps.compute.outputs.release_tag }}
192+
name: ${{ steps.compute.outputs.release_name }}
193+
target_commitish: ${{ github.sha }}
194+
draft: true
195+
prerelease: true
196+
generate_release_notes: true
197+
fail_on_unmatched_files: true
198+
files: |
199+
${{ steps.compute.outputs.archive_x64_sc }}
200+
${{ steps.compute.outputs.archive_arm64_sc }}

.github/workflows/buildDev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Build
2828
run: dotnet build ${{ env.PROJECT_PATH }} -p:EnableMsixTooling=true
2929
- name: Test
30-
run: dotnet test ${{ env.TEST_PATH }} -r win-x64 -p:EnableMsixTooling=true
30+
run: dotnet test ${{ env.TEST_PATH }} -r win-x64
3131

3232
- name: Build for release and Publish
3333
run: dotnet publish ${{ env.PROJECT_PATH }} -c Release --self-contained -r win-x64 -p:PublishSingleFile=true -p:EnableMsixTooling=true -o publish

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,4 +338,7 @@ ASALocalRun/
338338
.localhistory/
339339

340340
# BeatPulse healthcheck temp database
341-
healthchecksdb
341+
healthchecksdb
342+
343+
# Mono registry files
344+
.mono/

Tests/BenchmarkRunnerTests.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using BenchmarkDotNet.Running;
2+
3+
namespace Tests;
4+
5+
public class BenchmarkRunnerTests
6+
{
7+
[Fact(Skip = "Manual: run benchmarks on demand only.")]
8+
public void RunAllBenchmarks()
9+
{
10+
// Runs all benchmarks in the Tests assembly. Intended to be invoked manually.
11+
_ = BenchmarkRunner.Run(typeof(BenchmarkRunnerTests).Assembly);
12+
}
13+
}

0 commit comments

Comments
 (0)