Skip to content

Commit

Permalink
Merge pull request #96 from HicServices/develop
Browse files Browse the repository at this point in the history
v1.1.0 release
  • Loading branch information
tznind committed Jul 11, 2022
2 parents 131103c + 7b8ec5e commit ac7756c
Show file tree
Hide file tree
Showing 19 changed files with 422 additions and 30 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
target-branch: develop
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"
Expand Down
25 changes: 17 additions & 8 deletions .github/workflows/testpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,30 @@ jobs:
package:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
- name: Test
run: dotnet test --nologo
- name: Package
run: |
(cd BadMedicine.Core && dotnet pack -p:PackageVersion=$(fgrep AssemblyInformationalVersion ../SharedAssemblyInfo.cs|cut -d'"' -f2) -o . --include-source --include-symbols --nologo -c Release)
(cd BadMedicine && dotnet publish --nologo --runtime win-x64 -c Release --self-contained true -o ../win-x64)
(cd BadMedicine && dotnet publish --nologo --runtime linux-x64 -c Release --self-contained true -o ../linux-x64)
(cd win-x64 && zip -9r ../badmedicine-cli-win-x64.zip .)
(tar czf badmedicine-cli-linux-x64.tgz ./linux-x64)
dotnet publish BadMedicine/BadMedicine.csproj -o linux-x64 -r linux-x64 -c Release --self-contained --nologo -p:PublishSingleFile=true -p:GenerateDocumentationFile=false
dotnet publish BadMedicine/BadMedicine.csproj -o win-x64 -r win-x64 -c Release --self-contained --nologo -p:PublishSingleFile=true -p:GenerateDocumentationFile=false
dotnet pack BadMedicine.Core/BadMedicine.Core.csproj -p:PackageVersion=$(fgrep AssemblyInformationalVersion SharedAssemblyInfo.cs|cut -d'"' -f2) -o . --include-source --include-symbols --nologo -c Release
tar czf badmedicine-cli-linux-x64.tgz ./linux-x64
zip -9rj badmedicine-cli-win-x64.zip win-x64
- name: Nuget push
if: contains(github.ref,'refs/tags/')
run: (cd BadMedicine.Core && nuget push HIC.*.nupkg -skipDuplicate -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NUGET_KEY }})
run: nuget push HIC.*.nupkg -skipDuplicate -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NUGET_KEY }}
- name: Upload release binaries
uses: svenstaro/upload-release-action@2.2.1
uses: svenstaro/upload-release-action@2.3.0
if: contains(github.ref, 'refs/tags/v')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 4 additions & 2 deletions BadMedicine.Core/BadMedicine.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<ApplicationIcon />
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<DebugType>embedded</DebugType>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RootNamespace>BadMedicine</RootNamespace>
<AssemblyName>BadMedicine.Core</AssemblyName>
Expand Down Expand Up @@ -48,8 +49,9 @@ BadMedicine differs from other random data generators e.g. Mockaroo, SQL Data Ge
<EmbeddedResource Include="Datasets\Maternity.csv" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CsvHelper" Version="27.2.1" />
<PackageReference Include="MathNet.Numerics" Version="4.15.0" />
<PackageReference Include="CsvHelper" Version="28.0.0" />
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
Expand Down
55 changes: 55 additions & 0 deletions BadMedicine.Core/Datasets/UltraWide.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System;
using System.Threading;

namespace BadMedicine.Datasets
{
/// <include file='../../Datasets.doc.xml' path='Datasets/UltraWide'/>
public class UltraWide : DataGenerator
{
int autonum = 1;

/// <inheritdoc/>
public UltraWide(Random rand) : base(rand)
{
}

/// <inheritdoc/>
public override object[] GenerateTestDataRow(Person p)
{
r.Next();

var array = new object[20_000];
array[0] = Interlocked.Increment(ref autonum);
array[1] = p.CHI;

for (var i = 2; i < array.Length; i++)
{
array[i] = i switch
{
< 4_000 => r.Next(),
< 8_000 => r.NextDouble(),
< 16_000 => GetRandomSentence(r),
< 19_500 => GetRandomGPCode(r),
_ => GetGaussianInt(50, 50000)
};
}

return array;
}

/// <inheritdoc/>
protected override string[] GetHeaders()
{
var array = new string[20_000];
array[0] = "id";
array[1] = "chi";

for (var i = 2; i < array.Length; i++)
{
array[i] = $"col{i}";
}

return array;
}
}
}
55 changes: 55 additions & 0 deletions BadMedicine.Core/Datasets/Wide.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System;
using System.Threading;

namespace BadMedicine.Datasets
{
/// <include file='../../Datasets.doc.xml' path='Datasets/Wide'/>
public class Wide : DataGenerator
{
int autonum = 1;

/// <inheritdoc/>
public Wide(Random rand) : base(rand)
{
}

/// <inheritdoc/>
public override object[] GenerateTestDataRow(Person p)
{
r.Next();

var array = new object[980];
array[0] = Interlocked.Increment(ref autonum);
array[1] = p.CHI;

for (var i = 2; i < array.Length; i++)
{
array[i] = i switch
{
< 100 => r.Next(),
< 200 => r.NextDouble(),
< 300 => GetRandomSentence(r),
< 400 => GetRandomGPCode(r),
_ => GetGaussianInt(50, 50000)
};
}

return array;
}

/// <inheritdoc/>
protected override string[] GetHeaders()
{
var array = new string[980];
array[0] = "id";
array[1] = "chi";

for (var i = 2; i < array.Length; i++)
{
array[i] = $"col{i}";
}

return array;
}
}
}
17 changes: 14 additions & 3 deletions BadMedicine/BadMedicine.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>

<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<StartupObject></StartupObject>
<ApplicationIcon />
<OutputType>Exe</OutputType>
<StartupObject>BadMedicine.Program</StartupObject>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DebugType>embedded</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
</PropertyGroup>
Expand All @@ -19,11 +20,21 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<None Remove="BadMedicine.template.yaml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs" Link="SharedAssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<Content Include="BadMedicine.template.yaml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="HIC.FAnsiSql" Version="2.0.4" />
<PackageReference Include="YamlDotNet" Version="11.2.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
Expand Down
9 changes: 9 additions & 0 deletions BadMedicine/BadMedicine.template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Database:
# Set to true to drop and recreate tables described in the Template
DropTables: false
# The connection string to your database
ConnectionString: server=127.0.0.1;Uid=root;Pwd=root;SslMode=None;AllowPublicKeyRetrieval=True
# Your DBMS provider ('MySql', 'PostgreSql','Oracle' or 'MicrosoftSQLServer')
DatabaseType: MySql
# Database to create/use on the server
DatabaseName: BadMedicineTestData
7 changes: 7 additions & 0 deletions BadMedicine/Configuration/Config.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace BadMedicine.Configuration
{
class Config
{
public TargetDatabase Database { get;set; }
}
}
30 changes: 30 additions & 0 deletions BadMedicine/Configuration/TargetDatabase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using FAnsi;

namespace BadMedicine.Configuration
{
/// <summary>
/// Identify the target database and configuration for generated data
/// </summary>
public class TargetDatabase
{
/// <summary>
/// Which RDBMS the database is (MySQL, Microsoft SQL Server, etc)
/// </summary>
public DatabaseType DatabaseType { get; set; }
/// <summary>
/// The ConnectionString containing the server name, credentials and other parameters for the connection
/// </summary>
public string ConnectionString { get; set; }

/// <summary>
/// The name of database
/// </summary>
public string DatabaseName { get; set; }

/// <summary>
/// Set to true to drop and recreate tables described in the Template
/// </summary>
public bool DropTables { get; set; }

}
}

0 comments on commit ac7756c

Please sign in to comment.