Skip to content

Commit f549040

Browse files
committed
merged from upstream
2 parents ab3402b + 5db5782 commit f549040

File tree

278 files changed

+30990
-39
lines changed

Some content is hidden

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

278 files changed

+30990
-39
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Criteria for adding quantities and units
2+
3+
Related wiki page: https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit#a-quantity-is-a-good-fit-to-add-if-it
4+
5+
To avoid bloating the library, we want to ensure quantities and units are widely used and well defined.
6+
Avoid little used units that are obscure or too domain specific.
7+
Ask for justification and use cases if this is not clear.
8+
9+
### A quantity is a good fit to add, if it
10+
11+
- [x] Is well documented and unambiguous, e.g. has a wiki page and generally easy to find on Google
12+
- [x] Is widely used, preferably across domains
13+
- [x] Has multiple units to convert between (e.g. `Length` has kilometer, feet, nanometer etc.)
14+
- [x] Can convert to other quantities (e.g. `Length x Length = Area`)
15+
- [x] Can be represented by a `double` numeric value, integer values are not well supported and may suffer from precision errors
16+
- [x] Is not [dimensionless/unitless](https://en.wikipedia.org/wiki/Dimensionless_quantity) (consider using `Ratio`)
17+
18+
### A unit is a good fit to add to a quantity, if it
19+
20+
- [x] Is well documented and unambiguous, e.g. has a wiki page or found in online unit converters
21+
- [x] Is widely used
22+
- [x] Can be converted to other units of the same quantity
23+
- [x] The conversion function is well established without ambiguous competing standards
24+
25+
### Avoid X-per-Y units
26+
27+
There are many variations of unit A over unit B, such as `LengthPerAngle` and we want to avoid adding these unless they are very common.

.github/workflows/ci.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: CI Build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- 'release/**'
8+
- 'maintenance/**'
9+
paths-ignore:
10+
- '**/*.png'
11+
- '**/*.md'
12+
workflow_dispatch:
13+
14+
env:
15+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
16+
DOTNET_CLI_TELEMETRY_OPTOUT: true
17+
18+
jobs:
19+
build-and-test:
20+
name: Build & Test
21+
runs-on: windows-latest
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 1
28+
lfs: true
29+
30+
- name: Setup .NET SDK
31+
uses: actions/setup-dotnet@v4
32+
with:
33+
dotnet-version: |
34+
6.0.x
35+
8.0.x
36+
37+
- name: Setup .NET nanoFramework build components
38+
uses: nanoframework/nanobuild@v1
39+
with:
40+
workload: 'nanoFramework'
41+
42+
- name: Build, Test and Pack
43+
shell: pwsh
44+
run: |
45+
./Build/build.ps1 -IncludeNanoFramework
46+
working-directory: ${{ github.workspace }}
47+
48+
- name: Upload to codecov.io
49+
shell: pwsh
50+
env:
51+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
52+
run: |
53+
Write-Host -Foreground Green "Downloading codecov binaries..."
54+
55+
Invoke-WebRequest -Uri https://uploader.codecov.io/verification.gpg -OutFile codecov.asc
56+
gpg.exe --import codecov.asc
57+
58+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe
59+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM -Outfile codecov.exe.SHA256SUM
60+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM.sig -Outfile codecov.exe.SHA256SUM.sig
61+
62+
gpg.exe --verify codecov.exe.SHA256SUM.sig codecov.exe.SHA256SUM
63+
If ($(Compare-Object -ReferenceObject $(($(certUtil -hashfile codecov.exe SHA256)[1], "codecov.exe") -join " ") -DifferenceObject $(Get-Content codecov.exe.SHA256SUM)).length -eq 0) { echo "SHASUM verified" } Else {exit 1}
64+
65+
Write-Host -Foreground Green "Uploading to codecov..."
66+
67+
.\codecov.exe --dir "Artifacts/Coverage" -t "$env:CODECOV_TOKEN" --build "${{ github.run_number }}"
68+
69+
Write-Host -Foreground Green "✅ Uploaded to codecov."
70+
71+
- name: Upload Artifacts
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: artifacts
75+
path: Artifacts/
76+
retention-days: 30
77+
78+
- name: Upload NuGet packages
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: nuget-packages
82+
path: |
83+
Artifacts/**/*.nupkg
84+
Artifacts/**/*.snupkg
85+
retention-days: 30
86+
87+
publish-nuget:
88+
name: Publish to NuGet
89+
needs: build-and-test
90+
runs-on: ubuntu-latest
91+
if: github.ref == 'refs/heads/master' && github.repository_owner == 'angularsen'
92+
environment: Publish
93+
94+
steps:
95+
- name: Download NuGet packages
96+
uses: actions/download-artifact@v4
97+
with:
98+
name: nuget-packages
99+
path: nugets
100+
101+
- name: Setup .NET SDK
102+
uses: actions/setup-dotnet@v4
103+
with:
104+
dotnet-version: 8.0.x
105+
106+
- name: Push to nuget.org
107+
run: |
108+
dotnet nuget push "**/*.nupkg" --skip-duplicate --api-key ${{ secrets.NUGET_ORG_APIKEY }} --source https://api.nuget.org/v3/index.json
109+
working-directory: nugets
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Claude Code Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
# Optional: Only run on specific file changes
7+
# paths:
8+
# - "src/**/*.ts"
9+
# - "src/**/*.tsx"
10+
# - "src/**/*.js"
11+
# - "src/**/*.jsx"
12+
13+
jobs:
14+
claude-review:
15+
# Optional: Filter by PR author
16+
# if: |
17+
# github.event.pull_request.user.login == 'external-contributor' ||
18+
# github.event.pull_request.user.login == 'new-developer' ||
19+
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20+
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
pull-requests: read
25+
issues: read
26+
id-token: write
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 1
33+
34+
- name: Run Claude Code Review
35+
id: claude-review
36+
uses: anthropics/claude-code-action@v1
37+
with:
38+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39+
prompt: |
40+
Please review this pull request and provide feedback on:
41+
- Breaking changes, if any
42+
- Style and conventions
43+
- New quantities or units
44+
- See `.claude/pr-review-instructions.md` for guidance and criteria, they should be widely used and well defined
45+
- If it seems domain specific or obscure we ask for justification and use cases
46+
- Changes to generated code
47+
- Focus feedback on changes to code generators
48+
- Tie feedback to specific examples from generated code to explain, try to pick 1-3 quantities of different types, e.g. `Length` (`ILinearQuantity`), `Temperature` (`IAffineQuantity`) and `Level` (`ILogarithmicQuantity`)
49+
- Code quality and best practices
50+
- Potential bugs or issues
51+
- Performance considerations
52+
- Test coverage
53+
- Security concerns, but only if medium or higher severity
54+
55+
Use the repository's CLAUDE.md for guidance on style and conventions.
56+
Be constructive and helpful in your feedback, keep it concise.
57+
58+
Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
59+
60+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
61+
# or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options
62+
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
63+

.github/workflows/claude.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Claude Code
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
issues:
9+
types: [opened, assigned]
10+
pull_request_review:
11+
types: [submitted]
12+
13+
jobs:
14+
claude:
15+
if: |
16+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
pull-requests: read
24+
issues: read
25+
id-token: write
26+
actions: read # Required for Claude to read CI results on PRs
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 1
32+
33+
- name: Run Claude Code
34+
id: claude
35+
uses: anthropics/claude-code-action@v1
36+
with:
37+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38+
39+
# This is an optional setting that allows Claude to read CI results on PRs
40+
additional_permissions: |
41+
actions: read
42+
43+
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
44+
# prompt: 'Update the pull request description to include a summary of changes.'
45+
46+
# Optional: Add claude_args to customize behavior and configuration
47+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
48+
# or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options
49+
# claude_args: '--model claude-opus-4-1-20250805 --allowed-tools Bash(gh pr:*)'
50+

.github/workflows/pr.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: PR Build
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
- 'release/**'
8+
- 'maintenance/**'
9+
paths-ignore:
10+
- '*.md'
11+
- '*.png'
12+
- '*.gitignore'
13+
14+
env:
15+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
16+
DOTNET_CLI_TELEMETRY_OPTOUT: true
17+
18+
jobs:
19+
build-and-test:
20+
name: Build & Test
21+
runs-on: windows-latest
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 1
28+
lfs: true
29+
30+
- name: Setup .NET SDK
31+
uses: actions/setup-dotnet@v4
32+
with:
33+
dotnet-version: |
34+
6.0.x
35+
8.0.x
36+
37+
- name: Setup .NET nanoFramework build components
38+
uses: nanoframework/nanobuild@v1
39+
with:
40+
workload: 'nanoFramework'
41+
42+
- name: Build, Test and Pack
43+
shell: pwsh
44+
run: |
45+
./Build/build.ps1 -IncludeNanoFramework
46+
working-directory: ${{ github.workspace }}
47+
48+
- name: Upload Test Results
49+
uses: actions/upload-artifact@v4
50+
if: always()
51+
with:
52+
name: test-results
53+
path: Artifacts/TestResults/*.trx
54+
retention-days: 7
55+
56+
- name: Publish Test Results
57+
uses: EnricoMi/publish-unit-test-result-action/windows@v2
58+
if: always()
59+
with:
60+
files: |
61+
Artifacts/TestResults/*.trx
62+
check_name: Test Results
63+
comment_mode: off
64+
65+
- name: Upload to codecov.io
66+
shell: pwsh
67+
env:
68+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
69+
run: |
70+
Write-Host -Foreground Green "Downloading codecov binaries..."
71+
72+
Invoke-WebRequest -Uri https://uploader.codecov.io/verification.gpg -OutFile codecov.asc
73+
gpg.exe --import codecov.asc
74+
75+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe
76+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM -Outfile codecov.exe.SHA256SUM
77+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM.sig -Outfile codecov.exe.SHA256SUM.sig
78+
79+
gpg.exe --verify codecov.exe.SHA256SUM.sig codecov.exe.SHA256SUM
80+
If ($(Compare-Object -ReferenceObject $(($(certUtil -hashfile codecov.exe SHA256)[1], "codecov.exe") -join " ") -DifferenceObject $(Get-Content codecov.exe.SHA256SUM)).length -eq 0) { echo "SHASUM verified" } Else {exit 1}
81+
82+
Write-Host -Foreground Green "Uploading to codecov..."
83+
84+
.\codecov.exe --dir "Artifacts/Coverage" -t "$env:CODECOV_TOKEN" --build "${{ github.run_number }}"
85+
86+
Write-Host -Foreground Green "✅ Uploaded to codecov."
87+
88+
- name: Upload Artifacts
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: artifacts
92+
path: Artifacts/
93+
retention-days: 7

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,6 @@ Artifacts
259259
# Build server tooling
260260
/secure-file
261261
/.tools/
262+
263+
# Claude Code assistant
264+
.claude/settings.local.json

0 commit comments

Comments
 (0)