Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions .github/workflows/github-actions-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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;"
Expand Down
34 changes: 24 additions & 10 deletions .github/workflows/github-actions-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
54 changes: 54 additions & 0 deletions CodeCoverage.runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<!-- Data Collector for Visual Studio -->
<DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Configuration>
<CodeCoverage>

<!-- Match assembly file paths: -->
<ModulePaths>
<Include>
<ModulePath>.*\.dll$</ModulePath>
</Include>
<Exclude>
<ModulePath>.*xunit.*</ModulePath>
<ModulePath>awesomeassertions.*</ModulePath>
<ModulePath>bunit.*</ModulePath>
<ModulePath>moq.*</ModulePath>
<ModulePath>microsoft.*</ModulePath>
<ModulePath>.*tests\.dll$</ModulePath>
</Exclude>
</ModulePaths>

<Attributes>
<Exclude>
<!-- Exclude generated code from code coverage -->
<Attribute>^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$</Attribute>
<Attribute>^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$</Attribute>
</Exclude>
</Attributes>

<Functions>
<Exclude>
<Function>^MimeKit\..*</Function>
</Exclude>
</Functions>

<Sources>
<Exclude>
<Source>.*\.razor</Source>
<Source>.*\.cshtml</Source>
</Exclude>
</Sources>

<EnableStaticManagedInstrumentation>True</EnableStaticManagedInstrumentation>
<EnableDynamicManagedInstrumentation>True</EnableDynamicManagedInstrumentation>

</CodeCoverage>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
9 changes: 4 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
<PackageVersion Include="FluentAssertions" Version="8.8.0" />
<PackageVersion Include="AwesomeAssertions" Version="9.5.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.10.0" />
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport" Version="2.3.3" />
<PackageVersion Include="PosInformatique.Testing.Databases.SqlServer" Version="3.0.0" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<PackageVersion Include="System.CommandLine" Version="2.0.0" />
<PackageVersion Include="xunit.v3" Version="3.2.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageVersion Include="xunit.v3.core.mtp-v2" Version="4.0.0" />
</ItemGroup>
</Project>
91 changes: 0 additions & 91 deletions PosInformatique.Database.Updater.sln

This file was deleted.

32 changes: 32 additions & 0 deletions PosInformatique.Database.Updater.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<Solution>
<Folder Name="/Solution Items/">
<File Path=".editorconfig" />
<File Path=".gitignore" />
<File Path="CodeCoverage.runsettings" />
<File Path="Directory.Build.props" />
<File Path="Directory.Packages.props" />
<File Path="global.json" />
<File Path="LICENSE" />
<File Path="README.md" />
<File Path="stylecop.json" />
</Folder>
<Folder Name="/Solution Items/.github/" />
<Folder Name="/Solution Items/.github/workflows/">
<File Path=".github/workflows/github-actions-ci.yaml" />
<File Path=".github/workflows/github-actions-release.yml" />
</Folder>
<Folder Name="/Solution Items/src/">
<File Path="src/Directory.Build.props" />
</Folder>
<Folder Name="/Solution Items/tests/">
<File Path="tests/.editorconfig" />
<File Path="tests/Directory.Build.props" />
</Folder>
<Folder Name="/Tests/">
<Project Path="tests/Database.Updater.IntegrationTests/Database.Updater.IntegrationTests.csproj" />
<Project Path="tests/Database.Updater.Tests.MigrationsAssembly/Database.Updater.Tests.MigrationsAssembly.csproj" />
<Project Path="tests/Database.Updater.Tests.MigrationsErrorAssembly/Database.Updater.Tests.MigrationsErrorAssembly.csproj" />
<Project Path="tests/Database.Updater.Tests/Database.Updater.Tests.csproj" />
</Folder>
<Project Path="src/Database.Updater/Database.Updater.csproj" />
</Solution>
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>, 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<string>, CancellationToken)` returns an `int` error code that you can return from `Main()` and use in calling
scripts (e.g., `%ERRORLEVEL%`).

### Name of the application
Expand Down
9 changes: 9 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"sdk": {
"version": "10.0.201",
"rollForward": "latestFeature"
},
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
18 changes: 5 additions & 13 deletions tests/Database.Updater.Tests/Database.Updater.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="AwesomeAssertions" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage"/>
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport"/>
<PackageReference Include="PosInformatique.Testing.Databases.SqlServer" />
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.v3" />
</ItemGroup>
<PackageReference Include="xunit.v3.core.mtp-v2" /> </ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Database.Updater\Database.Updater.csproj" />
Expand All @@ -28,7 +20,7 @@
</ItemGroup>

<ItemGroup>
<Using Include="FluentAssertions" />
<Using Include="AwesomeAssertions" />
<Using Include="Xunit" />
</ItemGroup>

Expand Down
5 changes: 0 additions & 5 deletions tests/Database.Updater.Tests/DatabaseUpdaterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
Loading