Skip to content

Commit 387167b

Browse files
committed
Merge remote-tracking branch 'origin/main' into copilot/fix-1019
2 parents 02f992d + d5de993 commit 387167b

File tree

61 files changed

+1943
-207
lines changed

Some content is hidden

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

61 files changed

+1943
-207
lines changed

.config/dotnet-tools.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,39 @@
33
"isRoot": true,
44
"tools": {
55
"powershell": {
6-
"version": "7.5.2",
6+
"version": "7.5.4",
77
"commands": [
88
"pwsh"
99
],
1010
"rollForward": false
1111
},
1212
"dotnet-coverage": {
13-
"version": "17.14.2",
13+
"version": "18.1.0",
1414
"commands": [
1515
"dotnet-coverage"
1616
],
1717
"rollForward": false
1818
},
1919
"nbgv": {
20-
"version": "3.7.115",
20+
"version": "3.8.118",
2121
"commands": [
2222
"nbgv"
2323
],
2424
"rollForward": false
2525
},
2626
"docfx": {
27-
"version": "2.78.3",
27+
"version": "2.78.4",
2828
"commands": [
2929
"docfx"
3030
],
3131
"rollForward": false
32+
},
33+
"nerdbank.dotnetrepotools": {
34+
"version": "1.0.92",
35+
"commands": [
36+
"repo"
37+
],
38+
"rollForward": false
3239
}
3340
}
34-
}
41+
}

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Refer to https://hub.docker.com/_/microsoft-dotnet-sdk for available versions
2-
FROM mcr.microsoft.com/dotnet/sdk:9.0.304-noble@sha256:1f7ccf88e076bc1cb1ddbd81959fb55b886b01851b092867bb7a638435fa1f1f
2+
FROM mcr.microsoft.com/dotnet/sdk:9.0.306-noble@sha256:d88e637d15248531967111fba05c6725ad45ea1dace3d35d8cfe2c4d4094e25d
33

44
# Installing mono makes `dotnet test` work without errors even for net472.
55
# But installing it takes a long time, so it's excluded by default.

.github/actions/publish-artifacts/action.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,52 +14,52 @@ runs:
1414

1515
- name: 📢 Upload project.assets.json files
1616
if: always()
17-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
17+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
1818
with:
1919
name: projectAssetsJson-${{ runner.os }}
2020
path: ${{ runner.temp }}/_artifacts/projectAssetsJson
2121
continue-on-error: true
2222
- name: 📢 Upload variables
23-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
23+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
2424
with:
2525
name: variables-${{ runner.os }}
2626
path: ${{ runner.temp }}/_artifacts/Variables
2727
continue-on-error: true
2828
- name: 📢 Upload build_logs
2929
if: always()
30-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
30+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
3131
with:
3232
name: build_logs-${{ runner.os }}
3333
path: ${{ runner.temp }}/_artifacts/build_logs
3434
continue-on-error: true
3535
- name: 📢 Upload testResults
3636
if: always()
37-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
37+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
3838
with:
3939
name: testResults-${{ runner.os }}
4040
path: ${{ runner.temp }}/_artifacts/testResults
4141
continue-on-error: true
4242
- name: 📢 Upload coverageResults
4343
if: always()
44-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
44+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
4545
with:
4646
name: coverageResults-${{ runner.os }}
4747
path: ${{ runner.temp }}/_artifacts/coverageResults
4848
continue-on-error: true
4949
- name: 📢 Upload symbols
50-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
50+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
5151
with:
5252
name: symbols-${{ runner.os }}
5353
path: ${{ runner.temp }}/_artifacts/symbols
5454
continue-on-error: true
5555
- name: 📢 Upload deployables
56-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
56+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
5757
with:
5858
name: deployables-${{ runner.os }}
5959
path: ${{ runner.temp }}/_artifacts/deployables
6060
if: always()
6161
- name: 📢 Upload deployables-LKG
62-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
62+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
6363
with:
6464
name: deployables-LKG-${{ runner.os }}
6565
path: ${{ runner.temp }}/_artifacts/deployables-LKG

.github/copilot-instructions.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,55 @@
55
* Review the `CONTRIBUTING.md` file for instructions to build and test the software.
66
* Set the `NBGV_GitEngine` environment variable to `Disabled` before running any `dotnet` or `msbuild` commands.
77

8+
## Environment Setup and Shallow Clone Workaround
9+
10+
This repository uses Nerdbank.GitVersioning which depends on git history for version calculation. Since GitHub Copilot Coding Agent operates on shallow clones, you MUST set the following environment variable before running any build commands:
11+
12+
```bash
13+
export NBGV_GitEngine=Disabled
14+
```
15+
16+
**Important**: The environment variable name and value are case-sensitive. This setting:
17+
- Removes access to git history during builds
18+
- Allows builds to succeed in shallow clone environments
19+
- Results in incorrect version stamps (expected in Copilot environment)
20+
- Still generates the `ThisAssembly` class but with fewer properties
21+
22+
## Building and Testing
23+
24+
### Initial Setup
25+
1. Run the initialization script: `./init.ps1` or `pwsh ./init.ps1`
26+
2. This downloads NuGet.exe, restores packages, and sets up the build environment
27+
28+
### Building
29+
* For a complete build: `./build.ps1` or `pwsh ./build.ps1`
30+
* Ensure `NBGV_GitEngine=Disabled` is set before building
31+
* The build process first creates NuGet packages, then builds NPM packages
32+
33+
### Testing
34+
* Run all tests: `dotnet test --filter "TestCategory!=FailsInCloudTest"`
35+
* The filter excludes unstable tests that are known to fail in cloud environments
36+
* Tests use the Xunit testing framework
37+
* All tests should pass when `NBGV_GitEngine=Disabled` is set
38+
839
## Software Design
940

1041
* Design APIs to be highly testable, and all functionality should be tested.
1142
* Avoid introducing binary breaking changes in public APIs of projects under `src` unless their project files have `IsPackable` set to `false`.
43+
* Follow existing patterns in the codebase for consistency.
1244

13-
## Testing
45+
## Testing Guidelines
1446

1547
* There should generally be one test project (under the `test` directory) per shipping project (under the `src` directory). Test projects are named after the project being tested with a `.Test` suffix.
1648
* Tests should use the Xunit testing framework.
49+
* Some tests are known to be unstable. When running tests, you should skip the unstable ones by running `dotnet test --filter "TestCategory!=FailsInCloudTest"`.
50+
* Write tests that cover both happy path and edge cases.
51+
* Ensure all new functionality is covered by tests.
1752

18-
## Coding style
53+
## Coding Style
1954

2055
* Honor StyleCop rules and fix any reported build warnings *after* getting tests to pass.
2156
* In C# files, use namespace *statements* instead of namespace *blocks* for all new files.
2257
* Add API doc comments to all new public and internal members.
58+
* Follow existing code formatting and naming conventions in the repository.
59+
* Use meaningful variable and method names that clearly express intent.

.github/workflows/build.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- 'v*.*'
88
- validate/*
99
pull_request:
10+
merge_group:
1011
workflow_dispatch:
1112

1213
env:
@@ -30,7 +31,7 @@ jobs:
3031
- windows-2022
3132

3233
steps:
33-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
34+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
3435
with:
3536
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
3637
submodules: true
@@ -51,7 +52,7 @@ jobs:
5152
& .\dotnet-install.ps1 -Architecture x86 -Version 9.0.101 -InstallDir "C:\Program Files (x86)\dotnet\" -NoPath -Verbose
5253
if: runner.os == 'Windows'
5354
- name: ⚙ Install node.js
54-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
55+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
5556
with:
5657
node-version: 20.x
5758
cache: yarn
@@ -150,7 +151,7 @@ jobs:
150151
run: dotnet --info
151152

152153
- name: Download Build Artifacts
153-
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5
154+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6
154155
with:
155156
name: deployables-Windows
156157
path: deployables
@@ -240,13 +241,13 @@ jobs:
240241
repoDir: '~/git'
241242

242243
steps:
243-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
244+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
244245
with:
245246
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
246247
submodules: true
247248

248249
- name: Install .NET SDK
249-
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
250+
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # v5
250251
with:
251252
global-json-file: global.json
252253

@@ -290,7 +291,7 @@ jobs:
290291
working-directory: test/Nerdbank.GitVersioning.Benchmarks
291292

292293
- name: Publish benchmarks artifacts
293-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
294+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
294295
with:
295296
name: benchmarks-${{ matrix.os }}
296297
path: ${{ runner.temp }}/_artifacts/benchmarks
@@ -299,8 +300,8 @@ jobs:
299300
name: 📃 Docs
300301
runs-on: ubuntu-latest
301302
steps:
302-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
303+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
303304
- name: 🔗 Markup Link Checker (mlc)
304305
uses: becheran/mlc@18a06b3aa2901ca197de59c8b0b1f54fdba6b3fa # v1.0.0
305306
with:
306-
args: --do-not-warn-for-redirect-to https://learn.microsoft.com*,https://dotnet.microsoft.com/*,https://dev.azure.com/*,https://app.codecov.io/* -p docfx
307+
args: --do-not-warn-for-redirect-to https://learn.microsoft.com*,https://dotnet.microsoft.com/*,https://dev.azure.com/*,https://app.codecov.io/* -p docfx -i https://www.npmjs.com/package/*,https://get.dot.net/

.github/workflows/copilot-setup-steps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
# You can define any steps you want, and they will run before the agent starts.
2727
# If you do not check out your code, Copilot will do this for you.
2828
steps:
29-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
29+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
3030
with:
3131
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
3232
- name: ⚙ Install prerequisites

.github/workflows/docs.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@ on:
55
branches:
66
- main
77

8-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
9-
permissions:
10-
actions: read
11-
pages: write
12-
id-token: write
13-
contents: read
14-
158
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
169
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
1710
concurrency:
@@ -20,12 +13,18 @@ concurrency:
2013

2114
jobs:
2215
publish-docs:
16+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
17+
permissions:
18+
actions: read
19+
pages: write
20+
id-token: write
21+
contents: read
2322
environment:
2423
name: github-pages
2524
url: ${{ steps.deployment.outputs.page_url }}
2625
runs-on: ubuntu-latest
2726
steps:
28-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
27+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
2928
with:
3029
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
3130
- name: ⚙ Install prerequisites
@@ -35,7 +34,7 @@ jobs:
3534
name: 📚 Generate documentation
3635

3736
- name: Upload artifact
38-
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
37+
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4
3938
with:
4039
path: docfx/_site
4140

.github/workflows/libtemplate-update.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
contents: write
1818
pull-requests: write
1919
steps:
20-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
20+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
2121
with:
2222
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
2323

.github/workflows/release.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,20 @@ on:
1111

1212
run-name: ${{ github.ref_name }}
1313

14-
permissions:
15-
actions: read
16-
contents: write
17-
1814
jobs:
1915
release:
2016
runs-on: windows-latest
2117
environment: Signing
2218
permissions:
23-
id-token: write # Required for Azure CLI Login
19+
actions: read # Required to download artifacts
20+
contents: write # Upload artifacts to Release
21+
id-token: write # Required for NuGet CLI Login
2422
steps:
25-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
23+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
2624

2725
- name: ⚙️ Initialization
2826
shell: pwsh
2927
run: |
30-
if ('${{ secrets.NUGET_API_KEY }}') {
31-
Write-Host "NUGET_API_KEY secret detected. NuGet packages will be pushed."
32-
echo "NUGET_API_KEY_DEFINED=true" >> $env:GITHUB_ENV
33-
}
34-
3528
if ('${{ secrets.NPM_API_KEY }}') {
3629
Write-Host "NPM_API_KEY secret detected. NPM packages will be pushed."
3730
echo "NPM_API_KEY_DEFINED=true" >> $env:GITHUB_ENV
@@ -75,7 +68,7 @@ jobs:
7568
Echo "runid=$runid" >> $env:GITHUB_OUTPUT
7669
7770
- name: 🔻 Download deployables artifacts
78-
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5
71+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6
7972
with:
8073
name: deployables-Windows
8174
path: ${{ runner.temp }}/deployables
@@ -108,6 +101,7 @@ jobs:
108101
- name: 💽 Upload artifacts to release
109102
shell: pwsh
110103
if: ${{ github.event_name == 'release' && github.event.release.assets_url != '' }}
104+
continue-on-error: true # until we get this to work, be willing to skip it
111105
env:
112106
GH_TOKEN: ${{ github.token }}
113107
run: |
@@ -116,9 +110,14 @@ jobs:
116110
gh release -R ${{ github.repository }} upload "${{ github.ref_name }}" $_.FullName
117111
}
118112
113+
- name: 🪪 Authorize NuGet package push
114+
uses: NuGet/login@d22cc5f58ff5b88bf9bd452535b4335137e24544 # v1
115+
id: nuget-login
116+
with:
117+
user: ${{ secrets.NUGET_USER }}
118+
119119
- name: 🚀 Push NuGet packages
120-
run: dotnet nuget push ${{ runner.temp }}\deployables\*.nupkg --source https://api.nuget.org/v3/index.json -k '${{ secrets.NUGET_API_KEY }}'
121-
if: ${{ env.NUGET_API_KEY_DEFINED == 'true' }}
120+
run: dotnet nuget push ${{ runner.temp }}\deployables\*.nupkg --source https://api.nuget.org/v3/index.json -k '${{ steps.nuget-login.outputs.NUGET_API_KEY }}'
122121

123122
- name: 🚀 Push NPM packages
124123
shell: pwsh

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Trigger the pipeline by adding the `auto-release` tag on a run of your main `azu
7474

7575
## Tutorial and API documentation
7676

77-
API and hand-written docs are found under the `docfx/` directory. and are built by [docfx](https://dotnet.github.io/docfx/).
77+
API and hand-written docs are found under the `docfx/` directory and are built by [docfx](https://dotnet.github.io/docfx/).
7878

7979
You can make changes and host the site locally to preview them by switching to that directory and running the `dotnet docfx --serve` command.
8080
After making a change, you can rebuild the docs site while the localhost server is running by running `dotnet docfx` again from a separate terminal.
@@ -110,7 +110,7 @@ If Renovate is not creating pull requests when you expect it to, check that the
110110
### Maintaining your repo based on this template
111111

112112
The best way to keep your repo in sync with Library.Template's evolving features and best practices is to periodically merge the template into your repo:
113-
`
113+
114114
```ps1
115115
git fetch
116116
git checkout origin/main

0 commit comments

Comments
 (0)