Skip to content

Commit

Permalink
Revert "Use reusable workflow for build (#13)"
Browse files Browse the repository at this point in the history
This reverts commit 5997347.
  • Loading branch information
droyad committed Mar 20, 2024
1 parent 5997347 commit 5e42d31
Show file tree
Hide file tree
Showing 21 changed files with 220 additions and 92 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Checklist
- [ ] I have read the [Contributing Guide](https://github.com/DbUp/DbUp/blob/main/CONTRIBUTING.md)
- [ ] I have read the [Contributing Guide](https://github.com/DbUp/DbUp/blob/master/CONTRIBUTING.md)
- [ ] I have checked to ensure this does not introduce an unintended breaking changes
- [ ] I have considered appropriate testing for my change

Expand Down
71 changes: 69 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,72 @@ on:

jobs:
build:
name: Build
uses: DbUp/Universe/.github/workflows/build.yml@reusable
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
11 changes: 0 additions & 11 deletions .github/workflows/publish-release.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .github/workflows/test-report.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ Please only log issue related to MySql support in this repo. For cross cutting i

# Contributing

See the [readme in our main repo](https://github.com/DbUp/DbUp/blob/main/README.md) for how to get started and contribute.
See the [readme in our main repo](https://github.com/DbUp/DbUp/blob/master/README.md) for how to get started and contribute.
13 changes: 13 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,17 @@
<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>
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
DB Operation: Open connection
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 INFORMATION_SCHEMA.TABLES where TABLE_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 INFORMATION_SCHEMA.TABLES where TABLE_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
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 INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'TestSchemaVersions' and TABLE_SCHEMA = 'test'
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 INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'TestSchemaVersions' and TABLE_SCHEMA = 'test'
DB Operation: Dispose command
Info: Creating the `test`.`TestSchemaVersions` table
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
DB Operation: Open connection
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 INFORMATION_SCHEMA.TABLES where TABLE_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 INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions'
DB Operation: Dispose command
Info: Creating the `schemaversions` table
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
DB Operation: Open connection
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 INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions'
DB Operation: Dispose command
Info: Journal table does not exist
Info: Fetching list of already executed scripts.
DB Operation: Execute reader command: select scriptname from `schemaversions` order by scriptname
DB Operation: Dispose command
Info: Executing Database Server script 'Script0003'
Info: Checking whether journal table exists
Info: Checking whether journal table exists..
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions'
DB Operation: Dispose command
Info: Creating the `schemaversions` table
DB Operation: Execute non query command: CREATE TABLE `schemaversions`
(
`schemaversionid` INT NOT NULL AUTO_INCREMENT,
`scriptname` VARCHAR(255) NOT NULL,
`applied` TIMESTAMP NOT NULL,
PRIMARY KEY (`schemaversionid`)
);
DB Operation: Dispose command
Info: The `schemaversions` table has been created
DB Operation: Execute non query command: USE `test`;
DROP procedure IF EXISTS `testSproc`;

DELIMITER $$

USE `test`$$
CREATE PROCEDURE `testSproc`(
DB Operation: Execute non query command: USE `test`
DB Operation: Dispose command
DB Operation: Execute non query command: DROP procedure IF EXISTS `testSproc`
DB Operation: Dispose command
DB Operation: Execute non query command: USE `test`
DB Operation: Dispose command
DB Operation: Execute non query command: CREATE PROCEDURE `testSproc`(
IN ssn VARCHAR(32)
)
BEGIN
Expand All @@ -33,7 +25,7 @@ BEGIN
FROM customer as c
WHERE c.ssn = ssn ;

END$$
END
DB Operation: Dispose command
DB Operation: Create parameter
Info: DB Operation: Add parameter to command: scriptName=Script0003
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[assembly: System.CLSCompliantAttribute(true)]
[assembly: System.CLSCompliantAttribute(true)]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.Runtime.InteropServices.GuidAttribute("b6988607-c547-4cbd-8012-f8162a25092f")]

Expand Down
58 changes: 58 additions & 0 deletions src/Tests/ApprovalFiles/NoPublicApiChanges.Run.Net.verified.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[assembly: System.CLSCompliantAttribute(true)]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.Runtime.InteropServices.GuidAttribute("b6988607-c547-4cbd-8012-f8162a25092f")]

public static class MySqlExtensions
{
public static DbUp.Builder.UpgradeEngineBuilder MySqlDatabase(DbUp.Engine.Transactions.IConnectionManager connectionManager) { }
public static DbUp.Builder.UpgradeEngineBuilder MySqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString) { }
public static DbUp.Builder.UpgradeEngineBuilder MySqlDatabase(this DbUp.Builder.SupportedDatabases supported, DbUp.Engine.Transactions.IConnectionManager connectionManager) { }
public static DbUp.Builder.UpgradeEngineBuilder MySqlDatabase(DbUp.Engine.Transactions.IConnectionManager connectionManager, string schema) { }
public static DbUp.Builder.UpgradeEngineBuilder MySqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString, string schema) { }
public static void MySqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString) { }
public static void MySqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, int commandTimeout) { }
public static void MySqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, string collation) { }
public static void MySqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, int commandTimeout, string collation) { }
public static void MySqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger, int timeout = -1, string collation = null) { }
}
namespace DbUp.MySql
{
public class MySqlCommandReader : DbUp.Support.SqlCommandReader, System.IDisposable
{
public MySqlCommandReader(string sqlText) { }
protected override bool IsCustomStatement { get; }
protected override void ReadCustomStatement() { }
}
public class MySqlCommandSplitter
{
public MySqlCommandSplitter() { }
public System.Collections.Generic.IEnumerable<string> SplitScriptIntoCommands(string scriptContents) { }
}
public class MySqlConnectionManager : DbUp.Engine.Transactions.DatabaseConnectionManager, DbUp.Engine.Transactions.IConnectionManager
{
public MySqlConnectionManager(string connectionString) { }
public override System.Collections.Generic.IEnumerable<string> SplitScriptIntoCommands(string scriptContents) { }
}
public class MySqlObjectParser : DbUp.Support.SqlObjectParser, DbUp.Engine.ISqlObjectParser
{
public MySqlObjectParser() { }
}
public class MySqlPreprocessor : DbUp.Engine.IScriptPreprocessor
{
public MySqlPreprocessor() { }
public string Process(string contents) { }
}
public class MySqlScriptExecutor : DbUp.Support.ScriptExecutor, DbUp.Engine.IScriptExecutor
{
public MySqlScriptExecutor(System.Func<DbUp.Engine.Transactions.IConnectionManager> connectionManagerFactory, System.Func<DbUp.Engine.Output.IUpgradeLog> log, string schema, System.Func<bool> variablesEnabled, System.Collections.Generic.IEnumerable<DbUp.Engine.IScriptPreprocessor> scriptPreprocessors, System.Func<DbUp.Engine.IJournal> journalFactory) { }
protected override void ExecuteCommandsWithinExceptionHandler(int index, DbUp.Engine.SqlScript script, System.Action executeCommand) { }
protected override string GetVerifySchemaSql(string schema) { }
}
public class MySqlTableJournal : DbUp.Support.TableJournal, DbUp.Engine.IJournal
{
public MySqlTableJournal(System.Func<DbUp.Engine.Transactions.IConnectionManager> connectionManager, System.Func<DbUp.Engine.Output.IUpgradeLog> logger, string schema, string table) { }
protected override string CreateSchemaTableSql(string quotedPrimaryKeyName) { }
protected override string GetInsertJournalEntrySql(string scriptName, string applied) { }
protected override string GetJournalEntriesSql() { }
}
}
7 changes: 5 additions & 2 deletions src/Tests/DatabaseSupportTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using DbUp.Builder;
#if !NETCORE
using DbUp.Builder;
using DbUp.MySql;
using DbUp.Tests.Common;

namespace DbUp.MySql.Tests;
namespace DbUp.Tests.Providers.MySql;

public class DatabaseSupportTests : DatabaseSupportTestsBase
{
Expand All @@ -18,3 +20,4 @@ protected override UpgradeEngineBuilder AddCustomNamedJournalToBuilder(UpgradeEn
=> new MySqlTableJournal(connectionManagerFactory, logFactory, schema, tableName)
);
}
#endif
4 changes: 3 additions & 1 deletion src/Tests/MySqlConnectionManagerTests.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DbUp.MySql;
using Shouldly;
using Xunit;

namespace DbUp.MySql.Tests
namespace DbUp.Tests.Support.MySql
{
public class MySqlConnectionManagerTests
{
Expand Down
15 changes: 9 additions & 6 deletions src/Tests/MySqlSupportTests.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
using System.Threading.Tasks;
using Assent;
using DbUp.Tests.Common;
using DbUp.Tests.Common.RecordingDb;
using Shouldly;
using VerifyXunit;
using Xunit;

namespace DbUp.MySql.Tests
namespace DbUp.Tests.Support.MySql
{
[UsesVerify]
public class MySqlSupportTests
{
[Fact]
public void CanHandleDelimiter()
public Task CanHandleDelimiter()
{
var logger = new CaptureLogsLogger();
var recordingDbConnection = new RecordingDbConnection(logger);
var recordingDbConnection = new RecordingDbConnection(logger, "schemaversions");
recordingDbConnection.SetupRunScripts();
var upgrader = DeployChanges.To
.MySqlDatabase(new TestConnectionManager(recordingDbConnection))
.MySqlDatabase(string.Empty)
.OverrideConnectionFactory(recordingDbConnection)
.LogTo(logger)
.WithScript("Script0003", @"USE `test`;
DROP procedure IF EXISTS `testSproc`;
Expand All @@ -37,7 +40,7 @@ FROM customer as c
var result = upgrader.PerformUpgrade();

result.Successful.ShouldBe(true);
this.Assent(logger.Log, new Configuration().UsingSanitiser(Scrubbers.ScrubDates));
return Verifier.Verify(logger.Log, VerifyHelper.GetVerifySettings());
}
}
}
6 changes: 4 additions & 2 deletions src/Tests/NoPublicApiChanges.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using DbUp.Tests.Common;
#if !NETCORE
using DbUp.Tests.Common;

namespace DbUp.MySql.Tests;
namespace DbUp.Tests.Providers.MySql;

public class NoPublicApiChanges : NoPublicApiChangesBase
{
Expand All @@ -9,3 +10,4 @@ public NoPublicApiChanges()
{
}
}
#endif
Loading

0 comments on commit 5e42d31

Please sign in to comment.