Skip to content

Commit

Permalink
Merge pull request #3 from DbUp/release/6.0.0
Browse files Browse the repository at this point in the history
Release 6.0
  • Loading branch information
droyad authored Dec 17, 2024
2 parents ff15148 + c77ddde commit a2b8fad
Show file tree
Hide file tree
Showing 18 changed files with 74 additions and 169 deletions.
73 changes: 4 additions & 69 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,77 +2,12 @@ name: CI

on:
push:
branches:
- '**' # Ignores pushes of tags
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: windows-latest # Use Ubuntu in v5.0

env:
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Avoid pre-populating the NuGet package cache

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # all

- name: Setup .NET 2.0 # Remove in v5.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.0.x

- name: Setup .NET 8.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: '5.x'

- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v0

- name: Display SemVer
run: |
echo "SemVer: $env:GitVersion_SemVer"
- name: Add DbUp NuGet Source
run: dotnet nuget add source --name DbUp --username DbUp --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text https://nuget.pkg.github.com/DbUp/index.json

- name: Restore
run: dotnet restore
working-directory: src

- name: Build
run: dotnet build -c Release --no-restore /p:Version=$env:GitVersion_SemVer
working-directory: src

- name: Test
run: dotnet test --no-build -c Release --logger trx --logger "console;verbosity=detailed" --results-directory ../artifacts
working-directory: src

- name: Pack
run: dotnet pack --no-build -c Release -o ../artifacts /p:Version=$env:GitVersion_SemVer
working-directory: src

- name: Push NuGet packages to GitHub Packages ⬆️
working-directory: artifacts
run: dotnet nuget push *.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/DbUp/index.json"

- name: Push NuGet packages to NuGet ⬆️
if: ${{ steps.gitversion.outputs.preReleaseLabel == '' }}
working-directory: artifacts
run: dotnet nuget push *.nupkg --api-key ${{ secrets.NUGET_APIKEY }} --source https://api.nuget.org/v3/index.json

- name: Test Report 🧪
uses: dorny/test-reporter@v1
if: ${{ always() }}
with:
name: Tests
path: artifacts/*.trx
reporter: dotnet-trx
name: Build
uses: DbUp/Universe/.github/workflows/build.yml@main
12 changes: 12 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Publish DbUp Packages to NuGet

on:
release:
types: [ published ]
workflow_dispatch:

jobs:
publish:
name: Publish Package
uses: DbUp/Universe/.github/workflows/publish-release.yml@main
secrets: inherit
12 changes: 12 additions & 0 deletions .github/workflows/test-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Test Report
run-name: Generate Test Report for run `${{ github.event.workflow_run.run_number }}` branch `${{ github.event.workflow_run.head_branch }}`

on:
workflow_run:
workflows: ["CI", "build"]
types: [completed]

jobs:
report:
name: Test Report 🧪
uses: DbUp/Universe/.github/workflows/test-report.yml@main
14 changes: 0 additions & 14 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,4 @@
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup Condition="'$(TF_BUILD)' == 'true' Or '$(CI)' == 'true'">

<!-- Perform a deterministic build, so our binaries aren't impacted by build server environmental factors (e.g. file paths). -->
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>

<!-- Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>

<!-- Recommended: Embed symbols containing Source Link in the main file (exe/dll) -->
<DebugType>embedded</DebugType>

</PropertyGroup>

</Project>
4 changes: 2 additions & 2 deletions src/Sample/Sample.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Exe</OutputType>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\dbup-firebird\dbup-firebird.csproj"/>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0"/>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
DB Operation: Open connection
Info: Beginning database upgrade
Info: Checking whether journal table exists..
Info: Checking whether journal table exists
DB Operation: Execute scalar command: select 1 from RDB$RELATIONS where RDB$SYSTEM_FLAG = 0 and RDB$RELATION_NAME = 'schemaversions'
DB Operation: Dispose command
Info: Journal table does not exist
Info: Executing Database Server script 'Script0001.sql'
Info: Checking whether journal table exists..
Info: Checking whether journal table exists
DB Operation: Execute scalar command: select 1 from RDB$RELATIONS where RDB$SYSTEM_FLAG = 0 and RDB$RELATION_NAME = 'schemaversions'
DB Operation: Dispose command
Info: Creating the "schemaversions" table
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
DB Operation: Open connection
Info: Beginning database upgrade
Info: Checking whether journal table exists..
Info: Checking whether journal table exists
DB Operation: Execute scalar command: select 1 from RDB$RELATIONS where RDB$SYSTEM_FLAG = 0 and RDB$RELATION_NAME = 'TestSchemaVersions'
DB Operation: Dispose command
Info: Journal table does not exist
Info: Executing Database Server script 'Script0001.sql'
Info: Checking whether journal table exists..
Info: Checking whether journal table exists
DB Operation: Execute scalar command: select 1 from RDB$RELATIONS where RDB$SYSTEM_FLAG = 0 and RDB$RELATION_NAME = 'TestSchemaVersions'
DB Operation: Dispose command
Info: Creating the "TestSchemaVersions" table
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
DB Operation: Open connection
Info: Beginning database upgrade
Info: Checking whether journal table exists..
Info: Checking whether journal table exists
DB Operation: Execute scalar command: select 1 from RDB$RELATIONS where RDB$SYSTEM_FLAG = 0 and RDB$RELATION_NAME = 'schemaversions'
DB Operation: Dispose command
Info: Journal table does not exist
Info: Executing Database Server script 'Script0001.sql'
Info: Checking whether journal table exists..
Info: Checking whether journal table exists
DB Operation: Execute scalar command: select 1 from RDB$RELATIONS where RDB$SYSTEM_FLAG = 0 and RDB$RELATION_NAME = 'schemaversions'
DB Operation: Dispose command
Info: Creating the "schemaversions" table
Expand Down
45 changes: 0 additions & 45 deletions src/Tests/ApprovalFiles/NoPublicApiChanges.Run.Net.verified.cs

This file was deleted.

4 changes: 1 addition & 3 deletions src/Tests/DatabaseSupportTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if !NETCORE
using DbUp.Builder;
using DbUp.Builder;
using DbUp.Firebird;
using DbUp.Tests.Common;

Expand All @@ -20,4 +19,3 @@ protected override UpgradeEngineBuilder AddCustomNamedJournalToBuilder(UpgradeEn
=> new FirebirdTableJournal(connectionManagerFactory, logFactory, tableName)
);
}
#endif
4 changes: 1 addition & 3 deletions src/Tests/NoPublicApiChanges.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if !NETCORE
using DbUp.Tests.Common;
using DbUp.Tests.Common;

namespace DbUp.Tests.Providers.Firebird;

Expand All @@ -10,4 +9,3 @@ public NoPublicApiChanges()
{
}
}
#endif
12 changes: 6 additions & 6 deletions src/Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;net8</TargetFrameworks>
<TargetFramework>net8</TargetFramework>
<AssemblyName>Tests</AssemblyName>
<RootNamespace>DbUp.Firebird.Tests</RootNamespace>
<!-- <ImplicitUsings>enable</ImplicitUsings> Can't use implict usings with net46 -->
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\dbup-firebird\dbup-firebird.csproj"/>
<PackageReference Include="DbUp.Tests.Common" Version="5.0.37"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
<PackageReference Include="xunit" Version="2.6.6"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PackageReference Include="DbUp.Tests.Common" Version="6.0.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
3 changes: 3 additions & 0 deletions src/dbup-firebird.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQ/@EntryIndexedValue">SQ</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=4a98fdf6_002D7d98_002D4f5a_002Dafeb_002Dea44ad98c70c/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=f9fce829_002De6f4_002D4cb2_002D80f1_002D5497c44f51df/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters /&gt;&lt;/data&gt;</s:String>
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String></wpf:ResourceDictionary>
26 changes: 13 additions & 13 deletions src/dbup-firebird/FirebirdExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ public static void FirebirdDatabase(this SupportedDatabasesForEnsureDatabase sup
if (!File.Exists(builder.Database))
{
FbConnection.CreateDatabase(builder.ToString());
logger.WriteInformation("Created database {0}", builder.Database);
logger.LogInformation("Created database {0}", builder.Database);
}
else
{
logger.WriteInformation("Database {0} already exists", builder.Database);
logger.LogInformation("Database {0} already exists", builder.Database);
}
}
else
Expand All @@ -96,26 +96,26 @@ public static void FirebirdDatabase(this SupportedDatabasesForEnsureDatabase sup
{
conn.Open();
conn.Close();
logger.WriteInformation("Database {0} already exists", builder.Database);
logger.LogInformation("Database {0} already exists", builder.Database);
}
catch (FbException ex) when (ex.ErrorCode == FbIoError)
{
FbConnection.CreateDatabase(builder.ToString());
logger.WriteInformation("Created database {0}", builder.Database);
logger.LogInformation("Created database {0}", builder.Database);
}
catch (FbException ex) when (ex.ErrorCode == FbNetworkError)
{
logger.WriteError("Could not access server. The server: {0} is probably not started.", builder.DataSource);
logger.LogError("Could not access server. The server: {0} is probably not started.", builder.DataSource);
throw;
}
catch (FbException)
{
logger.WriteError("Ensure Database: Unknown firebird error when trying to access the server: {0}.", builder.DataSource);
logger.LogError("Ensure Database: Unknown firebird error when trying to access the server: {0}.", builder.DataSource);
throw;
}
catch (Exception)
{
logger.WriteError("Ensure Database: Unknown error when trying to access the server: {0}.", builder.DataSource);
logger.LogError("Ensure Database: Unknown error when trying to access the server: {0}.", builder.DataSource);
throw;
}
}
Expand All @@ -140,7 +140,7 @@ public static void FirebirdDatabase(this SupportedDatabasesForDropDatabase suppo
if (File.Exists(builder.Database))
{
FbConnection.DropDatabase(builder.ToString());
logger.WriteInformation("Dropped database {0}", builder.Database);
logger.LogInformation("Dropped database {0}", builder.Database);
}
}
else
Expand All @@ -150,25 +150,25 @@ public static void FirebirdDatabase(this SupportedDatabasesForDropDatabase suppo
//There seems to be an error in the FirebirdClient when trying to drop a database that does not exist.
//It gives a NullRefException instead of the expected FbException.
FbConnection.DropDatabase(builder.ToString());
logger.WriteInformation("Dropped database {0}", builder.Database);
logger.LogInformation("Dropped database {0}", builder.Database);
}
catch (FbException ex) when (ex.ErrorCode == FbIoError)
{
logger.WriteWarning("Nothing to Drop. No database found.");
logger.LogWarning("Nothing to Drop. No database found.");
}
catch (FbException ex) when (ex.ErrorCode == FbLockTimeout)
{
logger.WriteError("Can't drop database. Are there still an active connection?");
logger.LogError("Can't drop database. Are there still an active connection?");
throw;
}
catch (FbException)
{
logger.WriteError("Drop Database: Unknown firebird error when trying to access the server: {0}.", builder.DataSource);
logger.LogError("Drop Database: Unknown firebird error when trying to access the server: {0}.", builder.DataSource);
throw;
}
catch (Exception)
{
logger.WriteError("Drop Database: Unknown error when trying to access the server: {0}.", builder.DataSource);
logger.LogError("Drop Database: Unknown error when trying to access the server: {0}.", builder.DataSource);
throw;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/dbup-firebird/FirebirdScriptExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ protected override void ExecuteCommandsWithinExceptionHandler(int index, SqlScri
}
catch (FbException fbException)
{
Log().WriteInformation("Firebird exception has occured in script: '{0}'", script.Name);
Log().WriteError("Script block number: {0}; Firebird error code: {1}; SQLSTATE {2}; Message: {3}", index, fbException.ErrorCode, fbException.SQLSTATE, fbException.Message);
Log().WriteError(fbException.ToString());
Log().LogInformation("Firebird exception has occured in script: '{0}'", script.Name);
Log().LogError("Script block number: {0}; Firebird error code: {1}; SQLSTATE {2}; Message: {3}", index, fbException.ErrorCode, fbException.SQLSTATE, fbException.Message);
Log().LogError(fbException.ToString());
throw;
}
}
Expand Down
Loading

0 comments on commit a2b8fad

Please sign in to comment.