Skip to content

Commit 3c54a14

Browse files
committed
Merge branch 'release/3.808.0'
2 parents e6a3f93 + 9222441 commit 3c54a14

File tree

30 files changed

+3320
-2664
lines changed

30 files changed

+3320
-2664
lines changed

.github/workflows/module-ci.yml

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# v3.800.11
2-
# bump-ubuntu-version
1+
# v3.800.13
2+
# https://virtocommerce.atlassian.net/browse/VCST-2789
33
name: Module CI
44

55
on:
@@ -54,6 +54,7 @@ jobs:
5454
moduleId: ${{ steps.artifact_ver.outputs.moduleId }}
5555
matrix: ${{ steps.deployment-matrix.outputs.matrix }}
5656
run-e2e: ${{ steps.run-e2e.outputs.result }}
57+
run-ui-tests: ${{ steps.run-ui-tests.outputs.result }}
5758

5859
steps:
5960

@@ -98,6 +99,7 @@ jobs:
9899
else
99100
echo "VERSION_SUFFIX=${{ steps.artifact_ver.outputs.suffix }}" >> $GITHUB_ENV
100101
fi;
102+
101103
- name: Add version suffix
102104
if: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }}
103105
uses: VirtoCommerce/vc-github-actions/add-version-suffix@master
@@ -191,6 +193,27 @@ jobs:
191193
echo "result=true" >> $GITHUB_OUTPUT
192194
fi
193195
196+
- name: Look for xapi module in dependencies
197+
id: run-ui-tests
198+
shell: pwsh
199+
run: |
200+
$manifestFile = Get-ChildItem -Path ${{ github.workspace }} -Recurse -Filter "module.manifest" | Where-Object { $_.FullName -like "*/src/*/module.manifest" } | Select-Object -First 1
201+
if (-not $manifestFile) {
202+
Write-Error "No module.manifest file found in src subdirectories"
203+
exit 1
204+
}
205+
Write-Host "Found module.manifest at: $($manifestFile.FullName)"
206+
$manifestContent = Get-Content $manifestFile.FullName -Raw
207+
$containsXapi = 'false'
208+
$dependecies = $(Select-Xml -Content $manifestContent -XPath "//dependencies").Node.dependency
209+
foreach ($dependency in $dependecies) {
210+
if ($dependency.id -eq 'VirtoCommerce.Xapi') {
211+
Write-Host "Found VirtoCommerce.Xapi in dependencies"
212+
$containsXapi = 'true'
213+
}
214+
}
215+
echo "result=$containsXapi" >> $env:GITHUB_OUTPUT
216+
194217
- name: Setup Git Credentials
195218
if: ${{ (github.ref == 'refs/heads/dev' && github.event_name != 'workflow_dispatch') || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
196219
uses: VirtoCommerce/vc-github-actions/setup-git-credentials-github@master
@@ -237,17 +260,30 @@ jobs:
237260
run: |
238261
echo "Jira Upload Build Info response: ${{ steps.push_build_info_to_jira.outputs.response }}"
239262
263+
ui-auto-tests:
264+
if: ${{ ((github.ref == 'refs/heads/dev') && (github.event_name == 'push')) ||
265+
(github.event_name == 'workflow_dispatch') || ((github.base_ref == 'dev') && (github.event_name == 'pull_request')) }}
266+
needs: 'ci'
267+
uses: VirtoCommerce/.github/.github/workflows/ui-autotests.yml@v3.800.13
268+
with:
269+
installModules: 'false'
270+
installCustomModule: 'true'
271+
customModuleId: ${{ needs.ci.outputs.moduleId }}
272+
customModuleUrl: ${{ needs.ci.outputs.artifactUrl }}
273+
runTests: ${{ needs.ci.outputs.run-ui-tests }}
274+
secrets:
275+
envPAT: ${{ secrets.REPO_TOKEN }}
276+
240277
module-katalon-tests:
241278
if: ${{ ((github.ref == 'refs/heads/dev') && (github.event_name == 'push') && (needs.ci.outputs.run-e2e == 'true')) ||
242279
(github.event_name == 'workflow_dispatch') || (github.base_ref == 'dev') && (github.event_name == 'pull_request') }}
243280
needs: 'ci'
244-
uses: VirtoCommerce/.github/.github/workflows/e2e.yml@v3.800.11
245-
281+
uses: VirtoCommerce/.github/.github/workflows/e2e.yml@v3.800.13
246282
with:
247283
katalonRepo: 'VirtoCommerce/vc-quality-gate-katalon'
248284
katalonRepoBranch: 'dev'
249285
testSuite: 'Test Suites/Modules/Platform_collection'
250-
installModules: 'true'
286+
installModules: 'false'
251287
installCustomModule: 'true'
252288
customModuleId: ${{ needs.ci.outputs.moduleId }}
253289
customModuleUrl: ${{ needs.ci.outputs.artifactUrl }}
@@ -260,7 +296,7 @@ jobs:
260296
deploy-cloud:
261297
if: ${{ (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && github.event_name == 'push' }}
262298
needs: ci
263-
uses: VirtoCommerce/.github/.github/workflows/deploy-cloud.yml@v3.800.11
299+
uses: VirtoCommerce/.github/.github/workflows/deploy-cloud.yml@v3.800.13
264300
with:
265301
releaseSource: module
266302
moduleId: ${{ needs.ci.outputs.moduleId }}
@@ -269,4 +305,4 @@ jobs:
269305
jiraKeys: ${{ needs.ci.outputs.jira-keys }}
270306
argoServer: 'argo.virtocommerce.cloud'
271307
matrix: '{"include":${{ needs.ci.outputs.matrix }}}'
272-
secrets: inherit
308+
secrets: inherit

.github/workflows/module-release-hotfix.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# v3.800.11
2-
# bump-ubuntu-version
1+
# v3.800.13
2+
# https://virtocommerce.atlassian.net/browse/VCST-2789
33
name: Release hotfix
44

55
on:
@@ -13,12 +13,12 @@ on:
1313

1414
jobs:
1515
test:
16-
uses: VirtoCommerce/.github/.github/workflows/test-and-sonar.yml@v3.800.11
16+
uses: VirtoCommerce/.github/.github/workflows/test-and-sonar.yml@v3.800.13
1717
secrets:
1818
sonarToken: ${{ secrets.SONAR_TOKEN }}
1919

2020
build:
21-
uses: VirtoCommerce/.github/.github/workflows/build.yml@v3.800.11
21+
uses: VirtoCommerce/.github/.github/workflows/build.yml@v3.800.13
2222
with:
2323
uploadPackage: 'true'
2424
uploadDocker: 'false'
@@ -46,7 +46,7 @@ jobs:
4646
publish-github-release:
4747
needs:
4848
[build, test, get-metadata]
49-
uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@v3.800.11
49+
uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@v3.800.13
5050
with:
5151
fullKey: ${{ needs.build.outputs.packageFullKey }}
5252
changeLog: '${{ needs.get-metadata.outputs.changeLog }}'

.github/workflows/publish-nugets.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# v3.800.11
2-
# bump-ubuntu-version
1+
# v3.800.13
2+
# https://virtocommerce.atlassian.net/browse/VCST-2789
33
name: Publish nuget
44

55
on:
@@ -13,12 +13,12 @@ on:
1313

1414
jobs:
1515
test:
16-
uses: VirtoCommerce/.github/.github/workflows/test-and-sonar.yml@v3.800.11
16+
uses: VirtoCommerce/.github/.github/workflows/test-and-sonar.yml@v3.800.13
1717
secrets:
1818
sonarToken: ${{ secrets.SONAR_TOKEN }}
1919

2020
build:
21-
uses: VirtoCommerce/.github/.github/workflows/build.yml@v3.800.11
21+
uses: VirtoCommerce/.github/.github/workflows/build.yml@v3.800.13
2222
with:
2323
uploadPackage: 'true'
2424
uploadDocker: 'false'
@@ -29,10 +29,12 @@ jobs:
2929
publish-nuget:
3030
needs:
3131
[build, test]
32-
uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@v3.800.11
32+
uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@v3.800.13
3333
with:
3434
fullKey: ${{ needs.build.outputs.packageFullKey }}
3535
forceGithub: false
36+
forceBlob: true
3637
secrets:
3738
envPAT: ${{ secrets.GITHUB_TOKEN }}
3839
nugetKey: ${{ secrets.NUGET_KEY }}
40+
BLOB_TOKEN: ${{ secrets.BLOB_TOKEN }}

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# v3.800.11
2-
# bump-ubuntu-version
1+
# v3.800.13
2+
# https://virtocommerce.atlassian.net/browse/VCST-2789
33
name: Release
44

55
on:
66
workflow_dispatch:
77

88
jobs:
99
release:
10-
uses: VirtoCommerce/.github/.github/workflows/release.yml@v3.800.11
10+
uses: VirtoCommerce/.github/.github/workflows/release.yml@v3.800.13
1111
secrets:
1212
envPAT: ${{ secrets.REPO_TOKEN }}

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project>
33
<PropertyGroup>
4-
<VersionPrefix>3.807.0</VersionPrefix>
4+
<VersionPrefix>3.808.0</VersionPrefix>
55
<VersionSuffix>
66
</VersionSuffix>
77
<VersionSuffix Condition=" '$(VersionSuffix)' != '' AND '$(BuildNumber)' != '' ">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>

src/VirtoCommerce.ImportModule.Core/Models/ImportProfile.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public ImportProfile()
2929
public string ImportReporterType { get; set; }
3030
public int PreviewObjectCount { get; set; } = 10;
3131

32+
public ImportRunHistory RunHistory { get; set; }
33+
3234
public virtual void Update(ImportProfile importProfile)
3335
{
3436
Name = importProfile.Name;

src/VirtoCommerce.ImportModule.Core/Models/ImportRunHistory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public class ImportRunHistory : AuditableEntity, ICloneable
1414
public string JobId { get; set; }
1515
public string ProfileId { get; set; }
1616
public string ProfileName { get; set; }
17+
public string Name { get; set; }
1718
public DateTime Executed { get; set; }
1819
public DateTime? Finished { get; set; }
1920
public int TotalCount { get; set; }

src/VirtoCommerce.ImportModule.Core/PushNotifications/ImportPushNotification.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public ImportPushNotification(string creator)
1414
public string ProfileName { get; set; }
1515

1616
public string JobId { get; set; }
17+
public string RunId { get; set; }
1718
public bool EstimatingRemaining { get; set; }
1819
public TimeSpan? EstimatedRemaining { get; set; }
1920
public DateTime? Finished { get; set; }

src/VirtoCommerce.ImportModule.CsvHelper/CsvDataReader.cs

Lines changed: 71 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,24 @@ namespace VirtoCommerce.ImportModule.CsvHelper
1414
{
1515
public class CsvDataReader<TCsvImportable, TCsvClassMap> : IImportDataReader where TCsvClassMap : ClassMap
1616
{
17-
private readonly Stream _stream;
18-
1917
private readonly int _pageSize;
2018
private readonly bool _needReadRaw;
21-
private int? _totalCount;
22-
private string _headerRaw;
19+
private bool _disposed;
2320
protected CsvConfiguration CsvConfiguration { get; set; }
21+
protected readonly Stream Stream;
22+
protected readonly Stream CountStream;
2423
protected readonly CsvReader CsvReader;
24+
protected string HeaderRaw;
25+
protected int? TotalCount;
2526

2627
public bool HasMoreResults { get; private set; } = true;
2728

2829
public CsvDataReader(Stream stream, ImportContext context, bool needReadRaw = false)
2930
{
3031
CsvConfiguration = GetConfiguration(context);
3132

32-
_stream = stream;
33-
CsvReader = new CsvReader(new StreamReader(_stream), CsvConfiguration);
33+
Stream = stream;
34+
CsvReader = new CsvReader(new StreamReader(Stream), CsvConfiguration);
3435
CsvReader.Context.RegisterClassMap<TCsvClassMap>();
3536

3637
_pageSize = Convert.ToInt32(context.ImportProfile.Settings.FirstOrDefault(x => x.Name == CsvSettings.PageSize.Name)?.Value ?? 50);
@@ -41,42 +42,73 @@ public CsvDataReader(Stream stream, ImportContext context, CsvConfiguration csvC
4142
{
4243
CsvConfiguration = MergeWithDefaultConfig(csvConfiguration, context);
4344

44-
_stream = stream;
45-
CsvReader = new CsvReader(new StreamReader(_stream), CsvConfiguration);
45+
Stream = stream;
46+
CsvReader = new CsvReader(new StreamReader(Stream), CsvConfiguration);
4647
CsvReader.Context.RegisterClassMap<TCsvClassMap>();
4748

4849
_pageSize = Convert.ToInt32(context.ImportProfile.Settings.FirstOrDefault(x => x.Name == CsvSettings.PageSize.Name)?.Value ?? 50);
4950
_needReadRaw = needReadRaw;
5051
}
5152

53+
public CsvDataReader(Stream stream, Stream countStream, ImportContext context, bool needReadRaw = false)
54+
: this(stream, context, needReadRaw)
55+
{
56+
CountStream = countStream;
57+
}
58+
59+
public CsvDataReader(Stream stream, Stream countStream, ImportContext context, CsvConfiguration csvConfiguration, bool needReadRaw = false)
60+
: this(stream, context, csvConfiguration, needReadRaw)
61+
{
62+
CountStream = countStream;
63+
}
64+
5265
public virtual async Task<int> GetTotalCountAsync(ImportContext context)
5366
{
54-
if (_totalCount.HasValue)
67+
if (TotalCount.HasValue)
5568
{
56-
return _totalCount.Value;
69+
return TotalCount.Value;
5770
}
5871

59-
var streamPosition = _stream.Position;
60-
_stream.Seek(0, SeekOrigin.Begin);
72+
Stream stream;
73+
bool leaveOpen;
74+
if (Stream.CanSeek)
75+
{
76+
stream = Stream;
77+
leaveOpen = true;
78+
}
79+
else
80+
{
81+
stream = CountStream ?? throw new InvalidOperationException("Count stream is not provided.");
82+
leaveOpen = false;
83+
}
6184

62-
var streamReader = new StreamReader(_stream, leaveOpen: true);
63-
var csvReader = new CsvReader(streamReader, CsvConfiguration);
85+
var streamPosition = 0L;
86+
if (stream.CanSeek)
87+
{
88+
streamPosition = stream.Position;
89+
stream.Seek(0, SeekOrigin.Begin);
90+
}
91+
92+
using var csvReader = new CsvReader(new StreamReader(stream), CsvConfiguration, leaveOpen);
6493

6594
await csvReader.ReadAsync();
6695
csvReader.ReadHeader();
6796

68-
_headerRaw = string.Join(csvReader.Configuration.Delimiter, csvReader.HeaderRecord);
97+
HeaderRaw = string.Join(csvReader.Configuration.Delimiter, csvReader.HeaderRecord);
6998

70-
_totalCount = 0;
99+
TotalCount = 0;
71100

72101
while (await csvReader.ReadAsync())
73102
{
74-
_totalCount++;
103+
TotalCount++;
75104
}
76105

77-
_stream.Seek(streamPosition, SeekOrigin.Begin);
106+
if (stream.CanSeek)
107+
{
108+
stream.Seek(streamPosition, SeekOrigin.Begin);
109+
}
78110

79-
return _totalCount.Value;
111+
return TotalCount.Value;
80112
}
81113

82114
public virtual async Task<object[]> ReadNextPageAsync(ImportContext context)
@@ -103,7 +135,7 @@ public virtual async Task<object[]> ReadNextPageAsync(ImportContext context)
103135
result.Add(new CsvImportRecord<TCsvImportable>
104136
{
105137
Row = row,
106-
RawHeader = _headerRaw,
138+
RawHeader = HeaderRaw,
107139
RawRecord = rawRecord,
108140
Record = record,
109141
});
@@ -188,21 +220,30 @@ public void Dispose()
188220

189221
protected virtual void Dispose(bool disposing)
190222
{
191-
CsvReader.Dispose();
192-
_stream?.Dispose();
223+
if (_disposed)
224+
{
225+
return;
226+
}
227+
if (disposing)
228+
{
229+
CsvReader.Dispose();
230+
Stream?.Dispose();
231+
CountStream?.Dispose();
232+
}
233+
_disposed = true;
193234
}
194235

195236
private CsvConfiguration MergeWithDefaultConfig(CsvConfiguration csvConfiguration, ImportContext context)
196237
{
197238
var defaultCsvConfiguration = GetConfiguration(context);
198-
var result = csvConfiguration;
199-
result.Delimiter = result.Delimiter ?? defaultCsvConfiguration.Delimiter;
200-
result.PrepareHeaderForMatch = result.PrepareHeaderForMatch ?? defaultCsvConfiguration.PrepareHeaderForMatch;
201-
result.BadDataFound = result.BadDataFound ?? defaultCsvConfiguration.BadDataFound;
202-
result.ReadingExceptionOccurred = result.ReadingExceptionOccurred ?? defaultCsvConfiguration.ReadingExceptionOccurred;
203-
result.MissingFieldFound = result.MissingFieldFound ?? defaultCsvConfiguration.MissingFieldFound;
204-
205-
return result;
239+
240+
csvConfiguration.Delimiter ??= defaultCsvConfiguration.Delimiter;
241+
csvConfiguration.PrepareHeaderForMatch ??= defaultCsvConfiguration.PrepareHeaderForMatch;
242+
csvConfiguration.BadDataFound ??= defaultCsvConfiguration.BadDataFound;
243+
csvConfiguration.ReadingExceptionOccurred ??= defaultCsvConfiguration.ReadingExceptionOccurred;
244+
csvConfiguration.MissingFieldFound ??= defaultCsvConfiguration.MissingFieldFound;
245+
246+
return csvConfiguration;
206247
}
207248
}
208249
}

0 commit comments

Comments
 (0)