Skip to content

Commit 26bca1f

Browse files
committed
Merge master and update with example
2 parents 86dee29 + a3df60c commit 26bca1f

File tree

754 files changed

+4620
-23908
lines changed

Some content is hidden

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

754 files changed

+4620
-23908
lines changed

.github/workflows/Benchmark.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
name: Benchmark
22

3-
on: [push, pull_request]
3+
on: push
44
jobs:
55
Rendering:
66
runs-on: windows-latest
77
steps:
8-
- uses: actions/checkout@v2
8+
- uses: actions/checkout@v6
99
with:
1010
submodules: 'recursive'
11-
- name: Setup .NET Core
12-
uses: actions/setup-dotnet@v1
11+
- name: Setup .NET
12+
uses: actions/setup-dotnet@v5
1313
with:
14-
dotnet-version: 3.1.401
14+
dotnet-version: '10.x'
1515
- run: dotnet run -p CSharpMath.Rendering.Benchmarks
1616
- name: Store benchmark result
17-
uses: Happypig375/github-action-benchmark@v1
17+
uses: benchmark-action/github-action-benchmark@v1
1818
with:
1919
name: CSharpMath.Rendering.Benchmarks
2020
tool: 'benchmarkdotnet'

.github/workflows/Build.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/Nightly.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Upload test results and nightly builds
2+
3+
on: push
4+
jobs:
5+
Everything:
6+
runs-on: windows-latest
7+
steps:
8+
- name: Update draft on GitHub Releases
9+
id: release_drafter
10+
uses: release-drafter/[email protected] # Pinned to v6.0.0 to avoid v6.1.0 bug: https://github.com/release-drafter/release-drafter/issues/1425
11+
env:
12+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
- uses: actions/checkout@v6
14+
with:
15+
submodules: 'recursive'
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v5
18+
with:
19+
dotnet-version: '10.x'
20+
- name: Build and Test
21+
env:
22+
RELEASE_NOTES: |
23+
# ${{ steps.release_drafter.outputs.name }}
24+
25+
${{ steps.release_drafter.outputs.body }}
26+
run: |
27+
# .NET Core MSBuild cannot parse , and ; correctly so we replace them with substitutions: https://github.com/dotnet/msbuild/issues/471#issuecomment-366268743
28+
# PowerShell string replacement
29+
$env:RELEASE_NOTES = $env:RELEASE_NOTES -replace ',','%2C' -replace ';','%3B'
30+
31+
dotnet workload restore
32+
dotnet test --solution CSharpMath.sln -c Release -p:PackageReleaseNotes="$env:RELEASE_NOTES" -p:PackageVersion=${{ steps.release_drafter.outputs.tag_name || format('{0}-pr', github.event.number) }}-ci-${{ github.sha }}
33+
#### Awaiting coverlet.MTP at https://github.com/coverlet-coverage/coverlet/pull/1788
34+
# # --collect:"XPlat Code Coverage" means collect test coverage with https://github.com/coverlet-coverage/coverlet
35+
# # Coverlet settings come after --: https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/VSTestIntegration.md#advanced-options-supported-via-runsettings
36+
# dotnet test --solution CSharpMath.sln -c Release --collect:"XPlat Code Coverage" --results-directory .testcoverage -p:PackageReleaseNotes="$env:RELEASE_NOTES" -p:PackageVersion=${{ steps.release_drafter.outputs.tag_name || format('{0}-pr', github.event.number) }}-ci-${{ github.sha }} -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.IncludeTestAssembly=true
37+
# shell: pwsh
38+
#- name: Run ReportGenerator on Test Coverage results
39+
# uses: danielpalme/ReportGenerator-GitHub-Action@5
40+
# with:
41+
# reports: '.testcoverage/**/*.*' # REQUIRED # The coverage reports that should be parsed (separated by semicolon). Globbing is supported.
42+
# targetdir: '.testcoverage/report' # REQUIRED # The directory where the generated report should be saved.
43+
# reporttypes: 'Html' # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlSummary, JsonSummary, Latex, LatexSummary, lcov, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, Xml, XmlSummary
44+
# title: 'CSharpMath test coverage results' # Optional title.
45+
# tag: ${{ steps.release_drafter.outputs.tag_name || format('{0}-pr', github.event.number) }}-ci-${{ github.sha }} # Optional tag or build version.
46+
#- name: Upload CSharpMath test coverage results as CI artifacts
47+
# uses: actions/upload-artifact@v4
48+
# with:
49+
# name: CSharpMath test coverage results
50+
# path: .testcoverage/
51+
#- name: Upload CSharpMath test coverage results to codecov.io
52+
# uses: codecov/codecov-action@v4
53+
# with:
54+
# file: .testcoverage/**/*.xml # optional
55+
# name: CSharpMath test coverage # optional
56+
# fail_ci_if_error: false # optional (default = false)
57+
- name: Upload CSharpMath.Rendering.Tests results as CI artifacts
58+
uses: actions/upload-artifact@v4
59+
if: always() # Run even when a previous step failed: https://stackoverflow.com/a/58859404/5429648
60+
with:
61+
name: CSharpMath.Rendering.Tests results
62+
path: CSharpMath.Rendering.Tests/*/*.png
63+
- name: Upload CSharpMath.Xaml.Tests.NuGet results as CI artifacts
64+
uses: actions/upload-artifact@v4
65+
if: always()
66+
with:
67+
name: CSharpMath.Xaml.Tests.NuGet results
68+
path: CSharpMath.Xaml.Tests.NuGet/*.png
69+
- name: Upload NuGet packages as CI artifacts
70+
uses: actions/upload-artifact@v4
71+
if: always()
72+
with:
73+
name: NuGet packages
74+
path: .nupkgs/
75+
- name: Push CI artifacts to GitHub Packages registry
76+
if: github.ref == 'refs/heads/master'
77+
run: |
78+
# "dotnet nuget push" with "dotnet nuget add source" to GitHub Packages is unstable for project names with a dot: https://github.com/NuGet/Home/issues/9775#issuecomment-714509211
79+
# So we must specify api-key directly in "dotnet nuget push" instead of following the GitHub Packages documentation
80+
# We use quotes to avoid shell globbing: https://github.com/NuGet/Home/issues/4393#issuecomment-667618120
81+
# --no-symbols true to not let GitHub Releases interpret .snupkg as .nupkg
82+
dotnet nuget push '.nupkgs/*.nupkg' --source 'https://nuget.pkg.github.com/verybadcat/index.json' --api-key ${{ github.token }} --skip-duplicate --no-symbols true
83+
shell: pwsh

.github/workflows/Release.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ on:
55
types: [published]
66
jobs:
77
CSharpMath:
8-
runs-on: ubuntu-latest
8+
runs-on: windows-latest
99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v6
1111
with:
1212
submodules: 'recursive'
13-
- name: Setup .NET Core
14-
uses: actions/setup-dotnet@v1
13+
- name: Setup .NET
14+
uses: actions/setup-dotnet@v5
1515
with:
16-
dotnet-version: '3.1.401'
16+
dotnet-version: '10.x'
1717
- name: Build GitHub Releases draft artifacts
1818
env:
1919
RELEASE_NOTES: |
@@ -22,13 +22,13 @@ jobs:
2222
${{ github.event.release.body }}
2323
run: |
2424
# .NET Core MSBuild cannot parse , and ; correctly so we replace them with substitutions: https://github.com/dotnet/msbuild/issues/471#issuecomment-366268743
25-
# https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion
26-
# ${parameter/pattern/string} If pattern begins with ‘/’, all matches of pattern are replaced with string. Normally only the first match is replaced.
27-
RELEASE_NOTES=${RELEASE_NOTES//,/%2C}
28-
RELEASE_NOTES=${RELEASE_NOTES//;/%3B}
25+
# PowerShell string replacement
26+
$env:RELEASE_NOTES = $env:RELEASE_NOTES -replace ',','%2C' -replace ';','%3B'
2927
28+
dotnet workload restore
3029
# -r for restore
31-
dotnet msbuild -r -p:Configuration=Release -p:PackageVersion="${{ github.event.release.tag_name }}" -p:PackageReleaseNotes="$RELEASE_NOTES" CSharpMath.CrossPlatform.slnf
30+
dotnet msbuild -r -p:Configuration=Release -p:PackageVersion="${{ github.event.release.tag_name }}" -p:PackageReleaseNotes="$env:RELEASE_NOTES" CSharpMath.sln
31+
shell: pwsh
3232
- name: Upload to GitHub Releases
3333
uses: svenstaro/upload-release-action@v2
3434
with:
@@ -41,3 +41,4 @@ jobs:
4141
run: | # We use double quotes to avoid shell globbing: https://github.com/NuGet/Home/issues/4393#issuecomment-667618120
4242
# Use --skip-duplicate since we want re-runs of this workflow to succeed in case of network issues
4343
dotnet nuget push ".nupkgs/*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
44+
shell: pwsh

.github/workflows/Test.yml

Lines changed: 22 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -1,178 +1,29 @@
1-
name: Test
1+
name: Build and Test
22

3-
on: [push, pull_request]
3+
on: push
44
jobs:
5-
Core:
6-
runs-on: ubuntu-latest # release-drafter/release-drafter@v5 only works on Linux: https://github.com/release-drafter/release-drafter/issues/558
5+
Everything:
6+
strategy:
7+
fail-fast: false # Don't cancel other os builds if one fails
8+
matrix:
9+
# Check included Xcode versions for GitHub Actions: https://github.com/actions/runner-images?tab=readme-ov-file#available-images
10+
os: [windows-latest, ubuntu-latest, macos-26]
11+
runs-on: ${{ matrix.os }}
712
steps:
8-
- name: Update draft on GitHub Releases
9-
id: release_drafter
10-
uses: release-drafter/release-drafter@v5
11-
env:
12-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13-
- uses: actions/checkout@v2
13+
- uses: maxim-lobanov/setup-xcode@v1
14+
if: startsWith(matrix.os, 'macos')
1415
with:
15-
submodules: 'recursive'
16-
- name: Setup .NET Core # Required to execute ReportGenerator
17-
uses: actions/setup-dotnet@v1
18-
with:
19-
dotnet-version: '3.1.401'
20-
- name: Update dependencies in CSharpMath.Xaml.Tests.NuGet
21-
run: |
22-
dotnet tool install -g dotnet-outdated
23-
update() {
24-
dotnet outdated -u CSharpMath.Xaml.Tests.NuGet
25-
dotnet outdated -pre Always -inc CSharpMath -u CSharpMath.Xaml.Tests.NuGet
26-
}
27-
# retry 5 times since dotnet outdated fails often: https://github.com/jerriep/dotnet-outdated/issues/299
28-
update || update || update || update || update
29-
- name: Build and Test
30-
env:
31-
RELEASE_NOTES: |
32-
# ${{ steps.release_drafter.outputs.name }}
33-
34-
${{ steps.release_drafter.outputs.body }}
35-
run: |
36-
# .NET Core MSBuild cannot parse , and ; correctly so we replace them with substitutions: https://github.com/dotnet/msbuild/issues/471#issuecomment-366268743
37-
# https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion
38-
# ${parameter/pattern/string} If pattern begins with ‘/’, all matches of pattern are replaced with string. Normally only the first match is replaced.
39-
RELEASE_NOTES=${RELEASE_NOTES//,/%2C}
40-
RELEASE_NOTES=${RELEASE_NOTES//;/%3B}
41-
42-
# --collect:"XPlat Code Coverage" means collect test coverage with https://github.com/coverlet-coverage/coverlet
43-
# Coverlet settings come after --: https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/VSTestIntegration.md#advanced-options-supported-via-runsettings
44-
dotnet test CSharpMath.CrossPlatform.slnf -c Release -l GitHubActions --blame --collect:"XPlat Code Coverage" -r .testcoverage -p:PackageReleaseNotes="$RELEASE_NOTES" -p:PackageVersion=${{ steps.release_drafter.outputs.tag_name || format('{0}-pr', github.event.number) }}-ci-${{ github.sha }} -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.IncludeTestAssembly=true
45-
- name: Run ReportGenerator on Test Coverage results
46-
uses: danielpalme/[email protected]
47-
with:
48-
reports: '.testcoverage/**/*.*' # REQUIRED # The coverage reports that should be parsed (separated by semicolon). Globbing is supported.
49-
targetdir: '.testcoverage/report' # REQUIRED # The directory where the generated report should be saved.
50-
reporttypes: 'Html' # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlSummary, JsonSummary, Latex, LatexSummary, lcov, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, Xml, XmlSummary
51-
title: 'CSharpMath test coverage results' # Optional title.
52-
tag: ${{ steps.release_drafter.outputs.tag_name || format('{0}-pr', github.event.number) }}-ci-${{ github.sha }} # Optional tag or build version.
53-
- name: Upload CSharpMath test coverage results as CI artifacts
54-
uses: actions/upload-artifact@v2
55-
with:
56-
name: CSharpMath test coverage results
57-
path: .testcoverage/
58-
- name: Upload CSharpMath test coverage results to codecov.io
59-
uses: codecov/codecov-action@v1
60-
with:
61-
file: .testcoverage/**/*.xml # optional
62-
name: CSharpMath test coverage # optional
63-
fail_ci_if_error: true # optional (default = false)
64-
- name: Upload CSharpMath.Rendering.Tests results as CI artifacts
65-
uses: actions/upload-artifact@v2
66-
if: always() # Run even when a previous step failed: https://stackoverflow.com/a/58859404/5429648
16+
# Check required Xcode version for latest "dotnet workload restore": https://github.com/dotnet/macios/releases
17+
xcode-version: '26.2' # If this is to be changed, also check macos-version in matrix.os above
18+
- uses: actions/setup-dotnet@v5
6719
with:
68-
name: CSharpMath.Rendering.Tests results
69-
path: CSharpMath.Rendering.Tests/*/*.png
70-
- name: Upload CSharpMath.Xaml.Tests.NuGet results as CI artifacts
71-
uses: actions/upload-artifact@v2
72-
if: always()
73-
with:
74-
name: CSharpMath.Xaml.Tests.NuGet results
75-
path: CSharpMath.Xaml.Tests.NuGet/*.png
76-
- name: Upload NuGet packages as CI artifacts
77-
uses: actions/upload-artifact@v2
78-
if: always()
79-
with:
80-
name: NuGet packages
81-
path: .nupkgs/
82-
- name: Push CI artifacts to GitHub Packages registry
83-
if: github.ref == 'refs/heads/master'
84-
run: |
85-
# "dotnet nuget push" with "dotnet nuget add source" to GitHub Packages is unstable for project names with a dot: https://github.com/NuGet/Home/issues/9775#issuecomment-714509211
86-
# So we must specify api-key directly in "dotnet nuget push" instead of following the GitHub Packages documentation
87-
# We use quotes to avoid shell globbing: https://github.com/NuGet/Home/issues/4393#issuecomment-667618120
88-
# --no-symbols true to not let GitHub Releases interpret .snupkg as .nupkg
89-
dotnet nuget push '.nupkgs/*.nupkg' --source 'https://nuget.pkg.github.com/verybadcat/index.json' --api-key ${{ github.token }} --skip-duplicate --no-symbols true
90-
Ios:
91-
runs-on: macos-latest
92-
steps:
93-
- uses: actions/checkout@v2
20+
dotnet-version: '10.x'
21+
- uses: actions/checkout@v6
9422
with:
9523
submodules: 'recursive'
96-
- run: nuget restore CSharpMath.sln
97-
- run: msbuild CSharpMath.Ios.Tests
98-
- name: Run tests
99-
env:
100-
IOS_SIM_NAME: iPhone 11 # https://github.com/actions/virtual-environments/blob/master/images/macos/macos-10.15-Readme.md#installed-simulators
101-
BUNDLE_IDENTIFIER: CSharpMath.Ios.Unit-Tests # Located inside CSharpMath.Ios.Tests Info.plist file
102-
APP_PATH: CSharpMath.Ios.Tests/bin/iPhoneSimulator/Debug/CSharpMath.Ios.Tests.app
103-
run: |
104-
# This script is a heavily modified version of https://gist.github.com/jerrymarino/1f9eb6a06c423f9744ea297d80193a9b
105-
106-
IOS_SIM_UDID=`xcrun simctl list | grep -w "$IOS_SIM_NAME" | awk 'match($0, /\(([-0-9A-F]+)\)/) { print substr( $0, RSTART + 1, RLENGTH - 2 )}' | head -1`
107-
SIMULATOR_PATH='/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator'
108-
109-
# run_ios_sim builds and runs an iOS app on the simulator
110-
#
111-
# It is designed to replicate the behavior of "Run" in Xcode and assumes basic
112-
# xcodebuild usage.
113-
#
114-
# USAGE:
115-
# export IOS_SIM_UDID=342F9A20-DF48-41A9-BE60-C6B35F47E97F; \
116-
# export BUNDLE_IDENTIFIER=a.Some; \
117-
# export APP_PATH=$PWD/Build/Debug-iphonesimulator/$APP_NAME.app \
118-
# /path/to/run_ios_sim.sh
119-
#
120-
# Note that the UDID must match a device where runtime is installed See
121-
# available devices with "simctl list"
122-
#
123-
# Tested on Xcode 8.3.1 a few times
124-
# Author: Jerry Marino - @jerrymarino
125-
126-
APP_NAME=`echo ""${APP_PATH##*/}"" | cut -d'.' -f1`
127-
128-
echo "Running sim for $APP_NAME - $BUNDLE_IDENTIFIER"
129-
130-
# If the booted simulator does not match, then we need to restart it. Expect an
131-
# output list of the form
132-
# "Phone: iPhone 7 Plus (342F9A20-DF48-41A9-BE60-C6B35F47E97F) (Booted)"
133-
BOOTED_UDID=`xcrun simctl list | grep Booted | perl -pe 's/(.*\()(.*)\)+ (.*)/\2/' | sed -n 1p`
134-
if [[ $BOOTED_UDID != $IOS_SIM_UDID ]]; then
135-
killall Simulator || true # Ignore error code 1: No matching process has been found
136-
else
137-
# FIXME: We don't need to do this for all cases and
138-
# it is slow
139-
killall Simulator || true # Ignore error code 1: No matching process has been found
140-
fi
141-
142-
# Open the simulator
143-
open -a "$SIMULATOR_PATH" --args -CurrentDeviceUDID $IOS_SIM_UDID
144-
145-
# Wait until there is a device booted
146-
147-
function booted_sim_ct() {
148-
echo `xcrun simctl list | grep Booted | wc -l | sed -e 's/ //g'`
149-
}
150-
151-
while [ `booted_sim_ct` -lt 1 ]
152-
do
153-
sleep 1
154-
done
155-
156-
echo "Installing app at path $APP_PATH"
157-
xcrun simctl install booted $APP_PATH
158-
159-
# Launch the app program into the booted sim
160-
TESTS_OUTPUT=`xcrun simctl launch --console booted "$BUNDLE_IDENTIFIER" 2>&1`
161-
# 2>&1 means "redirect stderr to stdout": https://stackoverflow.com/a/818284/5429648
162-
163-
echo "$TESTS_OUTPUT"
164-
165-
# Move artifacts (generated pictures) to a known path for uploading
166-
TESTS_ARTIFACTS="`xcrun simctl get_app_container booted $BUNDLE_IDENTIFIER data`/Documents/*"
167-
mkdir -p /tmp/tests_artifacts
168-
mv $TESTS_ARTIFACTS /tmp/tests_artifacts # We don't put $TESTS_ARTIFACTS in double quotes because we need path expansion
169-
170-
# We fail this workflow if the debug output contains [FAIL] (i.e. a test has failed).
171-
if [[ "$TESTS_OUTPUT" == *"[FAIL]"* ]]
172-
then exit 1
173-
fi
174-
- uses: actions/upload-artifact@v2
175-
if: always() # Run even when a previous step failed: https://stackoverflow.com/a/58859404/5429648
176-
with:
177-
name: CSharpMath.Ios.Tests Results
178-
path: /tmp/tests_artifacts
24+
- name: Install MAUI workloads
25+
run: dotnet workload restore
26+
- name: Build Everything
27+
run: dotnet build CSharpMath.sln # Newer macOS workloads may require newer Xcode versions. Update above.
28+
- name: Run Tests
29+
run: dotnet test --solution CSharpMath.sln

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
[submodule "Typography"]
22
path = Typography
33
url = https://github.com/LayoutFarm/Typography.git
4-
[submodule "Wiki"]
5-
path = CSharpMath.Wiki
6-
url = https://github.com/verybadcat/CSharpMath.wiki.git

0 commit comments

Comments
 (0)