Skip to content

Commit

Permalink
Merge pull request #91 from litetex/develop
Browse files Browse the repository at this point in the history
Maintenance Release
  • Loading branch information
litetex authored Nov 19, 2022
2 parents 26cf0e0 + c16757d commit 2e3a0a2
Show file tree
Hide file tree
Showing 15 changed files with 148 additions and 74 deletions.
12 changes: 8 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
version: 2
updates:
- package-ecosystem: nuget
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
time: "03:42"
open-pull-requests-limit: 10
- package-ecosystem: github-actions
ignore:
- dependency-name: "*"
# GitHub actions are using git tags (v1 = v1.2 = v1.2.3) which should be compatible until a major change is performed
update-types:
- "version-update:semver-minor"
- "version-update:semver-patch"
- package-ecosystem: nuget
directory: "/"
schedule:
interval: daily
time: "03:42"
open-pull-requests-limit: 10
18 changes: 9 additions & 9 deletions .github/workflows/buildNuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
id: versionprovider
shell: bash
run: |
echo "::set-output name=version::$(date -u +%Y.%m.%d.%k%M)"
echo "version=$(date -u +%Y.%m.%d.%k%M)" >> $GITHUB_OUTPUT
build_each:
runs-on: ubuntu-latest
Expand All @@ -40,13 +40,13 @@ jobs:
- "CoreFramework.CrashLogging"
- "CoreFramework.Logging"
dotnet-version:
- 3.1.x
- 6.x

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}

Expand All @@ -58,21 +58,21 @@ jobs:
- name: Find nupkg file
id: nupkgvar
working-directory: src/${{ matrix.project }}/bin/Release
run: files=( *.nupkg) && echo ::set-output name=filename::$(echo "${files[0]}")
run: files=( *.nupkg) && echo "filename=${files[0]}" >> $GITHUB_OUTPUT

- name: Upload nupkg - Upload asset
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.dotnet-version }}-${{ steps.nupkgvar.outputs.filename }}
path: src/${{ matrix.project }}/bin/Release/${{ steps.nupkgvar.outputs.filename }}

- name: Find snupkg file
id: snupkgvar
working-directory: src/${{ matrix.project }}/bin/Release
run: files=( *.snupkg) && echo ::set-output name=filename::$(echo "${files[0]}")
run: files=( *.snupkg) && echo "filename=${files[0]}" >> $GITHUB_OUTPUT

- name: Upload snupkg - Upload asset
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.dotnet-version }}-${{ steps.snupkgvar.outputs.filename }}
path: src/${{ matrix.project }}/bin/Release/${{ steps.snupkgvar.outputs.filename }}
10 changes: 5 additions & 5 deletions .github/workflows/checkBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ jobs:
fail-fast: true
matrix:
dotnet-version:
- 3.1.x
- 5.0.x
- 6.x
- 7.x

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}

Expand Down
38 changes: 17 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 3.1.x
dotnet-version: 6.x

- name: Build
run: dotnet build --configuration Release
Expand All @@ -35,8 +35,7 @@ jobs:
# The maximum value for either of the parts is 65534 - https://stackoverflow.com/a/37941296/11649486
run: |
gen_version=$(date -u +%Y.%m.%d.%k%M)
echo "version=$gen_version"
echo "::set-output name=version::$gen_version"
echo "version=$gen_version" >> $GITHUB_OUTPUT
echo "${{github.ref}}"
if [ "${{github.ref}}" = "refs/heads/master-release-test" ]; then
Expand All @@ -45,8 +44,7 @@ jobs:
gen_package_version="${gen_version}"
fi
echo "packageversion=$gen_package_version"
echo "::set-output name=packageversion::$gen_package_version"
echo "packageversion=$gen_package_version" >> $GITHUB_OUTPUT
generate_release:
runs-on: ubuntu-latest
Expand All @@ -66,12 +64,10 @@ jobs:
prerelease=false
fi
echo "prerelease=$prerelease"
echo "::set-output name=prerelease::$prerelease"
echo "draft=$draft"
echo "::set-output name=draft::$draft"
echo "prerelease=$prerelease" >> $GITHUB_OUTPUT
echo "draft=$draft" >> $GITHUB_OUTPUT
- name: Create Release (draft)
- name: Create Release
id: create_draft
uses: actions/create-release@v1
env:
Expand Down Expand Up @@ -108,12 +104,12 @@ jobs:
- "CoreFramework.Logging"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 3.1.x
dotnet-version: 6.x

- name: Pack
working-directory: src/${{ matrix.project }}
Expand All @@ -123,21 +119,21 @@ jobs:
- name: Find nupkg file
id: nupkgvar
working-directory: src/${{ matrix.project }}/bin/Release
run: files=( *.nupkg) && echo ::set-output name=filename::$(echo "${files[0]}")
run: files=( *.nupkg) && echo "filename=${files[0]}" >> $GITHUB_OUTPUT

- name: Upload nupkg - Upload asset
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ${{ steps.nupkgvar.outputs.filename }}
path: src/${{ matrix.project }}/bin/Release/${{ steps.nupkgvar.outputs.filename }}

- name: Find snupkg file
id: snupkgvar
working-directory: src/${{ matrix.project }}/bin/Release
run: files=( *.snupkg) && echo ::set-output name=filename::$(echo "${files[0]}")
run: files=( *.snupkg) && echo "filename=${files[0]}" >> $GITHUB_OUTPUT

- name: Upload snupkg - Upload asset
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ${{ steps.snupkgvar.outputs.filename }}
path: src/${{ matrix.project }}/bin/Release/${{ steps.snupkgvar.outputs.filename }}
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Sonar CI

on:
workflow_dispatch:
push:
branches: [ master, develop ]
paths-ignore:
- '**.md'
pull_request:
types: [opened, synchronize, reopened]
paths-ignore:
- '**.md'

jobs:
sonar:
name: SonarCloud Scan
runs-on: windows-latest
steps:
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11.x

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.x

- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar-fix2
restore-keys: ${{ runner.os }}-sonar-fix2

- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v3
with:
path: .\src\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner-fix2
restore-keys: ${{ runner.os }}-sonar-scanner-fix2

- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
working-directory: src
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
working-directory: src
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"litetex_CoreFrameworkBase" /o:"litetex" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
dotnet build --configuration Release
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/

# .NET Core
# .NET
project.lock.json
project.fragment.lock.json
artifacts/
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 litetex
Copyright (c) 2022 litetex

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# CoreFramework <img src="CFR-128.png" width="48" /> [![Latest Version](https://img.shields.io/github/v/release/litetex/CoreFramework?style=flat-square)](https://github.com/litetex/CoreFramework/releases)
_Current state: Maintenance mode_

Stuff that is frequently used in (my) code and therefore here summarized


<table>
<thead>
<th>Module</th>
Expand Down Expand Up @@ -55,10 +58,7 @@ Stuff that is frequently used in (my) code and therefore here summarized
</a>
</td>
<td>
<a href="https://github.com/aloneguid/config/blob/master/doc/Stores_JsonFile.md">Config.Net.Json</a>
<a href="https://www.nuget.org/packages/Config.Net.Json">
<img alt="Nuget" src="https://img.shields.io/nuget/v/Config.Net.Json">
</a>
<a href="https://github.com/aloneguid/config#json">Config.Net#JSON</a>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -120,7 +120,7 @@ Stuff that is frequently used in (my) code and therefore here summarized
## Development [![Latest Version](https://img.shields.io/github/v/release/litetex/CoreFramework?style=flat-square&include_prereleases&label=prerelease)](https://github.com/litetex/CoreFramework/releases)
| Workflow | Status |
| --- | --- |
| Sonar Build | [![Sonarcloud Status](https://sonarcloud.io/api/project_badges/measure?project=litetex_CoreFrameworkBase&metric=alert_status)](https://sonarcloud.io/dashboard?id=litetex_CoreFrameworkBase) <br>[![Build develop](https://dev.azure.com/litetex/CoreFramework/_apis/build/status/Develop?label=develop)](https://dev.azure.com/litetex/CoreFramework/_build/latest?definitionId=4) <br>[![Build](https://dev.azure.com/litetex/CoreFramework/_apis/build/status/Master?label=master)](https://dev.azure.com/litetex/CoreFramework/_build/latest?definitionId=6) |
| Sonar Build | [![Sonarcloud Status](https://sonarcloud.io/api/project_badges/measure?project=litetex_CoreFrameworkBase&metric=alert_status)](https://sonarcloud.io/dashboard?id=litetex_CoreFrameworkBase) <br>[![Latest workflow runs](https://img.shields.io/github/workflow/status/litetex/CoreFramework/Sonar%20CI/develop)](https://github.com/litetex/CoreFramework/actions?query=workflow%3A%22Sonar+CI%22+branch%3Adevelop) |
| Check Build | [![Latest workflow runs](https://img.shields.io/github/workflow/status/litetex/CoreFramework/Check%20Build/develop)](https://github.com/litetex/CoreFramework/actions?query=workflow%3A%22Check+Build%22+branch%3Adevelop) |
| Build Nuget | [![Latest workflow runs](https://img.shields.io/github/workflow/status/litetex/CoreFramework/Build%20Nuget/develop)](https://github.com/litetex/CoreFramework/actions?query=workflow%3A%22Build+Nuget%22+branch%3Adevelop) |
| Release | [![master workflow runs](https://img.shields.io/github/workflow/status/litetex/CoreFramework/Release/master?label=master)](https://github.com/litetex/CoreFramework/actions?query=workflow%3A%22Release%22+branch%3Amaster) <br>[![master workflow runs](https://img.shields.io/github/workflow/status/litetex/CoreFramework/Release/master-release-test?label=release-test)](https://github.com/litetex/CoreFramework/actions?query=workflow%3A%22Release%22+branch%3Amaster-release-test) |
7 changes: 4 additions & 3 deletions src/CoreFramework.Base/CoreFramework.Base.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net6.0</TargetFrameworks>

<PackageId>Litetex.CoreFramework.Base</PackageId>
<Description>Things that are frequently used in code - Base Module</Description>
<Authors>litetex</Authors>
<PackageProjectUrl>https://github.com/litetex/CoreFramework</PackageProjectUrl>
<Copyright>Copyright (c) 2020 litetex</Copyright>
<Copyright>Copyright (c) 2022 litetex</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/litetex/CoreFramework.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageIcon>icon.png</PackageIcon>
<PackageIconUrl />
<PackageTags>Litetex;CoreFramework;Base</PackageTags>

<!-- SourceLink -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
Expand All @@ -25,7 +26,7 @@

<ItemGroup>
<!-- SourceLink -->
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 7 additions & 5 deletions src/CoreFramework.Base/IO/DirUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,30 +88,32 @@ public static void EnsureCreatedAndClean(string path, int dirDeletedWaitInterval
/// </summary>
/// <param name="source"></param>
/// <param name="target"></param>
public static void Copy(string source, string target)
/// <param name="overwrite">Overwrite already existing files; if false and duplicate file: Exception</param>
public static void Copy(string source, string target, bool overwrite = true)
{
var sourceDI = new DirectoryInfo(source);
var targetDI = new DirectoryInfo(target);

Copy(sourceDI, targetDI);
Copy(sourceDI, targetDI, overwrite);
}

/// <summary>
/// Copy a directory
/// </summary>
/// <param name="source"></param>
/// <param name="target"></param>
public static void Copy(DirectoryInfo source, DirectoryInfo target)
/// <param name="overwrite">Overwrite already existing files; if false and duplicate file: Exception</param>
public static void Copy(DirectoryInfo source, DirectoryInfo target, bool overwrite = true)
{
Directory.CreateDirectory(target.FullName);

// Copy each file into the new directory.
foreach (FileInfo fi in source.GetFiles())
fi.CopyTo(Path.Combine(target.FullName, fi.Name), true);
fi.CopyTo(Path.Combine(target.FullName, fi.Name), overwrite);

// Copy each subdirectory using recursion.
foreach (DirectoryInfo diSourceSubDir in source.GetDirectories())
Copy(diSourceSubDir, target.CreateSubdirectory(diSourceSubDir.Name));
Copy(diSourceSubDir, target.CreateSubdirectory(diSourceSubDir.Name), overwrite);
}

/// <summary>
Expand Down
Loading

0 comments on commit 2e3a0a2

Please sign in to comment.