diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ef401c0e00..a692f242d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,14 +16,14 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 # ----- # Setup .NET sdk # ----- - name: Install .NET SDKs - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v5 with: dotnet-version: | 8.0.x diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..cc46e4f645 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: Release +on: + workflow_dispatch: + inputs: + version: + description: "Nuget package version" + required: true + type: string + publish: + description: "Publish to nuget" + type: boolean + required: true + default: false +run-name: Release ${{ inputs.Version }} + +jobs: + build: + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 10.0.x + + - name: Build package + run: dotnet pack ./Castle.Core.sln -p:Version=${{ inputs.Version }} -o ./build -p:CI=true + + - name: Make explicit versions for nuget packages + run: dotnet run --project .\tools\Explicit.NuGet.Versions\Explicit.NuGet.Versions.csproj ".\build" "castle." + + - name: Publish to nuget.org + if: inputs.publish == 'true' + run: dotnet nuget push ./build/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json + + - name: Upload packages + uses: actions/upload-artifact@v5 + with: + name: packages + path: | + build/*.nupkg + build/*.snupkg + retention-days: 30 \ No newline at end of file diff --git a/Castle.Core.sln b/Castle.Core.sln index 5f1450a217..f0d7504e12 100644 --- a/Castle.Core.sln +++ b/Castle.Core.sln @@ -1,16 +1,13 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30011.22 +# Visual Studio Version 18 +VisualStudioVersion = 18.0.11222.15 d18.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Castle Build", "Castle Build", "{1B999D24-B7AB-4997-96E7-08FA05325694}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig .gitattributes = .gitattributes .gitignore = .gitignore - appveyor.yml = appveyor.yml - build.cmd = build.cmd - build.sh = build.sh CHANGELOG.md = CHANGELOG.md buildscripts\common.props = buildscripts\common.props CONTRIBUTING.md = CONTRIBUTING.md @@ -35,6 +32,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub Actions", "GitHub Actions", "{149DB291-CBD6-4F82-A6A6-758E328DB946}" ProjectSection(SolutionItems) = preProject .github\workflows\build.yml = .github\workflows\build.yml + .github\workflows\release.yml = .github\workflows\release.yml EndProjectSection EndProject Global diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 867a666387..0000000000 --- a/appveyor.yml +++ /dev/null @@ -1,86 +0,0 @@ -image: -- Visual Studio 2022 -- Ubuntu2204 - - -# ---------------- -# ALL BUILD JOBS -# ---------------- -skip_tags: false -test: off - - -for: -- # ----------------- - # LINUX BUILD JOB - # ----------------- - matrix: - only: - - image: Ubuntu2204 - - # install .NET 10 SDK - install: - - curl -L https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh - - chmod +x ./dotnet-install.sh - - sudo ./dotnet-install.sh --channel 10.0 --install-dir /usr/share/dotnet - - # build and run tests - build_script: - - uname -a - - ./build.sh - - # upload test results - after_build: - - find "$APPVEYOR_BUILD_FOLDER" -type f -name '*TestResults.xml' -print0 | xargs -0 -I '{}' curl -F 'file=@{}' "https://ci.appveyor.com/api/testresults/nunit3/$APPVEYOR_JOB_ID" - - # deployment is handled exclusively by the Windows build job (below) - deploy: off - - -- # ------------------- - # WINDOWS BUILD JOB - # ------------------- - matrix: - only: - - image: Visual Studio 2022 - - # update AppVeyor build version; this matters for deployments - init: - - ps: | - if ($env:APPVEYOR_REPO_TAG -eq "true") - { - Update-AppveyorBuild -Version ($env:APPVEYOR_REPO_TAG_NAME).TrimStart("v") - } - - # install .NET 10 SDK - install: - - cmd: choco install dotnet-10.0-sdk - - # build and run tests - build_script: - - cmd: build.cmd - - # upload test results - after_build: - - ps: | - $wc = New-Object System.Net.WebClient - $wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path "Net80TestResults.xml")) - $wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path "Net80WeakNamedTestResults.xml")) - $wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path "DesktopClrTestResults.xml")) - $wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path "DesktopClrWeakNamedTestResults.xml")) - - # push packages to NuGet on tag builds - on_success: - - ps: | - if ($env:APPVEYOR_REPO_TAG -eq "true") - { - nuget push ".\build\Castle.Core.${env:APPVEYOR_BUILD_VERSION}.nupkg" -ApiKey $env:NUGET_API_KEY -Source https://api.nuget.org/v3/index.json - nuget push ".\build\Castle.Core-log4net.${env:APPVEYOR_BUILD_VERSION}.nupkg" -ApiKey $env:NUGET_API_KEY -Source https://api.nuget.org/v3/index.json - nuget push ".\build\Castle.Core-NLog.${env:APPVEYOR_BUILD_VERSION}.nupkg" -ApiKey $env:NUGET_API_KEY -Source https://api.nuget.org/v3/index.json - nuget push ".\build\Castle.Core-Serilog.${env:APPVEYOR_BUILD_VERSION}.nupkg" -ApiKey $env:NUGET_API_KEY -Source https://api.nuget.org/v3/index.json - } - - # upload packages to AppVeyor - artifacts: - - path: build\*.nupkg - name: core diff --git a/build.cmd b/build.cmd deleted file mode 100644 index 119de998ee..0000000000 --- a/build.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO OFF -REM **************************************************************************** -REM Copyright 2004-2021 Castle Project - http://www.castleproject.org/ -REM Licensed under the Apache License, Version 2.0 (the "License"); -REM you may not use this file except in compliance with the License. -REM You may obtain a copy of the License at -REM -REM http://www.apache.org/licenses/LICENSE-2.0 -REM -REM Unless required by applicable law or agreed to in writing, software -REM distributed under the License is distributed on an "AS IS" BASIS, -REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -REM See the License for the specific language governing permissions and -REM limitations under the License. -REM **************************************************************************** - -@call buildscripts\build.cmd %* diff --git a/build.sh b/build.sh deleted file mode 100755 index 5295af8061..0000000000 --- a/build.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# **************************************************************************** -# Copyright 2004-2022 Castle Project - http://www.castleproject.org/ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# **************************************************************************** -shopt -s expand_aliases - -dotnet --list-sdks - -echo --------------------------- -echo Build -echo --------------------------- - -dotnet build ./Castle.Core.sln --configuration Release --tl:off - -echo --------------------------- -echo Running NET8.0 Tests -echo --------------------------- - -dotnet ./src/Castle.Core.Tests/bin/Release/net8.0/Castle.Core.Tests.dll --result=Net80TestResults.xml;format=nunit3 -dotnet ./src/Castle.Core.Tests.WeakNamed/bin/Release/net8.0/Castle.Core.Tests.WeakNamed.dll --result=Net80WeakNamedTestResults.xml;format=nunit3 - -# Ensure that all test runs produced a protocol file: -if [[ !( -f Net80TestResults.xml && - -f Net80WeakNamedTestResults.xml ) ]]; then - echo "Incomplete test results. Some test runs might not have terminated properly. Failing the build." - exit 1 -fi - -NET80_FAILCOUNT=$(grep -F "One or more child tests had errors" Net80TestResults.xml Net80WeakNamedTestResults.xml | wc -l) -if [ $NET80_FAILCOUNT -ne 0 ] -then - echo "Net8.0 Tests have failed, failing the build" - exit 1 -fi diff --git a/buildscripts/build.cmd b/buildscripts/build.cmd deleted file mode 100644 index c182894491..0000000000 --- a/buildscripts/build.cmd +++ /dev/null @@ -1,48 +0,0 @@ -@ECHO OFF -REM **************************************************************************** -REM Copyright 2004-2022 Castle Project - http://www.castleproject.org/ -REM Licensed under the Apache License, Version 2.0 (the "License"); -REM you may not use this file except in compliance with the License. -REM You may obtain a copy of the License at -REM -REM http://www.apache.org/licenses/LICENSE-2.0 -REM -REM Unless required by applicable law or agreed to in writing, software -REM distributed under the License is distributed on an "AS IS" BASIS, -REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -REM See the License for the specific language governing permissions and -REM limitations under the License. -REM **************************************************************************** - -if "%1" == "" goto no_config -if "%1" NEQ "" goto set_config - -:set_config -SET Configuration=%1 -GOTO build - -:no_config -SET Configuration=Release -GOTO build - -:build -dotnet build ./tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.sln -dotnet build --configuration %Configuration% || exit /b 1 -.\tools\Explicit.NuGet.Versions\build\nev.exe ".\build" "castle." -GOTO test - -:test - -echo -------------------- -echo Running NET462 Tests -echo -------------------- - -src\Castle.Core.Tests\bin\%Configuration%\net462\Castle.Core.Tests.exe --result=DesktopClrTestResults.xml;format=nunit3 || exit /b 1 -src\Castle.Core.Tests.WeakNamed\bin\%Configuration%\net462\Castle.Core.Tests.WeakNamed.exe --result=DesktopClrWeakNamedTestResults.xml;format=nunit3 || exit /b 1 - -echo --------------------------- -echo Running NET8.0 Tests -echo --------------------------- - -dotnet .\src\Castle.Core.Tests\bin\%Configuration%\net8.0\Castle.Core.Tests.dll --result=Net80TestResults.xml;format=nunit3 || exit /b 1 -dotnet .\src\Castle.Core.Tests.WeakNamed\bin\%Configuration%\net8.0/Castle.Core.Tests.WeakNamed.dll --result=Net80WeakNamedTestResults.xml;format=nunit3 || exit /b 1 diff --git a/buildscripts/common.props b/buildscripts/common.props index b2989c095a..36bc3dc792 100644 --- a/buildscripts/common.props +++ b/buildscripts/common.props @@ -7,7 +7,7 @@ git https://github.com/castleproject/Core 0.0.0 - $(APPVEYOR_BUILD_VERSION) + $(Version) $(BuildVersion.Split('.')[0]) $(BuildVersion.Split('-')[0]) true @@ -24,14 +24,19 @@ http://www.castleproject.org/img/castle-logo.png castle-logo.png false - $(BuildVersion) - true - false $([System.DateTime]::Now.ToString("yyyy")) Copyright (c) 2004-$(CurrentYear) Castle Project - http://www.castleproject.org/ . + + + true + true + true + snupkg + + diff --git a/nuget.config b/nuget.config deleted file mode 100644 index af7ed10fdd..0000000000 --- a/nuget.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/Castle.Core.Tests.WeakNamed/Castle.Core.Tests.WeakNamed.csproj b/src/Castle.Core.Tests.WeakNamed/Castle.Core.Tests.WeakNamed.csproj index 6b4a9f71c4..c2e6f159e8 100644 --- a/src/Castle.Core.Tests.WeakNamed/Castle.Core.Tests.WeakNamed.csproj +++ b/src/Castle.Core.Tests.WeakNamed/Castle.Core.Tests.WeakNamed.csproj @@ -1,4 +1,4 @@ - + @@ -7,7 +7,6 @@ - Exe Castle Contributors Castle.Core.Tests.WeakNamed Castle @@ -15,13 +14,18 @@ 0.0.0.0 False false - Program + false - + + + + + + diff --git a/src/Castle.Core.Tests.WeakNamed/Program.cs b/src/Castle.Core.Tests.WeakNamed/Program.cs deleted file mode 100644 index a5dbb5a2a2..0000000000 --- a/src/Castle.Core.Tests.WeakNamed/Program.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Reflection; -using NUnit.Common; -using NUnitLite; - -internal class Program -{ - public static int Main(string[] args) - { - return new AutoRun(typeof(Program).Assembly) - .Execute(args, new ExtendedTextWrapper(Console.Out), Console.In); - } -} \ No newline at end of file diff --git a/src/Castle.Core.Tests/Castle.Core.Tests.csproj b/src/Castle.Core.Tests/Castle.Core.Tests.csproj index 7fbc5856ad..0341e6001c 100644 --- a/src/Castle.Core.Tests/Castle.Core.Tests.csproj +++ b/src/Castle.Core.Tests/Castle.Core.Tests.csproj @@ -7,7 +7,6 @@ - Exe Castle Contributors Castle.Core.Tests Castle @@ -16,7 +15,7 @@ True ..\..\buildscripts\CastleKey.snk true - Program + false @@ -42,9 +41,9 @@ - + - + @@ -57,7 +56,7 @@ - + \ No newline at end of file diff --git a/src/Castle.Core.Tests/Program.cs b/src/Castle.Core.Tests/Program.cs deleted file mode 100644 index a5dbb5a2a2..0000000000 --- a/src/Castle.Core.Tests/Program.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Reflection; -using NUnit.Common; -using NUnitLite; - -internal class Program -{ - public static int Main(string[] args) - { - return new AutoRun(typeof(Program).Assembly) - .Execute(args, new ExtendedTextWrapper(Console.Out), Console.In); - } -} \ No newline at end of file diff --git a/src/Castle.Core/Castle.Core.csproj b/src/Castle.Core/Castle.Core.csproj index fa705deaff..1f8f5b8f70 100644 --- a/src/Castle.Core/Castle.Core.csproj +++ b/src/Castle.Core/Castle.Core.csproj @@ -8,8 +8,6 @@ Castle.Core - True - ../../build/ Castle.Core Castle Castle Core diff --git a/src/Castle.Services.Logging.NLogIntegration/Castle.Services.Logging.NLogIntegration.csproj b/src/Castle.Services.Logging.NLogIntegration/Castle.Services.Logging.NLogIntegration.csproj index 6f900d028d..c6cecd5910 100644 --- a/src/Castle.Services.Logging.NLogIntegration/Castle.Services.Logging.NLogIntegration.csproj +++ b/src/Castle.Services.Logging.NLogIntegration/Castle.Services.Logging.NLogIntegration.csproj @@ -8,8 +8,6 @@ Castle.Core-NLog - True - ../../build/ Castle.Services.Logging.NLogIntegration Castle.Services.Logging.NLogIntegration Castle NLog integration diff --git a/src/Castle.Services.Logging.SerilogIntegration/Castle.Services.Logging.SerilogIntegration.csproj b/src/Castle.Services.Logging.SerilogIntegration/Castle.Services.Logging.SerilogIntegration.csproj index 63712c2056..33b7807ab2 100644 --- a/src/Castle.Services.Logging.SerilogIntegration/Castle.Services.Logging.SerilogIntegration.csproj +++ b/src/Castle.Services.Logging.SerilogIntegration/Castle.Services.Logging.SerilogIntegration.csproj @@ -8,8 +8,6 @@ Castle.Core-Serilog - True - ../../build/ Castle.Services.Logging.SerilogIntegration Castle.Services.Logging.SerilogIntegration Castle Serilog integration diff --git a/src/Castle.Services.Logging.log4netIntegration/Castle.Services.Logging.log4netIntegration.csproj b/src/Castle.Services.Logging.log4netIntegration/Castle.Services.Logging.log4netIntegration.csproj index f33f61ceea..bdf8e82373 100644 --- a/src/Castle.Services.Logging.log4netIntegration/Castle.Services.Logging.log4netIntegration.csproj +++ b/src/Castle.Services.Logging.log4netIntegration/Castle.Services.Logging.log4netIntegration.csproj @@ -8,8 +8,6 @@ Castle.Core-log4net - True - ../../build/ Castle.Services.Logging.Log4netIntegration Castle.Services.Logging.Log4netIntegration Castle log4net integration diff --git a/tools/Explicit.NuGet.Versions/Program.cs b/tools/Explicit.NuGet.Versions/Program.cs index a68345cc57..9e9e7eabb6 100644 --- a/tools/Explicit.NuGet.Versions/Program.cs +++ b/tools/Explicit.NuGet.Versions/Program.cs @@ -39,6 +39,7 @@ private static void WriteNuspecToPackages(Dictionary { using (var zipFile = ZipFile.Open(packageFile.Key, ZipArchiveMode.Update)) { + zipFile.GetEntry(packageFile.Value.EntryName).Delete(); using (var stream = new StreamWriter(zipFile.CreateEntry(packageFile.Value.EntryName).Open())) { stream.Write(packageFile.Value.Contents);