diff --git a/.github/workflows/github-actions-ci.yaml b/.github/workflows/github-actions-ci.yaml index 7a499a8..c088245 100644 --- a/.github/workflows/github-actions-ci.yaml +++ b/.github/workflows/github-actions-ci.yaml @@ -18,25 +18,29 @@ jobs: ports: - 1433:1433 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Setup .NET - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v5 with: - dotnet-version: 8.0.x + dotnet-version: 10.0.x - name: Restore dependencies - run: dotnet restore PosInformatique.Database.Updater.sln + run: dotnet restore PosInformatique.Database.Updater.slnx - name: Build solution - run: dotnet build PosInformatique.Database.Updater.sln --configuration Release --no-restore + run: dotnet build PosInformatique.Database.Updater.slnx --configuration Release --no-restore - name: Run tests run: | - dotnet test PosInformatique.Database.Updater.sln \ + dotnet test \ + --solution PosInformatique.Database.Updater.slnx \ --configuration Release \ --no-build \ - --logger "trx;LogFileName=test_results.trx" \ + --coverage \ + --coverage-output-format cobertura \ + --coverage-settings CodeCoverage.runsettings \ + --report-trx \ --results-directory ./TestResults env: DATABASE_UPDATER_UNIT_TESTS_CONNECTION_STRING: "Data Source=localhost,1433;Database=master;User Id=sa;Password=P@ssw0rd12345!;TrustServerCertificate=True;" diff --git a/.github/workflows/github-actions-release.yml b/.github/workflows/github-actions-release.yml index 3ab803b..5d736e0 100644 --- a/.github/workflows/github-actions-release.yml +++ b/.github/workflows/github-actions-release.yml @@ -7,7 +7,7 @@ on: type: string description: The version of the library required: true - default: 1.0.0 + default: 1.1.0 VersionSuffix: type: string description: The version suffix of the library (for example rc.1) @@ -17,20 +17,34 @@ run-name: ${{ inputs.VersionSuffix && format('{0}-{1}', inputs.VersionPrefix, in jobs: build: runs-on: ubuntu-latest + permissions: + id-token: write + contents: read steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - - name: Setup .NET 8.x - uses: actions/setup-dotnet@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v5 with: - dotnet-version: '8.x' + dotnet-version: '10.0.x' - name: Build PosInformatique.Database.Updater - run: dotnet pack - --property:Configuration=Release - --property:VersionPrefix=${{ github.event.inputs.VersionPrefix }} - --property:VersionSuffix=${{ github.event.inputs.VersionSuffix }} + run: | + dotnet pack \ + --property:Configuration=Release \ + --property:VersionPrefix=${{ github.event.inputs.VersionPrefix }} \ + --property:VersionSuffix=${{ github.event.inputs.VersionSuffix }} \ "src/Database.Updater/Database.Updater.csproj" + - name: NuGet login + uses: NuGet/login@v1 + id: nuget_login + with: + user: ${{ secrets.NUGET_USER }} + - name: Publish the package to nuget.org - run: dotnet nuget push "src/**/bin/Release/*.nupkg" --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate + run: | + dotnet nuget push "src/**/bin/Release/*.nupkg" \ + --api-key "${{steps.nuget_login.outputs.NUGET_API_KEY}}" \ + --source https://api.nuget.org/v3/index.json \ + --skip-duplicate diff --git a/CodeCoverage.runsettings b/CodeCoverage.runsettings new file mode 100644 index 0000000..e536876 --- /dev/null +++ b/CodeCoverage.runsettings @@ -0,0 +1,54 @@ + + + + + + + + + + + + + .*\.dll$ + + + .*xunit.* + awesomeassertions.* + bunit.* + moq.* + microsoft.* + .*tests\.dll$ + + + + + + + ^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$ + ^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$ + + + + + + ^MimeKit\..* + + + + + + .*\.razor + .*\.cshtml + + + + True + True + + + + + + + \ No newline at end of file diff --git a/Directory.Packages.props b/Directory.Packages.props index 7e851cf..a4529e7 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,16 +3,15 @@ true - - + - + + - - + \ No newline at end of file diff --git a/PosInformatique.Database.Updater.sln b/PosInformatique.Database.Updater.sln deleted file mode 100644 index 210b30b..0000000 --- a/PosInformatique.Database.Updater.sln +++ /dev/null @@ -1,91 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.14.36408.4 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Database.Updater", "src\Database.Updater\Database.Updater.csproj", "{961D82E3-18B9-4CB4-B290-8146D874AB39}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}" - ProjectSection(SolutionItems) = preProject - .editorconfig = .editorconfig - .gitignore = .gitignore - Directory.Build.props = Directory.Build.props - Directory.Packages.props = Directory.Packages.props - LICENSE = LICENSE - README.md = README.md - stylecop.json = stylecop.json - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Database.Updater.Tests", "tests\Database.Updater.Tests\Database.Updater.Tests.csproj", "{8788FC9A-8CAE-4A45-8832-18E29AF38838}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Database.Updater.IntegrationTests", "tests\Database.Updater.IntegrationTests\Database.Updater.IntegrationTests.csproj", "{64B1BA81-69E9-AE03-F57A-BE4A0B20A9E8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Database.Updater.Tests.MigrationsAssembly", "tests\Database.Updater.Tests.MigrationsAssembly\Database.Updater.Tests.MigrationsAssembly.csproj", "{FFFBF4C0-674C-EA8E-7714-76A92E6973E3}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{DF126F11-BF03-4B7E-B2F2-3A23E7FE6BF0}" - ProjectSection(SolutionItems) = preProject - tests\.editorconfig = tests\.editorconfig - tests\Directory.Build.props = tests\Directory.Build.props - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{BF73C1D5-EF4C-4F34-9944-0D74667BE6A8}" - ProjectSection(SolutionItems) = preProject - src\Directory.Build.props = src\Directory.Build.props - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{E9100678-42A3-461A-B8F0-DF12DA892979}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Database.Updater.Tests.MigrationsErrorAssembly", "tests\Database.Updater.Tests.MigrationsErrorAssembly\Database.Updater.Tests.MigrationsErrorAssembly.csproj", "{6C0F0292-EB9E-EB63-C1D8-1C8B63E59FC8}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{25236396-6913-4183-B770-631C6FDACA15}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{20A16198-31B4-4155-AE36-AB1942F382A6}" - ProjectSection(SolutionItems) = preProject - .github\workflows\github-actions-ci.yaml = .github\workflows\github-actions-ci.yaml - .github\workflows\github-actions-release.yml = .github\workflows\github-actions-release.yml - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {961D82E3-18B9-4CB4-B290-8146D874AB39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {961D82E3-18B9-4CB4-B290-8146D874AB39}.Debug|Any CPU.Build.0 = Debug|Any CPU - {961D82E3-18B9-4CB4-B290-8146D874AB39}.Release|Any CPU.ActiveCfg = Release|Any CPU - {961D82E3-18B9-4CB4-B290-8146D874AB39}.Release|Any CPU.Build.0 = Release|Any CPU - {8788FC9A-8CAE-4A45-8832-18E29AF38838}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8788FC9A-8CAE-4A45-8832-18E29AF38838}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8788FC9A-8CAE-4A45-8832-18E29AF38838}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8788FC9A-8CAE-4A45-8832-18E29AF38838}.Release|Any CPU.Build.0 = Release|Any CPU - {64B1BA81-69E9-AE03-F57A-BE4A0B20A9E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {64B1BA81-69E9-AE03-F57A-BE4A0B20A9E8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {64B1BA81-69E9-AE03-F57A-BE4A0B20A9E8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {64B1BA81-69E9-AE03-F57A-BE4A0B20A9E8}.Release|Any CPU.Build.0 = Release|Any CPU - {FFFBF4C0-674C-EA8E-7714-76A92E6973E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FFFBF4C0-674C-EA8E-7714-76A92E6973E3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FFFBF4C0-674C-EA8E-7714-76A92E6973E3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FFFBF4C0-674C-EA8E-7714-76A92E6973E3}.Release|Any CPU.Build.0 = Release|Any CPU - {6C0F0292-EB9E-EB63-C1D8-1C8B63E59FC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6C0F0292-EB9E-EB63-C1D8-1C8B63E59FC8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6C0F0292-EB9E-EB63-C1D8-1C8B63E59FC8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6C0F0292-EB9E-EB63-C1D8-1C8B63E59FC8}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {8788FC9A-8CAE-4A45-8832-18E29AF38838} = {E9100678-42A3-461A-B8F0-DF12DA892979} - {64B1BA81-69E9-AE03-F57A-BE4A0B20A9E8} = {E9100678-42A3-461A-B8F0-DF12DA892979} - {FFFBF4C0-674C-EA8E-7714-76A92E6973E3} = {E9100678-42A3-461A-B8F0-DF12DA892979} - {DF126F11-BF03-4B7E-B2F2-3A23E7FE6BF0} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} - {BF73C1D5-EF4C-4F34-9944-0D74667BE6A8} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} - {6C0F0292-EB9E-EB63-C1D8-1C8B63E59FC8} = {E9100678-42A3-461A-B8F0-DF12DA892979} - {25236396-6913-4183-B770-631C6FDACA15} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} - {20A16198-31B4-4155-AE36-AB1942F382A6} = {25236396-6913-4183-B770-631C6FDACA15} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {30DF5A1B-3B00-40E8-90F0-FA6F5846B215} - EndGlobalSection -EndGlobal diff --git a/PosInformatique.Database.Updater.slnx b/PosInformatique.Database.Updater.slnx new file mode 100644 index 0000000..89d0d87 --- /dev/null +++ b/PosInformatique.Database.Updater.slnx @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index 12249d1..a7b78c7 100644 --- a/README.md +++ b/README.md @@ -54,9 +54,9 @@ an application. The `DatabaseUpdaterBuilder` creates an internal `IHost`, allowing developers to configure additional services. After configuring the `DatabaseUpdaterBuilder`, call `Build()` to get an `IDatabaseUpdater`, then -call `IDatabaseUpdater.UpgradeAsync(string[])` to run the migration process with the `args` from `Main()`. +call `IDatabaseUpdater.UpgradeAsync(IReadOnlyList, CancellationToken)` to run the migration process with the `args` from `Main()`. -`IDatabaseUpdater.UpgradeAsync(string[])` returns an `int` error code that you can return from `Main()` and use in calling +`IDatabaseUpdater.UpgradeAsync(IReadOnlyList, CancellationToken)` returns an `int` error code that you can return from `Main()` and use in calling scripts (e.g., `%ERRORLEVEL%`). ### Name of the application diff --git a/global.json b/global.json new file mode 100644 index 0000000..b1c740b --- /dev/null +++ b/global.json @@ -0,0 +1,9 @@ +{ + "sdk": { + "version": "10.0.201", + "rollForward": "latestFeature" + }, + "test": { + "runner": "Microsoft.Testing.Platform" + } +} diff --git a/tests/Database.Updater.Tests/Database.Updater.Tests.csproj b/tests/Database.Updater.Tests/Database.Updater.Tests.csproj index 4d38d8b..0d211ff 100644 --- a/tests/Database.Updater.Tests/Database.Updater.Tests.csproj +++ b/tests/Database.Updater.Tests/Database.Updater.Tests.csproj @@ -7,19 +7,11 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - + @@ -28,7 +20,7 @@ - + diff --git a/tests/Database.Updater.Tests/DatabaseUpdaterTest.cs b/tests/Database.Updater.Tests/DatabaseUpdaterTest.cs index 0f2f67b..2ed3719 100644 --- a/tests/Database.Updater.Tests/DatabaseUpdaterTest.cs +++ b/tests/Database.Updater.Tests/DatabaseUpdaterTest.cs @@ -12,11 +12,6 @@ namespace PosInformatique.Database.Updater.Tests [Collection(nameof(DatabaseUpdaterTest))] public class DatabaseUpdaterTest { - static DatabaseUpdaterTest() - { - License.Accepted = true; - } - [Fact] public async Task UpgradeAsync_WithExplicitMigrationsAssembly() {