Skip to content

Commit 261dab4

Browse files
authored
Merge pull request #1127 from dotnet/dev/andarno/libtemplateUpdate
Merge Library.Template into v2.13
2 parents 5fe6220 + 4c6633a commit 261dab4

46 files changed

Lines changed: 4026 additions & 224 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
name: bundle-dependency-prs
3+
description: Fix broken dependency update PRs and aggregate the ones that work into one PR.
4+
disable-model-invocation: true
5+
---
6+
7+
# Instructions
8+
9+
You have two goals:
10+
11+
1. Get all dependency PRs to a state where their PR checks pass.
12+
2. Aggregate dependency PRs with passing checks into just one PR.
13+
14+
You can identify dependency update PRs by those authored by `dependabot` or `renovate`.
15+
16+
You'll find instructions for building and validating the repo in the [CONTRIBUTING.md](../../../CONTRIBUTING.md) doc.
17+
Always validate your changes locally before pushing them to the remote repository.
18+
19+
When writing PR bodies or comments, avoid unmatched markdown code fences. Keep markdown well-formed.
20+
21+
For purposes of assessing PR readiness by its PR checks, consider docfx related checks to be irrelevant.
22+
If a docfx check fails but all other checks succeed, then that is a 'successful' dependency update PR.
23+
24+
## Fix up dependency PRs with failing checks
25+
26+
Before aggregating PRs, first try to fix any individual dependency update PRs with failing build/test checks.
27+
28+
1. For the dependency PRs with failing build or test PR checks, check out their source branch and fix any issues.
29+
2. Push your fixes as fresh commits to the individual dependency PRs.
30+
3. If you can't fix a particular PR, add a comment to the PR describing your attempt and outcome.
31+
32+
## Group dependency PRs that are ready to go
33+
34+
Your next goal is to collect all the dependency updates that are ready to go into a single PR.
35+
36+
1. Prepare a local branch called `bulkDepUpdates`.
37+
1. Consider that a remote branch by the same name may already exist. If it does, base your local branch on it.
38+
2. Merge `origin/main` into this branch.
39+
3. Resolve any conflicts.
40+
2. For the dependency PRs whose build and test PR checks already pass, merge them into the `bulkDepUpdates` branch.
41+
Consider that your local branch may have already merged an equivalent PR in the past (from a past run). If so, you should skip merging that PR.
42+
Resolve any conflicts.
43+
Build and run tests to validate your branch.
44+
3. Push the branch.
45+
4. Create a PR, if one does not already exist.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
name: update-library-template
3+
description: Merges the latest Library.Template into this repo (at position of HEAD) and resolves conflicts.
4+
disable-model-invocation: true
5+
---
6+
7+
# Instructions
8+
9+
1. Run `./tools/MergeFrom-Template.ps1` from the repo root.
10+
2. Resolve merge conflicts, taking into account conflict resolution policy below.
11+
3. Validate the changes, as described in the validation section below.
12+
4. Committing your changes (if applicable).
13+
14+
## Conflict resolution policy
15+
16+
There may be [special notes](template-release-notes.md) that describe special considerations for certain files or scenarios to help you resolve conflicts appropriately.
17+
Always refer to that file before proceeding.
18+
In particular, focus on the *incoming* part of the file, since it represents the changes from the Library.Template that you are merging into your repo.
19+
20+
Also consider that some repos choose to reject certain Library.Template patterns.
21+
For example the template uses MTPv2 for test projects, but a repo might have chosen not to adopt that.
22+
When resolving merge conflicts, consider whether it looks like the relevant code file is older than it should be given the changes the template is bringing in.
23+
Ask the user when in doubt as to whether the conflict should be resolved in favor of 'catching up' with the template or keeping the current changes.
24+
25+
Use #runSubagent to analyze and resolve merge conflicts across files in parallel.
26+
27+
### Keep Current files
28+
29+
Conflicts in the following files should always be resolved by keeping the current version (i.e. discard incoming changes):
30+
31+
* README.md
32+
33+
### Deleted files
34+
35+
Very typically, when the incoming change is to a file that was deleted locally, the correct resolution is to re-delete the file.
36+
37+
In some cases however, the deleted file may have incoming changes that should be applied to other files.
38+
The `test/Library.Tests/Library.Tests.csproj` file is very typical of this.
39+
Changes to this file should very typically be applied to any and all test projects in the repo.
40+
You are responsible for doing this in addition to re-deleting this template file.
41+
42+
## Validation
43+
44+
Validate the merge result (after resolving any conflicts, if applicable).
45+
Use #runSubagent for each step.
46+
47+
1. Verify that `dotnet restore` succeeds. Fix any issues that come up.
48+
2. Verify that `dotnet build` succeeds.
49+
3. Verify that tests succeed by running `tools/dotnet-test-cloud.ps1`.
50+
51+
While these validations are described using `dotnet` CLI commands, some repos require using full msbuild.exe.
52+
You can detect this by checking the `azure-pipelines/dotnet.yml` or `.github/workflows/build.yml` files for use of one or the other tool.
53+
54+
You are *not* responsible for fixing issues that the merge did not cause.
55+
If validation fails for reasons that seem unrelated to the changes brought in by the merge, advise the user and ask how they'd like you to proceed.
56+
That said, sometimes merges will bring in SDK or dependency updates that can cause breaks in seemingly unrelated areas.
57+
In such cases, you should investigate and solve the issues as needed.
58+
59+
## Committing your changes
60+
61+
If you have to make any changes for validations to pass, consider whether they qualify as a bad merge conflict resolution or more of a novel change that you're making to work with the Library.Template update.
62+
Merge conflict resolution fixes ideally get amended into the merge commit, while novel changes would go into a novel commit after the merge commit.
63+
64+
Always author your commits using `git commit --author "🤖 Copilot <no-reply@github.com>"` (and possibly other parameters).
65+
Describe the nature of the merge conflicts you encountered and how you resolved them in your commit message.
66+
67+
Later, if asked to review pull request validation breaks, always author a fresh commit with each fix that you push, unless the user directs you to do otherwise.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Template release notes
2+
3+
This file will describe significant changes in Library.Template as they are introduced, especially if they require special consideration when merging updates into existing repos.
4+
This file is referenced by update-library-template.prompt.md and should remain in place to facilitate future merges, whether done manually or by AI.
5+
6+
## Solution rename
7+
8+
Never leave a Library.slnx file in the repository.
9+
You might even see one there even though this particular merge didn't bring it in.
10+
This can be an artifact of having renamed Library.sln to Library.slnx in the template repo, but ultimately the receiving repo should have only one .sln or .slnx file, with a better name than `Library`.
11+
Delete any `Library.slnx` that you see.
12+
Migrate an `.sln` in the repo root to `.slnx` using this command:
13+
14+
```ps1
15+
dotnet solution EXISTING.sln migrate
16+
```
17+
18+
This will create an EXISTING.slnx file. `git add` that file, then `git rm` the old `.sln` file.
19+
Sometimes a repo will reference the sln filename in a script or doc somewhere.
20+
Search the repo for such references and update them to the slnx file.

.config/dotnet-tools.json

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,46 @@
33
"isRoot": true,
44
"tools": {
55
"powershell": {
6-
"version": "7.5.2",
6+
"version": "7.6.4",
77
"commands": [
88
"pwsh"
99
],
1010
"rollForward": false
1111
},
1212
"dotnet-coverage": {
13-
"version": "17.14.2",
13+
"version": "18.9.0",
1414
"commands": [
1515
"dotnet-coverage"
1616
],
1717
"rollForward": false
1818
},
1919
"nbgv": {
20-
"version": "3.7.115",
20+
"version": "3.10.91",
2121
"commands": [
2222
"nbgv"
2323
],
2424
"rollForward": false
2525
},
2626
"docfx": {
27-
"version": "2.78.3",
27+
"version": "2.78.5",
2828
"commands": [
2929
"docfx"
3030
],
3131
"rollForward": false
32+
},
33+
"nerdbank.dotnetrepotools": {
34+
"version": "1.5.15",
35+
"commands": [
36+
"repo"
37+
],
38+
"rollForward": false
39+
},
40+
"dotnet-symbol": {
41+
"version": "9.0.661903",
42+
"commands": [
43+
"dotnet-symbol"
44+
],
45+
"rollForward": false
3246
}
3347
}
3448
}

.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:0b7186a7247bf8c07085fd700613bb0425a6f8f6467a0342c12a535e767da803
2+
FROM mcr.microsoft.com/dotnet/sdk:10.0.302@sha256:ed034a8bf0b24ded0cbbac07e17825d8e9ebfe21e308191d0f7421eaf5ad4664
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/Prime-ForCopilot.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
if ((git -C $PSScriptRoot rev-parse --is-shallow-repository) -eq 'true')
2+
{
3+
Write-Host "Shallow clone detected, disabling NBGV Git engine so the build can succeed."
4+
$env:NBGV_GitEngine='Disabled'
5+
}

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

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

1515
- name: 📢 Upload project.assets.json files
1616
if: always()
17-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
17+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
5757
with:
5858
name: deployables-${{ runner.os }}
5959
path: ${{ runner.temp }}/_artifacts/deployables

.github/copilot-instructions.md

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

.github/renovate.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
33
"extends": [
44
"config:best-practices",
5-
"github>microsoft/vs-renovate-presets:dotnet_packages_below(9)"
5+
"github>microsoft/vs-renovate-presets:dotnet_packages_LTS"
66
],
77
"semanticCommits": "disabled",
88
"labels": ["dependencies"],
@@ -15,6 +15,10 @@
1515
"matchPackageNames": ["xunit*"],
1616
"groupName": "xunit"
1717
},
18+
{
19+
"matchPackageNames": ["Microsoft.Testing.Extensions.*"],
20+
"groupName": "Microsoft Testing Platform"
21+
},
1822
{
1923
"matchDatasources": ["dotnet-version", "docker"],
2024
"matchDepNames": ["dotnet-sdk", "mcr.microsoft.com/dotnet/sdk"],

.github/workflows/build.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ on:
1212
env:
1313
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
1414
BUILDCONFIGURATION: Release
15-
# codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/
1615
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages/
1716

1817
jobs:
@@ -24,21 +23,21 @@ jobs:
2423
fail-fast: false
2524
matrix:
2625
include:
27-
- os: ubuntu-22.04
26+
- os: ubuntu-24.04
2827
rid: linux
29-
- os: macos-14
28+
- os: macOS-15
3029
rid: osx
31-
- os: windows-2022
30+
- os: windows-2025
3231
rid: win
3332

3433
steps:
35-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
34+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3635
with:
3736
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
3837
submodules: true
3938
- name: ⚙ Install prerequisites
4039
run: |
41-
./init.ps1 -UpgradePrerequisites
40+
./init.ps1 -UpgradePrerequisites -NoNuGetCredProvider
4241
dotnet --info
4342
4443
# Print mono version if it is present.
@@ -91,18 +90,20 @@ jobs:
9190
uses: ./.github/actions/publish-artifacts
9291
if: cancelled() == false
9392
- name: 📢 Publish code coverage results to codecov.io
94-
run: ./tools/publish-CodeCov.ps1 -CodeCovToken "${{ env.codecov_token }}" -PathToCodeCoverage "${{ runner.temp }}/_artifacts/coverageResults" -Name "${{ runner.os }} Coverage Results" -Flags "${{ runner.os }}"
93+
run: |
94+
if ('${{ secrets.CODECOV_TOKEN }}') {
95+
./tools/publish-CodeCov.ps1 -CodeCovToken '${{ secrets.CODECOV_TOKEN }}' -PathToCodeCoverage "${{ runner.temp }}/_artifacts/coverageResults" -Name "${{ runner.os }} Coverage Results" -Flags "${{ runner.os }}"
96+
}
9597
shell: pwsh
9698
timeout-minutes: 3
9799
continue-on-error: true
98-
if: env.codecov_token != ''
99100

100101
docs:
101102
name: 📃 Docs
102103
runs-on: ubuntu-latest
103104
steps:
104-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
105+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
105106
- name: 🔗 Markup Link Checker (mlc)
106-
uses: becheran/mlc@18a06b3aa2901ca197de59c8b0b1f54fdba6b3fa # v1.0.0
107+
uses: becheran/mlc@7ec24825cefe0c9c8c6bac48430e1f69e3ec356e # v1.2.0
107108
with:
108-
args: --do-not-warn-for-redirect-to https://learn.microsoft.com*,https://dotnet.microsoft.com/*,https://dev.azure.com/*,https://app.codecov.io/*,https://www.gitsponsors.com/ -p docfx,ext
109+
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,ext -i https://www.npmjs.com/package/*,https://get.dot.net/

0 commit comments

Comments
 (0)