Skip to content

Commit 96462f9

Browse files
github actions
1 parent a8de5b2 commit 96462f9

File tree

12 files changed

+143
-55
lines changed

12 files changed

+143
-55
lines changed

.github/release.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# .github/release.yml
2+
3+
changelog:
4+
exclude:
5+
labels:
6+
- ignore-for-release
7+
authors:
8+
- octocat
9+
categories:
10+
- title: Breaking Changes 🛠
11+
labels:
12+
- breaking-change
13+
- title: Enhancements 🎉
14+
labels:
15+
- enhancement
16+
- title: Maintenance 🔩
17+
labels:
18+
- maintenance
19+
- title: Other Changes
20+
labels:
21+
- "*"
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: build and test
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build-and-test:
8+
runs-on: ubuntu-latest
9+
10+
env:
11+
DOTNET_NOLOGO: true
12+
DOTNET_CLI_TELEMETRY_OPTOUT: true
13+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Avoid pre-populating the NuGet package cache
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: Setup .NET
20+
uses: actions/setup-dotnet@v3
21+
with:
22+
dotnet-version: |
23+
8.0.x
24+
9.0.x
25+
26+
- name: Restore dependencies
27+
run: dotnet restore src/dbup-cli.sln
28+
29+
- name: Run unit tests
30+
run: dotnet test ./src/dbup-cli.tests --no-restore --collect:"XPlat Code Coverage"
31+
32+
- name: Run integration tests
33+
run: dotnet test ./src/dbup-cli.integration-tests --no-restore --collect:"XPlat Code Coverage"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: pull request validation
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build-and-publish:
8+
# uses: drewburlingame/dbup-cli/.github/workflows/build_and_test.yml@main
9+
uses: ./.github/workflows/build_and_test.yml
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: publish nuget package
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*" # Trigger on semantic versioning tags, e.g., v1.0.0
7+
- 'v*.*.*-*' # Pre-release tags, e.g., v1.0.0-beta, v2.1.0-alpha
8+
9+
jobs:
10+
build-and-test:
11+
# uses: drewburlingame/dbup-cli/.github/workflows/build_and_test.yml@main
12+
uses: ./.github/workflows/build_and_test.yml
13+
14+
publish:
15+
runs-on: ubuntu-latest
16+
needs: build-and-test
17+
18+
steps:
19+
# Extract version from tag (e.g., v1.2.3 -> 1.2.3)
20+
- name: Extract version from tag
21+
id: extract_version
22+
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
23+
shell: bash
24+
25+
- name: version
26+
run: echo "The extracted version is $VERSION"
27+
env:
28+
VERSION: ${{ env.VERSION }}
29+
30+
- name: Checkout code
31+
uses: actions/checkout@v3
32+
33+
- name: Setup .NET
34+
uses: actions/setup-dotnet@v3
35+
with:
36+
dotnet-version: |
37+
8.0.x
38+
9.0.x
39+
40+
- name: pwd
41+
run: pwd
42+
43+
- name: ls
44+
run: ls -a
45+
46+
- name: Pack NuGet package
47+
run: |
48+
dotnet pack ./src/dbup-cli/dbup-cli.csproj \
49+
--configuration Release \
50+
/p:PackageVersion=$VERSION \
51+
/p:ContinuousIntegrationBuild=true
52+
env:
53+
VERSION: ${{ env.VERSION }}
54+
55+
# Publish the package to NuGet.org
56+
- name: Publish NuGet Package
57+
env:
58+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
59+
VERSION: ${{ env.VERSION }}
60+
run: |
61+
dotnet nuget push ./src/dbup-cli/nupkg/*.nupkg \
62+
--api-key $NUGET_API_KEY \
63+
--source "https://api.nuget.org/v3/index.json"
64+
65+
# Create a GitHub release with auto-generated release notes
66+
- name: Release
67+
uses: softprops/action-gh-release@v2
68+
with:
69+
files: ./src/dbup-cli/nupkg/*.nupkg
70+
generate_release_notes: true
71+
draft: true
72+
prerelease: ${{ contains(env.VERSION, '-') }} # Mark as prerelease if contains '-' prerelease version
73+
token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ The tool has almost all the features the DbUp has, but without a single line of
6262

6363
|Date| Version |Description|
6464
|-|---------|-|
65-
|2024-01-18| 2.0.0 |Support net8 & net9, dropping all older frameworks. Upgrade to DbUp v6. DbUp support for Postgres is [beta](https://www.nuget.org/packages/dbup-postgresql) for v6. Drop Coachroach as [dbup package](https://www.nuget.org/packages/dbup-cockroachdb/) is outdated. It can be added back if someone provides an updated package.
65+
|2024-01-18| 2.0.0 |Support net8 & net9, dropping all older frameworks. Upgrade DbUp to v6.0.4. See [DbUp releases](https://github.com/DbUp/DbUp/releases) for additional behavior changes From 4.5.0 to 6.4.0. DbUp support for Postgres is [beta](https://www.nuget.org/packages/dbup-postgresql) for v6. Drop Coachroach as [dbup package](https://www.nuget.org/packages/dbup-cockroachdb/) is outdated. It can be added back if someone provides an updated package.
6666
|2023-06-12| 1.8.1 |Improve error reporting
6767
|2023-01-18| 1.8.0 |Add support of .Net 7.0
6868
|2022-06-11| 1.7.0 |Add support of CockroachDB, thanks to @lbguilherme

src/dbup-cli.integration-tests/MsSqlTests.cs

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace DbUp.Cli.IntegrationTests
1111
{
1212
[TestClass]
1313
public class MsSqlTests()
14-
: ContainerTest<MsSqlBuilder, MsSqlContainer, MsSqlConfiguration>("sqlserver")
14+
: ContainerTest<MsSqlBuilder, MsSqlContainer, MsSqlConfiguration>("SqlServer")
1515
{
1616
protected override MsSqlBuilder NewBuilder => new();
1717

@@ -34,34 +34,4 @@ protected override void AssertDbDoesNotExist(string connectionString, string dbN
3434
protected override string QueryCountOfScript001FromCustomJournal =>
3535
"select count(*) from dbo.testTable where scriptname = '001.sql'";
3636
}
37-
38-
[TestClass]
39-
public class PgSqlTests() : ContainerTest<PostgreSqlBuilder, PostgreSqlContainer, PostgreSqlConfiguration>("postgresql")
40-
{
41-
protected override PostgreSqlBuilder NewBuilder => new();
42-
43-
protected override string ReplaceDbInConnString(string connectionString, string dbName) =>
44-
connectionString.Replace(";Database=postgres;", $";Database={dbName};");
45-
46-
protected override IDbConnection GetConnection(string connectionString) =>
47-
new NpgsqlConnection(connectionString);
48-
49-
protected override void AssertDbDoesNotExist(string connectionString, string dbName)
50-
{
51-
using var connection = GetConnection(connectionString);
52-
Action a = () => connection.Open();
53-
a.Should().Throw<PostgresException>($"Database {dbName} should not exist");
54-
}
55-
56-
protected override string QueryCountOfScript001 =>
57-
"select count(*) from SchemaVersions where scriptname = '001.sql'";
58-
59-
protected override string QueryCountOfScript001FromCustomJournal =>
60-
"select count(*) from public.journal where scriptname = '001.sql'";
61-
62-
[Ignore("Not supported")]
63-
public override void Drop_DropADb()
64-
{
65-
}
66-
}
6737
}

src/dbup-cli.integration-tests/MySqlTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace DbUp.Cli.IntegrationTests
1010
{
1111
[TestClass]
1212
public class MySqlTests()
13-
: ContainerTest<MySqlBuilder, MySqlContainer, MySqlConfiguration>("mysql")
13+
: ContainerTest<MySqlBuilder, MySqlContainer, MySqlConfiguration>("MySql")
1414
{
1515
protected override MySqlBuilder NewBuilder => new MySqlBuilder()
1616
.WithUsername("root"); // root has perms for mysql for connecting to create the dbup db

src/dbup-cli.integration-tests/PostgreSqlTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace DbUp.Cli.IntegrationTests
99
{
1010
[TestClass]
1111
public class PostgreSqlTests()
12-
: ContainerTest<PostgreSqlBuilder, PostgreSqlContainer, PostgreSqlConfiguration>("postgresql")
12+
: ContainerTest<PostgreSqlBuilder, PostgreSqlContainer, PostgreSqlConfiguration>("PostgreSql")
1313
{
1414
protected override PostgreSqlBuilder NewBuilder => new();
1515

src/dbup-cli.integration-tests/dbup-cli.integration-tests.csproj

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,6 @@
3535
<None Update="Scripts\MySql\JournalTableScript\dbup.yml">
3636
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3737
</None>
38-
<None Update="Scripts\CockroachDb\EmptyScript\001.sql">
39-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
40-
</None>
41-
<None Update="Scripts\CockroachDb\EmptyScript\dbup.yml">
42-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
43-
</None>
44-
<None Update="Scripts\CockroachDb\JournalTableScript\001.sql">
45-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
46-
</None>
47-
<None Update="Scripts\CockroachDb\JournalTableScript\dbup.yml">
48-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
49-
</None>
50-
<None Update="Scripts\CockroachDb\Timeout\001.sql">
51-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
52-
</None>
53-
<None Update="Scripts\CockroachDb\Timeout\dbup.yml">
54-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
55-
</None>
5638
<None Update="Scripts\PostgreSql\EmptyScript\001.sql">
5739
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
5840
</None>

src/dbup-cli.tests/ConfigurationHelperTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public ConfigurationHelperTests()
4444
[TestMethod]
4545
public void SelectDbProvider_ShouldReturnNone_IfAProviderIsNotSupported()
4646
{
47-
var builder = ConfigurationHelper.SelectDbProvider(Provider.UnsupportedProfider, @"Data Source=(localdb)\dbup;Initial Catalog=dbup-tests;Integrated Security=True", 60);
47+
var builder = ConfigurationHelper.SelectDbProvider(Provider.UnsupportedProvider, @"Data Source=(localdb)\dbup;Initial Catalog=dbup-tests;Integrated Security=True", 60);
4848

4949
builder.HasValue.Should().BeFalse();
5050
}

0 commit comments

Comments
 (0)