diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 619d107..b8203ee 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -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 diff --git a/.github/workflows/buildNuget.yml b/.github/workflows/buildNuget.yml index 2531338..761ea86 100644 --- a/.github/workflows/buildNuget.yml +++ b/.github/workflows/buildNuget.yml @@ -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 @@ -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 }} @@ -58,10 +58,10 @@ 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 }} @@ -69,10 +69,10 @@ jobs: - 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 }} diff --git a/.github/workflows/checkBuild.yml b/.github/workflows/checkBuild.yml index 11b10a2..d6c2b52 100644 --- a/.github/workflows/checkBuild.yml +++ b/.github/workflows/checkBuild.yml @@ -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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5d03650..27f7a15 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 @@ -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 @@ -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 @@ -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: @@ -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 }} @@ -123,10 +119,10 @@ 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 }} @@ -134,10 +130,10 @@ jobs: - 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 }} diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml new file mode 100644 index 0000000..10dd0cb --- /dev/null +++ b/.github/workflows/sonar.yml @@ -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 }}" diff --git a/.gitignore b/.gitignore index dfcfd56..b86ae41 100644 --- a/.gitignore +++ b/.gitignore @@ -56,7 +56,7 @@ dlldata.c # Benchmark Results BenchmarkDotNet.Artifacts/ -# .NET Core +# .NET project.lock.json project.fragment.lock.json artifacts/ diff --git a/LICENSE b/LICENSE index 53c7613..0752986 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/README.md b/README.md index 0438350..d31b1fa 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # CoreFramework [![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 + @@ -55,10 +58,7 @@ Stuff that is frequently used in (my) code and therefore here summarized @@ -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)
[![Build develop](https://dev.azure.com/litetex/CoreFramework/_apis/build/status/Develop?label=develop)](https://dev.azure.com/litetex/CoreFramework/_build/latest?definitionId=4)
[![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)
[![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)
[![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) | diff --git a/src/CoreFramework.Base/CoreFramework.Base.csproj b/src/CoreFramework.Base/CoreFramework.Base.csproj index d361b68..e46137d 100644 --- a/src/CoreFramework.Base/CoreFramework.Base.csproj +++ b/src/CoreFramework.Base/CoreFramework.Base.csproj @@ -1,18 +1,19 @@  - netstandard2.1;netcoreapp3.1 + netstandard2.1;net6.0 Litetex.CoreFramework.Base Things that are frequently used in code - Base Module litetex https://github.com/litetex/CoreFramework - Copyright (c) 2020 litetex + Copyright (c) 2022 litetex MIT https://github.com/litetex/CoreFramework.git git icon.png + Litetex;CoreFramework;Base true @@ -25,7 +26,7 @@ - + diff --git a/src/CoreFramework.Base/IO/DirUtil.cs b/src/CoreFramework.Base/IO/DirUtil.cs index 0b39aa8..a75e1ce 100644 --- a/src/CoreFramework.Base/IO/DirUtil.cs +++ b/src/CoreFramework.Base/IO/DirUtil.cs @@ -88,12 +88,13 @@ public static void EnsureCreatedAndClean(string path, int dirDeletedWaitInterval /// /// /// - public static void Copy(string source, string target) + /// Overwrite already existing files; if false and duplicate file: Exception + 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); } /// @@ -101,17 +102,18 @@ public static void Copy(string source, string target) /// /// /// - public static void Copy(DirectoryInfo source, DirectoryInfo target) + /// Overwrite already existing files; if false and duplicate file: Exception + 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); } /// diff --git a/src/CoreFramework.Config.Json/CoreFramework.Config.Json.csproj b/src/CoreFramework.Config.Json/CoreFramework.Config.Json.csproj index 58c7ff8..3e0e604 100644 --- a/src/CoreFramework.Config.Json/CoreFramework.Config.Json.csproj +++ b/src/CoreFramework.Config.Json/CoreFramework.Config.Json.csproj @@ -1,18 +1,19 @@  - netstandard2.1;netcoreapp3.1 + netstandard2.1;net6.0 Litetex.CoreFramework.Config.Json Things that are frequently used in code - JSON Configuration Module litetex https://github.com/litetex/CoreFramework - Copyright (c) 2020 litetex + Copyright (c) 2022 litetex MIT https://github.com/litetex/CoreFramework.git git icon.png + Litetex;CoreFramework;Config;Json true @@ -24,11 +25,11 @@ - + - + diff --git a/src/CoreFramework.Config.Yaml/CoreFramework.Config.Yaml.csproj b/src/CoreFramework.Config.Yaml/CoreFramework.Config.Yaml.csproj index bc5c0d9..b171113 100644 --- a/src/CoreFramework.Config.Yaml/CoreFramework.Config.Yaml.csproj +++ b/src/CoreFramework.Config.Yaml/CoreFramework.Config.Yaml.csproj @@ -1,18 +1,19 @@  - netstandard2.1;netcoreapp3.1 + netstandard2.1;net6.0 Litetex.CoreFramework.Config.Yaml Things that are frequently used in code - YAML Configuration Module litetex https://github.com/litetex/CoreFramework - Copyright (c) 2020 litetex + Copyright (c) 2022 litetex MIT https://github.com/litetex/CoreFramework.git git icon.png + Litetex;CoreFramework;Config;Yaml true @@ -24,11 +25,11 @@ - + - + diff --git a/src/CoreFramework.Config/CoreFramework.Config.csproj b/src/CoreFramework.Config/CoreFramework.Config.csproj index 1c0b32b..b1bdc39 100644 --- a/src/CoreFramework.Config/CoreFramework.Config.csproj +++ b/src/CoreFramework.Config/CoreFramework.Config.csproj @@ -1,18 +1,19 @@  - netstandard2.1;netcoreapp3.1 + netstandard2.1;net6.0 Litetex.CoreFramework.Config Things that are frequently used in code - Configuration Module litetex https://github.com/litetex/CoreFramework - Copyright (c) 2020 litetex + Copyright (c) 2022 litetex MIT https://github.com/litetex/CoreFramework.git git icon.png + Litetex;CoreFramework;Config true @@ -24,7 +25,7 @@ - + diff --git a/src/CoreFramework.CrashLogging/CoreFramework.CrashLogging.csproj b/src/CoreFramework.CrashLogging/CoreFramework.CrashLogging.csproj index 5707c88..3cae93d 100644 --- a/src/CoreFramework.CrashLogging/CoreFramework.CrashLogging.csproj +++ b/src/CoreFramework.CrashLogging/CoreFramework.CrashLogging.csproj @@ -1,18 +1,19 @@  - netstandard2.1;netcoreapp3.1 + netstandard2.1;net6.0 Litetex.CoreFramework.CrashLogging Things that are frequently used in code - CrashLogging Module litetex https://github.com/litetex/CoreFramework - Copyright (c) 2020 litetex + Copyright (c) 2022 litetex MIT https://github.com/litetex/CoreFramework.git git icon.png + Litetex;CoreFramework;CrashLogging true @@ -24,7 +25,7 @@ - + diff --git a/src/CoreFramework.Logging/CoreFramework.Logging.csproj b/src/CoreFramework.Logging/CoreFramework.Logging.csproj index 4e92279..aa45e35 100644 --- a/src/CoreFramework.Logging/CoreFramework.Logging.csproj +++ b/src/CoreFramework.Logging/CoreFramework.Logging.csproj @@ -1,18 +1,19 @@  - netstandard2.1;netcoreapp3.1 + netstandard2.1;net6.0 Litetex.CoreFramework.Logging Things that are frequently used in code - Logging Module litetex https://github.com/litetex/CoreFramework - Copyright (c) 2020 litetex + Copyright (c) 2022 litetex MIT https://github.com/litetex/CoreFramework.git git icon.png + Litetex;CoreFramework;Logging true @@ -24,7 +25,7 @@ - + @@ -32,10 +33,10 @@ - + - - + +
Module - Config.Net.Json - - Nuget - + Config.Net#JSON