From ff357be111b19157adcf084c90b7f168bcdf1485 Mon Sep 17 00:00:00 2001 From: Ninja Date: Sat, 7 Sep 2024 13:48:10 +0100 Subject: [PATCH] Initial Checkin --- .github/workflows/Build-Master.yml | 40 +++++++ .github/workflows/CI-Build.yml | 162 ++++++++++++++++++++++++++ .github/workflows/codeql.yml | 77 ++++++++++++ Abacus.Net.sln | 59 ++++++++++ GitVersion.yml | 15 +++ README.md | 2 +- _config.yml | 1 + src/Abacus/Abacus.csproj | 9 ++ src/Abacus/Class1.cs | 7 ++ test/Abacus.Tests/Abacus.Tests.csproj | 28 +++++ test/Abacus.Tests/UnitTest1.cs | 18 +++ 11 files changed, 417 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/Build-Master.yml create mode 100644 .github/workflows/CI-Build.yml create mode 100644 .github/workflows/codeql.yml create mode 100644 Abacus.Net.sln create mode 100644 GitVersion.yml create mode 100644 _config.yml create mode 100644 src/Abacus/Abacus.csproj create mode 100644 src/Abacus/Class1.cs create mode 100644 test/Abacus.Tests/Abacus.Tests.csproj create mode 100644 test/Abacus.Tests/UnitTest1.cs diff --git a/.github/workflows/Build-Master.yml b/.github/workflows/Build-Master.yml new file mode 100644 index 0000000..fb70f0d --- /dev/null +++ b/.github/workflows/Build-Master.yml @@ -0,0 +1,40 @@ +# This workflow will build a .NET project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net + +name: build-master + +on: + push: + branches: [ "master" ] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: dotnet test --no-build --verbosity normal + + run-Lint: + runs-on: ubuntu-latest + env: + github-token: '${{ secrets.GITHUB_TOKEN }}' + steps: + - name: Step-01 Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Step-02 Lint Code Base + uses: github/super-linter@v4 + env: + VALIDATE_ALL_CODEBASE: false + FILTER_REGEX_INCLUDE: .*src/.* + DEFAULT_BRANCH: master + GITHUB_TOKEN: '${{ env.github-token }}' diff --git a/.github/workflows/CI-Build.yml b/.github/workflows/CI-Build.yml new file mode 100644 index 0000000..2c6f0e7 --- /dev/null +++ b/.github/workflows/CI-Build.yml @@ -0,0 +1,162 @@ +name: CI +'on': + pull_request: + types: [opened, reopened, edited, synchronize] + paths-ignore: + - "**/*.md" + - "**/*.gitignore" + - "**/*.gitattributes" +jobs: + Run-Lint: + runs-on: ubuntu-latest + env: + github-token: '${{ secrets.GH_PACKAGES }}' + steps: + - name: Step-01 Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Step-02 Lint Code Base + uses: github/super-linter@v4 + env: + VALIDATE_ALL_CODEBASE: false + FILTER_REGEX_INCLUDE: .*src/.* + DEFAULT_BRANCH: master + GITHUB_TOKEN: '${{ secrets.GH_PACKAGES }}' + Build-Beta: + if: ${{ !startsWith(github.head_ref, 'release/')}} + runs-on: ubuntu-latest + outputs: + semVersion: ${{ steps.gitversion.outputs.MajorMinorPatch }} + branchName: ${{ steps.gitversion.outputs.branchName }} + env: + working-directory: /home/runner/work/Abacus.Net/Abacus.Net + + steps: + - name: Step-01 Install GitVersion + uses: gittools/actions/gitversion/setup@v0.9.7 + with: + versionSpec: 5.x + + - name: Step-02 Check out Code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Step-03 Calculate Version + id: gitversion + uses: gittools/actions/gitversion/execute@v0.9.7 + with: + useConfigFile: true + + - name: Step-04 Install .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + + - name: Step-05 Restore dependencies + run: dotnet restore + working-directory: '${{ env.working-directory }}' + + - name: Step-06 Build Beta Version + run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.nuGetVersion }} + working-directory: '${{ env.working-directory }}' + + - name: Step-07 Test Solution + run: dotnet test --configuration Release --no-build --no-restore --verbosity normal + working-directory: '${{ env.working-directory }}' + + - name: Step-08 Upload Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: build-artifact + path: ${{env.working-directory}} + retention-days: 1 + Build-Release: + if: ${{ startsWith(github.head_ref, 'release/') }} + runs-on: ubuntu-latest + outputs: + semVersion: ${{ steps.gitversion.outputs.MajorMinorPatch }} + branchName: ${{ steps.gitversion.outputs.branchName }} + env: + working-directory: /home/runner/work/Abacus.Net/Abacus.Net + + steps: + - name: Step-01 Install GitVersion + uses: gittools/actions/gitversion/setup@v0.9.7 + with: + versionSpec: 5.x + + - name: Step-02 Check out Code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Step-03 Calculate Version + id: gitversion + uses: gittools/actions/gitversion/execute@v0.9.7 + with: + useConfigFile: true + + - name: Step-04 Install .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + + - name: Step-05 Restore dependencies + run: dotnet restore + working-directory: '${{ env.working-directory }}' + + - name: Step-06 Build Release Version + if: ('startsWith(github.ref, ''refs/heads/release'')') + run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }} + working-directory: '${{ env.working-directory }}' + + - name: Step-07 Test Solution + run: dotnet test --configuration Release --no-build --no-restore --verbosity normal + working-directory: '${{ env.working-directory }}' + + - name: Step-08 Upload Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: build-artifact + path: ${{env.working-directory}} + retention-days: 1 + Package-Release: + needs: [Build-Beta, Build-Release] + if: | + always() && + (needs.Build-Beta.result == 'success' || needs.Build-Release.result == 'success') + runs-on: ubuntu-latest + outputs: + semVersion: ${{ needs.Build-Release.outputs.semVersion }} + env: + github-token: '${{ secrets.GH_PACKAGES }}' + nuget-token: '${{ secrets.NUGET_API_KEY }}' + working-directory: /home/runner/work/Abacus.Net/Abacus.Net + steps: + - name: Step-01 Retrieve Build Artifacts + uses: actions/download-artifact@v3 + with: + name: build-artifact + path: ${{env.working-directory}} + + - name: Step-02 Install Github Packages + run: dotnet tool install gpr --global + + - name: Step-03 Publish to Github Packages + run: find -name "*.nupkg" -print -exec gpr push -k ${{env.github-token}} {} \; + + - name: Step-02 Create Github Release + if: ${{ startsWith(github.head_ref, 'release/')}} + run: | + curl \ + -X POST \ + -H "Accept:application/vnd.github+json" \ + -H "Authorization:token ${{ env.github-token }}" \ + https://api.github.com/ninjarocks/Abacus.Net/releases \ + -d '{"tag_name":v1.0.0,"target_commitish":"master","name":"Abacus.Net","body":"","draft":false,"prerelease":false,"generate_release_notes":false}' + + - name: Step-03 Release to Nuget Org + if: ${{ startsWith(github.head_ref, 'release/')}} + run: dotnet nuget push ${{env.working-directory}}/src/Abacus.Net/bin/Release/*.nupkg --skip-duplicate --api-key ${{ env.nuget-token }} --source https://api.nuget.org/v3/index.json diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..1cf7c8d --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,77 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "master" ] + pull_request: + types: [opened, reopened, edited, synchronize] + paths-ignore: + - "**/*.md" + - "**/*.gitignore" + - "**/*.gitattributes" + schedule: + - cron: '35 15 * * 2' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'csharp' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/Abacus.Net.sln b/Abacus.Net.sln new file mode 100644 index 0000000..8e1f6a9 --- /dev/null +++ b/Abacus.Net.sln @@ -0,0 +1,59 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34723.18 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{1CE4C8AD-95A2-47C6-9BD4-B74489F19180}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Abacus", "src\Abacus\Abacus.csproj", "{27497BC2-CEEC-4E41-94C3-F34B766EF559}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{46374D3A-9676-43EE-AC28-8F526FC999A6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Abacus.Tests", "test\Abacus.Tests\Abacus.Tests.csproj", "{58A815EE-64AD-4DF0-BBC7-6129057B5857}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "misc", "misc", "{0E4BFF47-6313-4986-9D5F-1B9371C70C61}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "github", "github", "{D773D7AB-E024-4847-928A-0C5350E46E42}" + ProjectSection(SolutionItems) = preProject + .github\workflows\Build-Master.yml = .github\workflows\Build-Master.yml + .github\workflows\CI-Build.yml = .github\workflows\CI-Build.yml + .github\workflows\codeql.yml = .github\workflows\codeql.yml + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution", "solution", "{AB71176A-106F-48FB-A68C-4ECC4B352803}" + ProjectSection(SolutionItems) = preProject + .gitignore = .gitignore + GitVersion.yml = GitVersion.yml + LICENSE = LICENSE + README.md = README.md + _config.yml = _config.yml + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {27497BC2-CEEC-4E41-94C3-F34B766EF559}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {27497BC2-CEEC-4E41-94C3-F34B766EF559}.Debug|Any CPU.Build.0 = Debug|Any CPU + {27497BC2-CEEC-4E41-94C3-F34B766EF559}.Release|Any CPU.ActiveCfg = Release|Any CPU + {27497BC2-CEEC-4E41-94C3-F34B766EF559}.Release|Any CPU.Build.0 = Release|Any CPU + {58A815EE-64AD-4DF0-BBC7-6129057B5857}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {58A815EE-64AD-4DF0-BBC7-6129057B5857}.Debug|Any CPU.Build.0 = Debug|Any CPU + {58A815EE-64AD-4DF0-BBC7-6129057B5857}.Release|Any CPU.ActiveCfg = Release|Any CPU + {58A815EE-64AD-4DF0-BBC7-6129057B5857}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {27497BC2-CEEC-4E41-94C3-F34B766EF559} = {1CE4C8AD-95A2-47C6-9BD4-B74489F19180} + {58A815EE-64AD-4DF0-BBC7-6129057B5857} = {46374D3A-9676-43EE-AC28-8F526FC999A6} + {D773D7AB-E024-4847-928A-0C5350E46E42} = {0E4BFF47-6313-4986-9D5F-1B9371C70C61} + {AB71176A-106F-48FB-A68C-4ECC4B352803} = {0E4BFF47-6313-4986-9D5F-1B9371C70C61} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EE293EA1-24BE-4270-B2B2-42846CA6D169} + EndGlobalSection +EndGlobal diff --git a/GitVersion.yml b/GitVersion.yml new file mode 100644 index 0000000..89b0a62 --- /dev/null +++ b/GitVersion.yml @@ -0,0 +1,15 @@ +next-version: 1.0.0 +tag-prefix: '[vV]' +mode: ContinuousDeployment +branches: + master: + regex: ^master$ + release: + regex: ^release$ + develop: + regex: ^develop$|^dev$ + tag: beta + pull-request: + tag: beta +ignore: + sha: [] \ No newline at end of file diff --git a/README.md b/README.md index e44c6e7..21d52b8 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # abacus -Workflow framework in .Net +## Workflow framework in .Net diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..e8977d8 --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +markdown:GFM diff --git a/src/Abacus/Abacus.csproj b/src/Abacus/Abacus.csproj new file mode 100644 index 0000000..fa71b7a --- /dev/null +++ b/src/Abacus/Abacus.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/src/Abacus/Class1.cs b/src/Abacus/Class1.cs new file mode 100644 index 0000000..5a210c2 --- /dev/null +++ b/src/Abacus/Class1.cs @@ -0,0 +1,7 @@ +namespace Abacus +{ + public class Class1 + { + + } +} diff --git a/test/Abacus.Tests/Abacus.Tests.csproj b/test/Abacus.Tests/Abacus.Tests.csproj new file mode 100644 index 0000000..f4caf3a --- /dev/null +++ b/test/Abacus.Tests/Abacus.Tests.csproj @@ -0,0 +1,28 @@ + + + + net8.0 + enable + enable + + false + true + + + + + + + + + + + + + + + + + + + diff --git a/test/Abacus.Tests/UnitTest1.cs b/test/Abacus.Tests/UnitTest1.cs new file mode 100644 index 0000000..49e2fcd --- /dev/null +++ b/test/Abacus.Tests/UnitTest1.cs @@ -0,0 +1,18 @@ +namespace Abacus.Tests +{ + public class Tests + { + [SetUp] + public void Setup() + { + } + + [Test] + public void Test1() + { + var obj = new Class1(); + Assert.IsNotNull(obj); + Assert.Pass(); + } + } +} \ No newline at end of file