Skip to content

Commit

Permalink
Init Check-in
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Lanning authored and Mark Lanning committed Aug 3, 2024
1 parent 9b000cf commit 7191db3
Show file tree
Hide file tree
Showing 150 changed files with 12,921 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
##########################################
# code ownership
##########################################
# default ownership: default owners for everything in the repo (Unless a later match takes precedence)
* @lanmark7
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "nuget"
directories:
- "/Base/src"
target-branch: "main"
schedule:
interval: "weekly"
6 changes: 6 additions & 0 deletions .github/workflows/markdown_checker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"timeout": "20s",
"retryOn429": true,
"retryCount": 5,
"aliveStatusCodes": [200, 206, 403]
}
23 changes: 23 additions & 0 deletions .github/workflows/markdown_checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# ================================================================================
# MARKDOWN LINK CHECKER
# ================================================================================
# https://github.com/gaurav-nelson/github-action-markdown-link-check?tab=readme-ov-file
# <!-- markdown-link-check-disable --> and <!-- markdown-link-check-enable-->
# Check a single file using:
# markdown-link-check ./README.md
# Recursive:
# find . -name \*.md -print0 | xargs -0 -n1 markdown-link-check -q -p
# ================================================================================
name: Check Markdown links

on: push

jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: 'yes'
config-file: '.github/workflows/markdown_checker.json'
56 changes: 56 additions & 0 deletions .github/workflows/publish_nugets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# ======================================================================
# Publish Nugets: Build, Test and Publish Nuget Packages
# ======================================================================
name: 'Build/Publish Nugets'

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
packages: write
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup .NET 8.0.x
uses: actions/setup-dotnet@v3
with:
# Semantic version range syntax or exact version of a dotnet version
dotnet-version: '8.0.x'

- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV

- name: Restore
run: dotnet restore ./ThingsLibrary.All.sln

- name: Build
run: dotnet build ./ThingsLibrary.All.sln --configuration Release /p:Version="${VERSION}" --no-restore

- name: Test
run: dotnet test ./ThingsLibrary.All.sln -c Release --nologo --no-build --results-directory "./Artifacts/Test/${VERSION}" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

- name: Pack
run: dotnet pack ./ThingsLibrary.All.sln -v normal -c Release /p:Version="${VERSION}" /p:PackageVersion="${VERSION}" /p:PackageReleaseNotes="${{ github.event.inputs.releaseNotes }}" --no-restore --no-build --output "./Artifacts/Build"
if: success()

- name: File Tree
run: tree -a ./Artifacts

- name: Push to Github
run: dotnet nuget push ./Artifacts/Build/*.nupkg -k ${API_TOKEN} -s https://nuget.pkg.github.com/things-library/index.json
env:
API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Push to Nuget.org
run: dotnet nuget push ./Artifacts/Build/*.nupkg -k ${API_TOKEN} -s https://api.nuget.org/v3/index.json
env:
API_TOKEN: ${{ secrets.NUGET_API_KEY }}
46 changes: 46 additions & 0 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# ======================================================================
# PULL Request: Build / Test
# ======================================================================
name: 'Pull Request Builder'

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup .NET 8.0.x
uses: actions/setup-dotnet@v3
with:
# Semantic version range syntax or exact version of a dotnet version
dotnet-version: '8.0.x'

# You can test your matrix by printing the current dotnet version
- name: Display dotnet version
run: dotnet --version

- name: List NuGet Package Sources
run: dotnet nuget list source

- name: Restore Files
run: dotnet restore ./ThingsLibrary.All.sln

- name: Build
run: dotnet build ./ThingsLibrary.All.sln --configuration Release --no-restore

- name: Test
run: dotnet test ./ThingsLibrary.All.sln -c Release --nologo --no-build --results-directory "./Artifacts/Test/0.0.0" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

- name: Tree List
run: tree -a ./Artifacts
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
################################################################################
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
################################################################################

.vs
bin
obj
TestResults
packages
14 changes: 14 additions & 0 deletions Base/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Base Libraries

This section contains the base libraries that has no third party dependencies and contains a lot of various wrappers, data type extensions and nice to have.

## Base

## Scheduler

## Testing

## DataType.Json.Schema

This library is focused around providing Json Schema compliant tools.

134 changes: 134 additions & 0 deletions Base/src/ThingsLibrary.Base/Attributes/IndexAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
namespace ThingsLibrary.Attributes
{
/// <summary>
/// Specifies what indexes should exist for the class
/// </summary>
/// <remarks>This is modeled after the IndexAttribute of Microsoft.EntityFrameworkCore</remarks>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public sealed class IndexAttribute : Attribute
{
/// <summary>
/// The properties which constitute the index, in order.
/// </summary>
public IReadOnlyList<string> PropertyNames { get; }


/// <summary>
/// The name of the index.
/// </summary>
public string Name
{
get => _name;
set
{
if (string.IsNullOrEmpty(value)) { throw new ArgumentNullException(nameof(Name)); }

_name = value;
}
}
private string _name = string.Empty;


/// <summary>
/// Whether the index is unique.
/// </summary>
public bool IsUnique
{
get => _isUnique ?? false;
set => _isUnique = value;
}
private bool? _isUnique;


/// <summary>
/// A set of values indicating whether each corresponding index column has descending sort order.
/// </summary>
public bool[] IsDescending
{
get
{
// we must always return a matching set to property names
if (_isDescending?.Length == this.PropertyNames.Count)
{
return _isDescending;
}
else
{
return new bool[this.PropertyNames.Count];
}
}
set
{
if (value is not null)
{
if (value.Length != this.PropertyNames.Count)
{
throw new ArgumentException($"Invalid number of items for IsDescending([]), expected '{this.PropertyNames.Count}' got '{value.Length}'");
}

if (_allDescending)
{
throw new ArgumentException("Cannot specify both IsDescending And AllDescending");
}

_isDescending = value ?? new bool[this.PropertyNames.Count];
}
else
{
_isDescending = null;
}
}
}
private bool[]? _isDescending;


/// <summary>
/// Whether all index columns have descending sort order.
/// </summary>
public bool AllDescending
{
get => _allDescending;
set
{
if (this.IsDescending is not null)
{
throw new ArgumentException("Cannot specify both IsDescending and AllDescending.");
}

_allDescending = value;
}
}
private bool _allDescending;


/// <summary>
/// Checks whether <see cref="IsUnique" /> has been explicitly set to a value.
/// </summary>
public bool IsUniqueHasValue => _isUnique.HasValue;


/// <summary>
/// Initializes a new instance of the <see cref="IndexAttribute" /> class.
/// </summary>
/// <param name="propertyName">The first (or only) property in the index.</param>
/// <param name="additionalPropertyNames">The additional properties which constitute the index, if any, in order.</param>
public IndexAttribute(string propertyName, params string[] additionalPropertyNames)
{
ArgumentNullException.ThrowIfNullOrEmpty(propertyName, nameof(propertyName));
if (additionalPropertyNames.Any(x => string.IsNullOrEmpty(x))) { throw new ArgumentNullException(nameof(additionalPropertyNames)); }

this.PropertyNames = new List<string> { propertyName };
((List<string>)this.PropertyNames).AddRange(additionalPropertyNames);
}

/// <summary>
/// Index Attribute
/// </summary>
public IndexAttribute(params string[] propertyNames)
{
if (propertyNames.Any(x => string.IsNullOrEmpty(x))) { throw new ArgumentNullException(nameof(propertyNames)); }

this.PropertyNames = propertyNames.ToList();
}
}
}
14 changes: 14 additions & 0 deletions Base/src/ThingsLibrary.Base/Attributes/LastEditDateAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace ThingsLibrary.Attributes
{
/// <summary>
/// Specifies which class property is the edit timestamp key
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class LastEditDateAttribute : Attribute
{
/// <summary>
/// Last Record Edit Date Timestamp
/// </summary>
public LastEditDateAttribute() { }
}
}
14 changes: 14 additions & 0 deletions Base/src/ThingsLibrary.Base/Attributes/PartitionKeyAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace ThingsLibrary.Attributes
{
/// <summary>
/// Specifies which class property is the partition key
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class PartitionKeyAttribute : Attribute
{
/// <summary>
/// Partition Key
/// </summary>
public PartitionKeyAttribute() { }
}
}
14 changes: 14 additions & 0 deletions Base/src/ThingsLibrary.Base/Attributes/RevisionNumberAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace ThingsLibrary.Attributes
{
/// <summary>
/// Specifies which class property is the revision number
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class RevisionNumberAttribute : Attribute
{
/// <summary>
/// Partition Key
/// </summary>
public RevisionNumberAttribute() { }
}
}
Loading

0 comments on commit 7191db3

Please sign in to comment.