Skip to content

Commit 9063bf4

Browse files
committed
sync with diff-common.sh
1 parent c36963c commit 9063bf4

19 files changed

+706
-52
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# *TODO*. This workflow must be in the ./.github directory of the repository!
2+
version: 2
3+
updates:
4+
# Update NuGet packages
5+
- package-ecosystem: "nuget"
6+
directory: "/"
7+
schedule:
8+
interval: "weekly"
9+
day: "monday"
10+
time: "06:00"
11+
timezone: "America/New_York"
12+
open-pull-requests-limit: 10
13+
14+
# Group minor and patch updates together
15+
groups:
16+
minor-and-patch:
17+
patterns:
18+
- "*"
19+
update-types:
20+
- "minor"
21+
- "patch"
22+
23+
# Review major updates separately
24+
ignore:
25+
- dependency-name: "*"
26+
update-types: ["version-update:semver-major"]
27+
28+
commit-message:
29+
prefix: "deps"
30+
include: "scope"
31+
32+
labels:
33+
- "dependencies"
34+
- "automated"
35+
36+
# Also update GitHub Actions
37+
- package-ecosystem: "github-actions"
38+
directory: "/"
39+
schedule:
40+
interval: "weekly"
41+
commit-message:
42+
prefix: "ci"
43+
labels:
44+
- "github-actions"
45+
- "automated"

templates/AddNewPackage/content/.github/workflows/CI.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ jobs:
9595
9696
# Set the outputs:
9797
{
98-
echo "build-projects=${build_projects}"
99-
echo "test-projects=${test_projects}"
100-
echo "benchmark-projects=${benchmark_projects}"
101-
echo "os=${os}"
102-
echo "preprocessor-symbols=${preprocessor_symbols}"
103-
echo "dotnet-version=${dotnet_version}"
104-
echo "configuration=${configuration}"
105-
echo "min-coverage-pct=${min_coverage_pct}"
106-
echo "max-regression-pct=${max_regression_pct}"
98+
echo "build-projects=${build_projects}"
99+
echo "test-projects=${test_projects}"
100+
echo "benchmark-projects=${benchmark_projects}"
101+
echo "os=${os}"
102+
echo "preprocessor-symbols=${preprocessor_symbols}"
103+
echo "dotnet-version=${dotnet_version}"
104+
echo "configuration=${configuration}"
105+
echo "min-coverage-pct=${min_coverage_pct}"
106+
echo "max-regression-pct=${max_regression_pct}"
107107
} >> $GITHUB_OUTPUT
108108
109109
call-ci:

templates/AddNewPackage/content/.github/workflows/Prerelease.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ jobs:
6969
} >> $GITHUB_OUTPUT
7070
7171
log-trigger:
72+
name: Log manual trigger reason
7273
if: github.event_name == 'workflow_dispatch'
7374
runs-on: ubuntu-latest
7475
steps:
@@ -83,9 +84,10 @@ jobs:
8384
- get-params
8485
uses: vmelamed/vm2.DevOps/.github/workflows/_prerelease.yaml@main
8586
secrets:
87+
# You don't need all three secrets, only the one corresponding to the chosen NuGet server in inputs.nuget-server or the default 'github'
88+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
8689
NUGET_API_GITHUB_KEY: ${{ secrets.NUGET_API_GITHUB_KEY }}
8790
NUGET_API_NUGET_KEY: ${{ secrets.NUGET_API_NUGET_KEY }}
88-
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
8991
permissions:
9092
contents: write # Required to checkout the code and create releases
9193
packages: write # Required to restore and publish GitHub Packages NuGet packages

templates/AddNewPackage/content/.github/workflows/Release.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ jobs:
6060
6161
release:
6262
name: Release - package and publish NuGet stable release
63-
uses: vmelamed/vm2.DevOps/.github/workflows/_release.yaml@main
6463
needs:
6564
- get-params
65+
uses: vmelamed/vm2.DevOps/.github/workflows/_release.yaml@main
6666
secrets:
67+
# You don't need all three secrets, only the one corresponding to the chosen NuGet server in inputs.nuget-server or the default 'github'
6768
NUGET_API_GITHUB_KEY: ${{ secrets.NUGET_API_GITHUB_KEY }}
6869
NUGET_API_NUGET_KEY: ${{ secrets.NUGET_API_NUGET_KEY }}
6970
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
@@ -76,5 +77,5 @@ jobs:
7677
dotnet-version: ${{ vars.DOTNET_VERSION }}
7778
package-projects: ${{ needs.get-params.outputs.package-projects }}
7879
nuget-server: ${{ needs.get-params.outputs.nuget-server }}
79-
reason: ${{ inputs.reason || '' }}
80+
reason: ${{ inputs.reason }}
8081
save-package-artifacts: ${{ fromJson(needs.get-params.outputs.save-package-artifacts) }}

templates/AddNewPackage/content/Directory.Build.props

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
<Project>
2+
<PropertyGroup>
3+
<GITHUB_RUN_NUMBER Condition="'$(GITHUB_RUN_NUMBER)' == ''">0</GITHUB_RUN_NUMBER>
4+
<RestoreSources>https://api.nuget.org/v3/index.json;https://nuget.pkg.github.com/vmelamed/index.json</RestoreSources>
5+
</PropertyGroup>
6+
27
<!-- ================ Common Settings for All projects ================ -->
38
<PropertyGroup Label="Packages">
49
<TargetFramework>net10.0</TargetFramework>
@@ -9,7 +14,7 @@
914
<AnalysisLevel>latest</AnalysisLevel>
1015
<WarningLevel>9999</WarningLevel>
1116
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
12-
<WarningsAsErrors />
17+
<WarningsAsErrors>$(WarningsAsErrors);NU1605;NU1608;NU1701;NU1702;</WarningsAsErrors>
1318
<NoWarn>$(NoWarn);IDE0058;IDE0290;IDE0130;</NoWarn>
1419
<Deterministic>true</Deterministic>
1520
<DebugType>portable</DebugType>
@@ -22,6 +27,9 @@
2227
<RestoreLockedMode Condition="'$(CI)' == 'true'">true</RestoreLockedMode>
2328
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
2429
<MinVerTagPrefix>v</MinVerTagPrefix>
30+
<MinVerDefaultPreReleaseIdentifiers>preview</MinVerDefaultPreReleaseIdentifiers>
31+
<AssemblyVersion>$(MinVerMajor).$(MinVerMinor).$(GITHUB_RUN_NUMBER).$(MinVerPatch)</AssemblyVersion>
32+
<FileVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).$(GITHUB_RUN_NUMBER)</FileVersion>
2533
</PropertyGroup>
2634

2735
<!-- ================ Package properties for all vm2 packages ================ -->
@@ -44,10 +52,6 @@
4452
</PropertyGroup>
4553

4654
<!-- ================ Common Package References for All projects ================ -->
47-
<PropertyGroup>
48-
<RestoreSources>https://api.nuget.org/v3/index.json;https://nuget.pkg.github.com/vmelamed/index.json</RestoreSources>
49-
</PropertyGroup>
50-
5155
<ItemGroup>
5256
<PackageReference Include="System.Configuration.ConfigurationManager" />
5357
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" />
@@ -235,7 +239,7 @@
235239
</NoWarn>
236240
<TieredPGO>false</TieredPGO>
237241
<!-- To show up in the VS test explorer, see also below in the package references:
238-
<RestorePackagesWithLockFile Condition="$(BuildingInsideVisualStudio) == 'true'">false</RestorePackagesWithLockFile>
242+
<RestorePackagesWithLockFile Condition="$(BuildingInsideVisualStudio) == 'true')">false</RestorePackagesWithLockFile>
239243
-->
240244
</PropertyGroup>
241245

templates/AddNewPackage/content/Directory.Packages.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@
3535
<PackageVersion Include="vm2.TestUtilities" Version="1.0.3" />
3636

3737
<!-- Benchmarking packages: -->
38+
<!-- for running with Visual Studio profiler:<PackageVersion Include="Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers" Version="18.0.36421.1" />-->
3839
<PackageVersion Include="BenchmarkDotNet" Version="0.15.8" />
3940
<PackageVersion Include="BenchmarkDotNet.Annotations" Version="0.15.8" />
4041

41-
<!-- Add package-specific dependency versions here: -->
42+
<!-- Add project-specific packages here: -->
4243

4344
</ItemGroup>
4445
</Project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Val Melamed
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

templates/AddNewPackage/content/NuGet.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<packageSources>
44
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
55
<add key="github.vm2" value="https://nuget.pkg.github.com/vmelamed/index.json" />
6-
<add key="Microsoft VS Offline Packages" value="/mnt/c/Program Files (x86)/Microsoft SDKs/NuGetPackages/" />
76
</packageSources>
87
<packageSourceMapping>
98
<!-- key value for <packageSource> should match key values from <packageSources> element -->
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
external-sources=true
2+
source-path=SCRIPTDIR
3+
enable=quote-safe-variables
4+
enable=check-unassigned-uppercase
5+
enable=double-quote
6+
enable=add-default-case
7+
enable=check-sourced
8+
enable=avoid-nullary-conditions
9+
enable=check-unassigned-uppercase
10+
enable=require-double-brackets
11+
enable=useless-use-of-cat
12+
disable=SC1017

templates/AddNewPackage/content/scripts/_common.diagnostics.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ function on_debug() {
9595
function on_exit() {
9696
# echo an error message before exiting
9797
local x=$?
98-
if ((x != 0)); then
99-
error "'$last_command' command failed with exit code $x"
98+
if ((x != 0)) && [[ ! $last_command =~ exit.* ]]; then
99+
error "on_exit: '$last_command' command failed with exit code $x"
100100
fi
101101
if [[ -n "$initial_dir" ]]; then
102102
cd "$initial_dir" || exit

0 commit comments

Comments
 (0)