diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..93fea35 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,72 @@ +# 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: [ "main" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "main" ] + schedule: + - cron: '19 8 * * 4' + +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@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + 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#, 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@v3 + + # ℹī¸ 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@v3 \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 17a161d..1744070 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,70 +1,67 @@ -name: .NET 7 Build, Test, and Release Process +name: Build Logger Project on: push: - branches: [ main ] + branches: + - main + pull_request: + branches: + - main jobs: build_and_test: runs-on: windows-latest - outputs: - should-run: ${{ steps.set-output.outputs.should-run }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup .NET - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: dotnet-version: '7.0.x' - name: Restore dependencies - run: dotnet restore ${{ github.workspace }}//.sln + run: dotnet restore ${{ github.workspace }}/Logger/Logger.sln - name: Clean - run: dotnet clean ${{ github.workspace }}//.sln --configuration Release + run: dotnet clean ${{ github.workspace }}/Logger/Logger.sln --configuration Release - name: Build - run: dotnet build ${{ github.workspace }}//.sln --configuration Release --no-restore + run: dotnet build ${{ github.workspace }}/Logger/Logger.sln --configuration Release --no-restore - name: Test - run: dotnet test ${{ github.workspace }}//.sln --configuration Release --no-build + run: dotnet test ${{ github.workspace }}/Logger/Logger.sln --configuration Release --no-build --logger "trx;LogFileName=test_results.trx" - - name: Set Output - run: echo "::set-output name=should-run::true" - id: set-output - - project_operations: - needs: build_and_test - if: needs.build_and_test.outputs.should-run == 'true' - runs-on: windows-latest - - steps: - - uses: actions/checkout@v2 - - - name: Generate Release Notes from Milestone - uses: jeffpatton1971/Issue2Release@v0.0.1.2 + - name: Publish Test Results + if: always() + uses: actions/upload-artifact@v3 with: - token: ${{ secrets.GITHUB_TOKEN }} - milestone: '' + name: Test Results + path: '**/TestResults/*.trx' pack_and_publish: - needs: [build_and_test, project_operations] - if: needs.build_and_test.outputs.should-run == 'true' + needs: build_and_test + if: success() runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup .NET - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: dotnet-version: '7.0.x' + - name: Restore dependencies + run: dotnet restore ${{ github.workspace }}/Logger/Logger.sln + + - name: Build + run: dotnet build ${{ github.workspace }}/Logger/Logger.sln --configuration Release --no-restore + - name: Package - run: dotnet pack ${{ github.workspace }}//.sln --configuration Release --no-build --output nupkgs + run: dotnet pack ${{ github.workspace }}/Logger/Logger.sln --configuration Release --output nupkgs - name: Publish NuGet Package run: | - nuget push **/*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json - if: github.ref == 'refs/heads/main' && github.event_name == 'push' + nuget push **/*.nupkg -ApiKey ${{secrets.NUGET_API_KEY}} -Source https://api.nuget.org/v3/index.json + if: github.ref == 'refs/heads/main' && github.event_name == 'push' \ No newline at end of file diff --git a/.github/workflows/milestone-closed.yml b/.github/workflows/milestone-closed.yml index 56b0043..cb6c1d9 100644 --- a/.github/workflows/milestone-closed.yml +++ b/.github/workflows/milestone-closed.yml @@ -1,19 +1,69 @@ -name: Generate Release Notes on Milestone Closure +name: New Release on: milestone: types: [closed] jobs: - generate_release_notes: + create-release: runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Generate Release Notes - uses: jeffpatton1971/Issue2Release@v0.0.1.2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - milestone: ${{ github.event.milestone.number }} + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Get Project Version + id: get_version + uses: mod-posh/GetProjectVersion@v0.0.2.2 + with: + Filename: 'Logger/Logger.csproj' + verbose: "verbose" + + - name: Create Release Notes + uses: mod-posh/Issue2ReleaseNotes@v0.0.3.3 + with: + milestone_number: ${{ github.event.milestone.number }} + verbose: 'verbose' + github_token: ${{ secrets.PAT }} + + - name: Pull Latest Changes + run: git pull origin ${{ github.ref_name }} + shell: bash + + - name: Create Release + uses: mod-posh/NewTaggedRelease@v0.0.3.2 + with: + name: 'Release v${{ env.VERSION }}' + filename: 'RELEASE.md' + version: ${{ env.VERSION }} + verbose: 'verbose' + github_token: ${{ secrets.PAT }} + + - name: Install XMLDocMD Tool + run: dotnet tool install --global xmldocmd + + - name: Build Project + run: dotnet build Logger/Logger.csproj --configuration Release + + - name: Publish Project + run: dotnet publish Logger/Logger.csproj --configuration Release --output ./publish + + - name: Generate Documentation + run: | + xmldocmd ./publish/Logger.dll Docs --visibility private --clean --namespace ModPosh.Logger --namespace-pages + env: + PATH: ${{ github.runner.tool_cache }}/.dotnet/tools:$PATH:~/.dotnet/tools + + - name: Run markdownlint-cli2-action + uses: DavidAnson/markdownlint-cli2-action@v16 + with: + globs: '**/*.md' + fix: true + + - name: Commit Documentation Changes + run: | + git config --local user.name "github-actions[bot]" + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git add Docs/ + git commit -m "Update documentation for release v${{ env.VERSION }}" + git push origin ${{ github.ref_name }} + if: success() \ No newline at end of file diff --git a/Logger.Tests/Logger.Tests.csproj b/Logger.Tests/Logger.Tests.csproj index 62aea51..ef3f75a 100644 --- a/Logger.Tests/Logger.Tests.csproj +++ b/Logger.Tests/Logger.Tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net6.0;net7.0 enable true enable diff --git a/Logger/Logger.csproj b/Logger/Logger.csproj index 1800b57..4ff51a5 100644 --- a/Logger/Logger.csproj +++ b/Logger/Logger.csproj @@ -1,12 +1,12 @@ ModPosh.Logger - net7.0 + net6.0;net7.0 ModPosh.Logger enable enable True - 1.0.1 + 1.1.0 Jeffrey S. Patton Patton-Tech.com A Logging library for .Net and PowerShell