Skip to content

Commit 602e3af

Browse files
devlooped-botkzu
authored andcommitted
⬆️ Bump files with dotnet-file sync
# devlooped/oss - Enhance documentation instructions for project work devlooped/oss@e616d89 - Use GH_TOKEN if available for PR devlooped/oss@77e83f2 - Make sure the feed url is available to msbuild devlooped/oss@931da83 - Publish builds should point to nuget.org not CI feed devlooped/oss@db918f0 - Move dotnet setup to composite action devlooped/oss@08c7077 - Switch to dotnet-env for .NET SDK setup devlooped/oss@56c2b85 - Improve default Product metadata, remove .git from user-facing URLs devlooped/oss@4339749 - Switch to dnx retest shorthand devlooped/oss@fddfd89 - Ensure quiet confirmation of tool download/install devlooped/oss@e11b002 - Ensure dnx run succeeds even on Windows devlooped/oss@7f5f9ee - If the OSMF eula is present, switch to its license file devlooped/oss@4b84c54 - Consider either None or Content for OSMF license patching devlooped/oss@083a37b - Ignore .env files recursively devlooped/oss@3776526 - Allow workflow to work cross-org devlooped/oss@af171b7
1 parent c1a3766 commit 602e3af

17 files changed

+342
-94
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ indent_size = 2
3030

3131
# Dotnet code style settings:
3232
[*.{cs,vb}]
33+
tab_width = 4
34+
3335
# Sort using and Import directives with System.* appearing first
3436
dotnet_sort_system_directives_first = true
3537
# Avoid "this." and "Me." if not necessary
@@ -57,6 +59,9 @@ dotnet_style_require_accessibility_modifiers = omit_if_default:error
5759
# IDE0040: Add accessibility modifiers
5860
dotnet_diagnostic.IDE0040.severity = error
5961

62+
# IDE1100: Error reading content of source file 'Project.TargetFrameworkMoniker' (i.e. from ThisAssembly)
63+
dotnet_diagnostic.IDE1100.severity = none
64+
6065
[*.cs]
6166
# Top-level files are definitely OK
6267
csharp_using_directive_placement = outside_namespace:silent

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# normalize by default
22
* text=auto encoding=UTF-8
33
*.sh text eol=lf
4+
*.sbn eol=lf
45

56
# These are windows specific files which we may as well ensure are
67
# always crlf on checkout

.github/copilot-instructions.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# .NET Repository
2+
3+
**Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.**
4+
5+
## Working Effectively
6+
7+
### Essential Build Commands
8+
- **Restore dependencies**: `dotnet restore`
9+
10+
- **Build the entire solution**: `dotnet build`
11+
12+
- **Run tests**: `dnx --yes retest`
13+
- Runs all unit tests across the solution
14+
- If tests fail due to Azure Storage, run the following commands and retry: `npm install azurite` and `npx azurite &`
15+
16+
### Build Validation and CI Requirements
17+
- **Always run before committing**:
18+
* `dnx --yes retest`
19+
* `dotnet format whitespace -v:diag --exclude ~/.nuget`
20+
* `dotnet format style -v:diag --exclude ~/.nuget`
21+
22+
### Project Structure and Navigation
23+
24+
| Directory | Description |
25+
|-----------|-------------|
26+
| `src/` | Contains the repo source code. |
27+
| `bin/` | Contains built packages (if any) |
28+
29+
### Code Style and Formatting
30+
31+
#### EditorConfig Rules
32+
The repository uses `.editorconfig` at the repo root for consistent code style.
33+
34+
- **Indentation**: 4 spaces for C# files, 2 spaces for XML/YAML/JSON
35+
- **Line endings**: LF (Unix-style)
36+
- **Sort using directives**: System.* namespaces first (`dotnet_sort_system_directives_first = true`)
37+
- **Type references**: Prefer language keywords over framework type names (`int` vs `Int32`)
38+
- **Modern C# features**: Use object/collection initializers, coalesce expressions when possible, use var when the type is apparent from the right-hand side of the assignment
39+
- **Visibility modifiers**: only explicitly specify visibility when different from the default (e.g. `public` for classes, no `internal` for classes or `private` for fields, etc.)
40+
41+
#### Formatting Validation
42+
- CI enforces formatting with `dotnet format whitespace` and `dotnet format style`
43+
- Run locally: `dotnet format whitespace --verify-no-changes -v:diag --exclude ~/.nuget`
44+
- Fix formatting: `dotnet format` (without `--verify-no-changes`)
45+
46+
### Testing Practices
47+
48+
#### Test Framework
49+
- **xUnit** for all unit and integration tests
50+
- **Moq** for mocking dependencies
51+
- Located in `src/*.Tests/`
52+
53+
#### Test Attributes
54+
Custom xUnit attributes are sometimes used for conditional test execution:
55+
- `[SecretsFact("XAI_API_KEY")]` - Skips test if required secrets are missing from user secrets or environment variables
56+
- `[LocalFact("SECRET")]` - Runs only locally (skips in CI), requires specified secrets
57+
- `[CIFact]` - Runs only in CI environment
58+
59+
### Dependency Management
60+
61+
#### Adding Dependencies
62+
- Add to appropriate `.csproj` file
63+
- Run `dotnet restore` to update dependencies
64+
- Ensure version consistency across projects where applicable
65+
66+
#### CI/CD Pipeline
67+
- **Build workflow**: `.github/workflows/build.yml` - runs on PR and push to main/rel/feature branches
68+
- **Publish workflow**: Publishes to Sleet feed when `SLEET_CONNECTION` secret is available
69+
- **OS matrix**: Configured in `.github/workflows/os-matrix.json` (defaults to ubuntu-latest)
70+
71+
### Special Files and Tools
72+
73+
#### dnx Command
74+
- **Purpose**: built-in tool for running arbitrary dotnet tools that are published on nuget.org. `--yes` auto-confirms install before run.
75+
- **Example**: `dnx --yes retest` - runs tests with automatic retry on transient failures (retest being a tool package published at https://www.nuget.org/packages/retest)
76+
- **In CI**: `dnx --yes retest -- --no-build` (skips build, runs tests only)
77+
78+
#### Directory.Build.rsp
79+
- MSBuild response file with default build arguments
80+
- `-nr:false` - disables node reuse
81+
- `-m:1` - single-threaded build (for stability)
82+
- `-v:m` - minimal verbosity
83+
84+
#### Code Quality
85+
- All PRs must pass format validation
86+
- Tests must pass on all target frameworks
87+
- Follow existing patterns and conventions in the codebase
88+
89+
## Documenting Work
90+
91+
Project implemention details, design and key decisions should be documented in a top-level AGENTS.md file at the repo root.
92+
Keep this file updated whenever you make change significant changes for future reference.
93+
94+
User-facing features and APIs should be documented to highlight (not extensively, as an overview) key project features and capabilities, in the readme.md file at the repo root.

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ updates:
2424
Extensions:
2525
patterns:
2626
- "Microsoft.Extensions*"
27+
exclude-patterns:
28+
- "Microsoft.Extensions.AI*"
29+
ExtensionsAI:
30+
patterns:
31+
- "Microsoft.Extensions.AI*"
2732
Web:
2833
patterns:
2934
- "Microsoft.AspNetCore*"
@@ -38,3 +43,6 @@ updates:
3843
ProtoBuf:
3944
patterns:
4045
- "protobuf-*"
46+
Spectre:
47+
patterns:
48+
- "Spectre.Console*"

.github/workflows/build.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
- Release
1313
- Debug
1414
push:
15-
branches: [ main, dev, 'dev/*', 'feature/*', 'rel/*' ]
15+
branches: [ main, 'feature/*', 'rel/*' ]
1616
paths-ignore:
1717
- changelog.md
1818
- readme.md
@@ -28,6 +28,7 @@ env:
2828
GH_TOKEN: ${{ secrets.GH_TOKEN }}
2929
MSBUILDTERMINALLOGGER: auto
3030
Configuration: ${{ github.event.inputs.configuration || 'Release' }}
31+
SLEET_FEED_URL: ${{ vars.SLEET_FEED_URL }}
3132

3233
defaults:
3334
run:
@@ -65,20 +66,14 @@ jobs:
6566
fetch-depth: 0
6667

6768
- name: ⚙ dotnet
68-
uses: actions/setup-dotnet@v4
69-
with:
70-
dotnet-version: |
71-
6.x
72-
8.x
73-
9.x
69+
uses: devlooped/actions-dotnet-env@v1
7470

7571
- name: 🙏 build
7672
run: dotnet build -m:1 -bl:build.binlog
7773

7874
- name: 🧪 test
79-
run: |
80-
dotnet tool update -g dotnet-retest
81-
dotnet retest -- --no-build
75+
shell: pwsh
76+
run: dnx --yes retest -- --no-build
8277

8378
- name: 🐛 logs
8479
uses: actions/upload-artifact@v4
@@ -104,6 +99,9 @@ jobs:
10499
submodules: recursive
105100
fetch-depth: 0
106101

102+
- name: ⚙ dotnet
103+
uses: devlooped/actions-dotnet-env@v1
104+
107105
- name: ✓ ensure format
108106
run: |
109107
dotnet format whitespace --verify-no-changes -v:diag --exclude ~/.nuget

.github/workflows/dotnet-env.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: dotnet-env
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- '**/*.*proj'
9+
10+
jobs:
11+
which-dotnet:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
17+
steps:
18+
- name: 🤖 defaults
19+
uses: devlooped/actions-bot@v1
20+
with:
21+
name: ${{ secrets.BOT_NAME }}
22+
email: ${{ secrets.BOT_EMAIL }}
23+
gh_token: ${{ secrets.GH_TOKEN }}
24+
github_token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: 🤘 checkout
27+
uses: actions/checkout@v4
28+
with:
29+
token: ${{ env.GH_TOKEN }}
30+
31+
- name: 🤌 dotnet
32+
uses: devlooped/actions-which-dotnet@v1
33+
34+
- name: ✍ pull request
35+
uses: peter-evans/create-pull-request@v7
36+
with:
37+
base: main
38+
branch: which-dotnet
39+
delete-branch: true
40+
labels: dependencies
41+
title: "⚙ Update dotnet versions"
42+
body: "Update dotnet versions"
43+
commit-message: "Update dotnet versions"
44+
token: ${{ env.GH_TOKEN }}

.github/workflows/dotnet-file-core.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
name: dotnet-file-core
33
on:
44
workflow_call:
5+
secrets:
6+
BOT_NAME:
7+
required: false
8+
BOT_EMAIL:
9+
required: false
10+
GH_TOKEN:
11+
required: false
512

613
env:
714
DOTNET_NOLOGO: true
@@ -40,13 +47,19 @@ jobs:
4047
# if we don't have at least 100 requests left, wait until reset
4148
if ($rate.remaining -lt 10) {
4249
$wait = ($rate.reset - (Get-Date (Get-Date).ToUniversalTime() -UFormat %s))
43-
echo "Rate limit remaining is $($rate.remaining), waiting for $($wait / 1000) seconds to reset"
50+
if ($wait -gt 300) {
51+
echo "Rate limit remaining is $($rate.remaining), reset in $wait seconds (more than 5'). Aborting."
52+
exit 1
53+
}
54+
echo "Rate limit remaining is $($rate.remaining), waiting $wait seconds to reset"
4455
sleep $wait
4556
$rate = gh api rate_limit | convertfrom-json | select -expandproperty rate
4657
echo "Rate limit has reset to $($rate.remaining) requests"
4758
}
4859
4960
- name: 🔄 sync
61+
env:
62+
GCM_CREDENTIAL_STORE: cache
5063
run: |
5164
dotnet tool update -g dotnet-gcm
5265
# store credentials in plaintext for linux compat
@@ -56,7 +69,7 @@ jobs:
5669
5770
dotnet tool update -g dotnet-file
5871
$changelog = "$([System.IO.Path]::GetTempPath())dotnet-file.md"
59-
dotnet file sync -c:$changelog
72+
dotnet file sync -c:$changelog --init https://github.com/devlooped/oss/blob/main/.netconfig
6073
if (test-path $changelog) {
6174
echo 'CHANGES<<EOF' >> $env:GITHUB_ENV
6275
cat $changelog >> $env:GITHUB_ENV
@@ -72,7 +85,7 @@ jobs:
7285
validate: false
7386

7487
- name: ✍ pull request
75-
uses: peter-evans/create-pull-request@v7
88+
uses: peter-evans/create-pull-request@v8
7689
with:
7790
base: main
7891
branch: dotnet-file-sync

.github/workflows/dotnet-file.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,10 @@ env:
1212

1313
jobs:
1414
run:
15+
permissions:
16+
contents: write
1517
uses: devlooped/oss/.github/workflows/dotnet-file-core.yml@main
16-
secrets: inherit
18+
secrets:
19+
BOT_NAME: ${{ secrets.BOT_NAME }}
20+
BOT_EMAIL: ${{ secrets.BOT_EMAIL }}
21+
GH_TOKEN: ${{ secrets.GH_TOKEN }}

.github/workflows/includes.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ on:
55
branches:
66
- 'main'
77
paths:
8-
- '**.md'
8+
- '**.md'
99
- '!changelog.md'
10+
- 'osmfeula.txt'
1011

1112
jobs:
1213
includes:
@@ -31,14 +32,33 @@ jobs:
3132
- name: +Mᐁ includes
3233
uses: devlooped/actions-includes@v1
3334

35+
- name: 📝 OSMF EULA
36+
shell: pwsh
37+
run: |
38+
$file = "osmfeula.txt"
39+
$props = "src/Directory.Build.props"
40+
if (-not (test-path $file) -or -not (test-path $props)) {
41+
exit 0
42+
}
43+
44+
$product = dotnet msbuild $props -getproperty:Product
45+
if (-not $product) {
46+
write-error 'To use OSMF EULA, ensure the $(Product) property is set in Directory.props'
47+
exit 1
48+
}
49+
50+
((get-content -raw $file) -replace '\$product\$',$product).trim() | set-content $file
51+
3452
- name: ✍ pull request
35-
uses: peter-evans/create-pull-request@v6
53+
uses: peter-evans/create-pull-request@v8
3654
with:
37-
add-paths: '**.md'
55+
add-paths: |
56+
**.md
57+
*.txt
3858
base: main
3959
branch: markdown-includes
4060
delete-branch: true
41-
labels: docs
61+
labels: dependencies
4262
author: ${{ env.BOT_AUTHOR }}
4363
committer: ${{ env.BOT_AUTHOR }}
4464
commit-message: +Mᐁ includes

.github/workflows/publish.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ env:
1515
VersionLabel: ${{ github.ref }}
1616
GH_TOKEN: ${{ secrets.GH_TOKEN }}
1717
MSBUILDTERMINALLOGGER: auto
18-
18+
SLEET_FEED_URL: https://api.nuget.org/v3/index.json
19+
1920
jobs:
2021
publish:
2122
runs-on: ${{ vars.PUBLISH_AGENT || 'ubuntu-latest' }}
@@ -27,20 +28,14 @@ jobs:
2728
fetch-depth: 0
2829

2930
- name: ⚙ dotnet
30-
uses: actions/setup-dotnet@v4
31-
with:
32-
dotnet-version: |
33-
6.x
34-
8.x
35-
9.x
31+
uses: devlooped/actions-dotnet-env@v1
3632

3733
- name: 🙏 build
3834
run: dotnet build -m:1 -bl:build.binlog
3935

4036
- name: 🧪 test
41-
run: |
42-
dotnet tool update -g dotnet-retest
43-
dotnet retest -- --no-build
37+
shell: pwsh
38+
run: dnx --yes retest -- --no-build
4439

4540
- name: 🐛 logs
4641
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)