Skip to content

Commit abf1522

Browse files
committed
Merging dev updates
2 parents e8560ff + 971646e commit abf1522

File tree

116 files changed

+2771
-100
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+2771
-100
lines changed

.github/actions/build-with-plugins/action.yml

+39-6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ inputs:
1010
runtime:
1111
description: Target platform runtime (win-x64)
1212
required: true
13+
build-version:
14+
description: Build or release version (0.0.1)
15+
required: true
1316
runs:
1417
using: composite
1518
steps:
@@ -27,7 +30,7 @@ runs:
2730
-p:EnableCompressionInSingleFile=true \
2831
-p:PublishReadyToRun=false \
2932
-p:PublishTrimmed=false \
30-
-p:Version=0.0.${{ github.run_number }}
33+
-p:Version=${{ inputs.build-version }}
3134
- name: Build Cosmos Extension
3235
shell: bash
3336
run: |
@@ -42,7 +45,7 @@ runs:
4245
-p:EnableCompressionInSingleFile=true \
4346
-p:PublishReadyToRun=false \
4447
-p:PublishTrimmed=false \
45-
-p:Version=0.0.${{ github.run_number }}
48+
-p:Version=${{ inputs.build-version }}
4649
- name: Build JSON Extension
4750
shell: bash
4851
run: |
@@ -57,7 +60,7 @@ runs:
5760
-p:EnableCompressionInSingleFile=true \
5861
-p:PublishReadyToRun=false \
5962
-p:PublishTrimmed=false \
60-
-p:Version=0.0.${{ github.run_number }}
63+
-p:Version=${{ inputs.build-version }}
6164
- name: Build Azure Table Extension
6265
shell: bash
6366
run: |
@@ -72,7 +75,7 @@ runs:
7275
-p:EnableCompressionInSingleFile=true \
7376
-p:PublishReadyToRun=false \
7477
-p:PublishTrimmed=false \
75-
-p:Version=0.0.${{ github.run_number }}
78+
-p:Version=${{ inputs.build-version }}
7679
- name: Build Mongo Extension
7780
shell: bash
7881
run: |
@@ -87,7 +90,7 @@ runs:
8790
-p:EnableCompressionInSingleFile=true \
8891
-p:PublishReadyToRun=false \
8992
-p:PublishTrimmed=false \
90-
-p:Version=0.0.${{ github.run_number }}
93+
-p:Version=${{ inputs.build-version }}
9194
- name: Build SQL Server Extension
9295
shell: bash
9396
run: |
@@ -102,7 +105,37 @@ runs:
102105
-p:EnableCompressionInSingleFile=true \
103106
-p:PublishReadyToRun=false \
104107
-p:PublishTrimmed=false \
105-
-p:Version=0.0.${{ github.run_number }}
108+
-p:Version=${{ inputs.build-version }}
109+
- name: Build Parquet Extension
110+
shell: bash
111+
run: |
112+
dotnet publish \
113+
Extensions/Parquet/Cosmos.DataTransfer.ParquetExtension/Cosmos.DataTransfer.ParquetExtension.csproj \
114+
--configuration Release \
115+
--output ${{ inputs.platform-short }}/Extensions \
116+
--self-contained false \
117+
--runtime ${{ inputs.runtime }} \
118+
-p:PublishSingleFile=false \
119+
-p:DebugType=embedded \
120+
-p:EnableCompressionInSingleFile=true \
121+
-p:PublishReadyToRun=false \
122+
-p:PublishTrimmed=false \
123+
-p:Version=${{ inputs.build-version }}
124+
- name: Build Cognitive Search Extension
125+
shell: bash
126+
run: |
127+
dotnet publish \
128+
Extensions/CognitiveSearch/Cosmos.DataTransfer.CognitiveSearchExtension/Cosmos.DataTransfer.CognitiveSearchExtension.csproj \
129+
--configuration Release \
130+
--output ${{ inputs.platform-short }}/Extensions \
131+
--self-contained false \
132+
--runtime ${{ inputs.runtime }} \
133+
-p:PublishSingleFile=false \
134+
-p:DebugType=embedded \
135+
-p:EnableCompressionInSingleFile=true \
136+
-p:PublishReadyToRun=false \
137+
-p:PublishTrimmed=false \
138+
-p:Version=${{ inputs.build-version }}
106139
- name: Upload package
107140
uses: actions/upload-artifact@v3
108141
with:

.github/workflows/dotnet-build-test.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: .NET
1+
name: Build and Test all .NET projects
22

33
on:
44
push:
@@ -8,9 +8,9 @@ on:
88

99
jobs:
1010
build:
11-
11+
name: Build and test .NET projects
1212
runs-on: ubuntu-latest
13-
13+
container: mcr.microsoft.com/dotnet/sdk:6.0
1414
steps:
1515
- uses: actions/checkout@v3
1616
- name: Setup .NET
@@ -28,4 +28,4 @@ jobs:
2828
uses: actions/upload-artifact@v3
2929
with:
3030
name: debug-build
31-
path: /home/runner/work/azure-documentdb-datamigrationtool/azure-documentdb-datamigrationtool/Core/Cosmos.DataTransfer.Core/bin/Debug/net6.0 #path/to/artifact/ # or path/to/artifact
31+
path: /home/runner/work/data-migration-desktop-tool/data-migration-desktop-tool/Core/Cosmos.DataTransfer.Core/bin/Debug/net6.0 #path/to/artifact/ # or path/to/artifact

.github/workflows/internal-test-build.yml

+3
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,20 @@ jobs:
2222
platform: windows
2323
platform-short: win
2424
runtime: win-x64
25+
build-version: 0.0.${{ github.run_number }}
2526
- name: Execute Action build-with-plugins for MacOS
2627
uses: ./.github/actions/build-with-plugins
2728
id: build-with-plugins-mac
2829
with:
2930
platform: mac
3031
platform-short: mac
3132
runtime: osx-x64
33+
build-version: 0.0.${{ github.run_number }}
3234
- name: Execute Action build-with-plugins for Linux
3335
uses: ./.github/actions/build-with-plugins
3436
id: build-with-plugins-linux
3537
with:
3638
platform: linux
3739
platform-short: linux
3840
runtime: linux-x64
41+
build-version: 0.0.${{ github.run_number }}

.github/workflows/release.yml

+9-6
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ jobs:
2626
path: linux-package
2727
- name: Package output files
2828
run: |
29-
zip -r dmt-${{ github.ref_name }}-win-x64.zip windows-package/*
30-
zip -r dmt-${{ github.ref_name }}-mac-x64.zip mac-package/*
31-
zip -r dmt-${{ github.ref_name }}-linux-x64.zip linux-package/*
29+
zip -r dmt-${{ github.event.release.tag_name }}-win-x64.zip windows-package/*
30+
zip -r dmt-${{ github.event.release.tag_name }}-mac-x64.zip mac-package/*
31+
zip -r dmt-${{ github.event.release.tag_name }}-linux-x64.zip linux-package/*
3232
- name: Create GitHub release
3333
uses: softprops/action-gh-release@v1
3434
with:
3535
files: |
36-
dmt-${{ github.ref_name }}-win-x64.zip
37-
dmt-${{ github.ref_name }}-mac-x64.zip
38-
dmt-${{ github.ref_name }}-linux-x64.zip
36+
dmt-${{ github.event.release.tag_name }}-win-x64.zip
37+
dmt-${{ github.event.release.tag_name }}-mac-x64.zip
38+
dmt-${{ github.event.release.tag_name }}-linux-x64.zip
3939
build-package:
4040
name: Build self-contained executables
4141
runs-on: ubuntu-latest
@@ -52,17 +52,20 @@ jobs:
5252
platform: windows
5353
platform-short: win
5454
runtime: win-x64
55+
build-version: ${{ github.event.release.tag_name }}
5556
- name: Execute Action build-with-plugins for MacOS
5657
uses: ./.github/actions/build-with-plugins
5758
id: build-with-plugins-mac
5859
with:
5960
platform: mac
6061
platform-short: mac
6162
runtime: osx-x64
63+
build-version: ${{ github.event.release.tag_name }}
6264
- name: Execute Action build-with-plugins for Linux
6365
uses: ./.github/actions/build-with-plugins
6466
id: build-with-plugins-linux
6567
with:
6668
platform: linux
6769
platform-short: linux
6870
runtime: linux-x64
71+
build-version: ${{ github.event.release.tag_name }}

.github/workflows/validate.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Validate all .NET projects
22
on:
3-
pull_request:
4-
branches:
5-
- main
3+
# pull_request:
4+
# branches:
5+
# - main
6+
workflow_dispatch:
67
jobs:
78
build-test:
89
name: Build and test .NET projects

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -433,3 +433,4 @@ FodyWeavers.xsd
433433

434434
# macOS .DS_Store
435435
**/.DS_Store
436+
/Core/Cosmos.DataTransfer.Core/migrationsettings.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
using Cosmos.DataTransfer.Interfaces;
2+
using Cosmos.DataTransfer.Interfaces.Manifest;
3+
using Microsoft.Extensions.Logging.Abstractions;
4+
using Microsoft.VisualStudio.TestTools.UnitTesting;
5+
using Moq;
6+
using System;
7+
using System.Collections.Generic;
8+
using System.CommandLine;
9+
using System.CommandLine.Invocation;
10+
using System.ComponentModel.DataAnnotations;
11+
using System.Text;
12+
using System.Text.Json;
13+
using System.Text.Json.Serialization;
14+
15+
namespace Cosmos.DataTransfer.Core.UnitTests
16+
{
17+
[TestClass]
18+
public class SettingsCommandTests
19+
{
20+
[TestMethod]
21+
public void Invoke_ForTestExtension_ProducesValidSettingsJson()
22+
{
23+
var command = new SettingsCommand();
24+
const string source = "testSource";
25+
var loader = new Mock<IExtensionManifestBuilder>();
26+
var sourceExtension = new Mock<IDataSourceExtensionWithSettings>();
27+
sourceExtension.SetupGet(ds => ds.DisplayName).Returns(source);
28+
sourceExtension.Setup(ds => ds.GetSettings()).Returns(new List<IDataExtensionSettings>
29+
{
30+
new MockExtensionSettings(),
31+
new MockExtensionSettings2()
32+
});
33+
loader
34+
.Setup(l => l.GetSources())
35+
.Returns(new List<IDataSourceExtension> { sourceExtension.Object });
36+
37+
var writer = new Mock<IRawOutputWriter>();
38+
var outputLines = new List<string>();
39+
writer.Setup(w => w.WriteLine(It.IsAny<string>())).Callback<string>(s => outputLines.Add(s));
40+
var handler = new SettingsCommand.CommandHandler(loader.Object, writer.Object, NullLogger<SettingsCommand.CommandHandler>.Instance)
41+
{
42+
Source = true,
43+
Extension = source
44+
};
45+
46+
var parseResult = new SettingsCommand().Parse(Array.Empty<string>());
47+
var result = handler.Invoke(new InvocationContext(parseResult));
48+
Assert.AreEqual(0, result);
49+
50+
bool jsonStarted = false;
51+
var stringBuilder = new StringBuilder();
52+
foreach (string item in outputLines)
53+
{
54+
if (item == "<<<")
55+
jsonStarted = true;
56+
else if (item == ">>>")
57+
jsonStarted = false;
58+
else if (jsonStarted)
59+
stringBuilder.AppendLine(item);
60+
}
61+
62+
var options = new JsonSerializerOptions
63+
{
64+
Converters = { new JsonStringEnumConverter() },
65+
WriteIndented = true
66+
};
67+
var fullJson = stringBuilder.ToString().Trim();
68+
var parsed = JsonSerializer.Deserialize<List<ExtensionSettingProperty>>(fullJson, options);
69+
var parsedJson = JsonSerializer.Serialize<List<ExtensionSettingProperty>>(parsed, options);
70+
71+
Assert.AreEqual(fullJson, parsedJson);
72+
}
73+
}
74+
75+
public class MockExtensionSettings : IDataExtensionSettings
76+
{
77+
[Required]
78+
public string Name { get; set; } = null!;
79+
public string? Description { get; set; }
80+
public int Count { get; set; } = 99;
81+
public int? MaxValue { get; set; }
82+
public double? Avg { get; set; }
83+
public bool Enabled { get; set; } = true;
84+
public JsonCommentHandling TestEnum { get; set; }
85+
}
86+
87+
public class MockExtensionSettings2 : IDataExtensionSettings
88+
{
89+
[Required]
90+
public string? AnotherProperty { get; set; }
91+
}
92+
}

Core/Cosmos.DataTransfer.Core/Cosmos.DataTransfer.Core.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</PropertyGroup>
2020

2121
<ItemGroup>
22-
<PackageReference Include="Azure.Core" Version="1.25.0" />
22+
<PackageReference Include="Azure.Core" Version="1.31.0" />
2323
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.0.0" />
2424
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.1" />
2525
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />

Core/Cosmos.DataTransfer.Core/DataTransferOptions.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
public class DataTransferOptions
44
{
55
public string? Source { get; set; }
6-
public string? Sink { get; set; }
6+
private string? _sink;
7+
public string? Sink { get => _sink; set => _sink = value; }
8+
public string? Target { get => _sink; set => _sink = value; }
9+
public string? Destination { get => _sink; set => _sink = value; }
710
public string? SettingsPath { get; set; }
811
}

0 commit comments

Comments
 (0)