WiP #51
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Packages | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
env: | |
DOTNET_NOLOGO: true | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
MINVERBUILDMETADATA: build.${{github.run_number}} | |
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: 'Git Fetch Tags' | |
run: git fetch --tags | |
- name: Enable nuget package locking | |
run: touch packages.lock.json | |
- name: 'Install .NET SDK' | |
uses: actions/setup-dotnet@v3 | |
with: | |
global-json-file: global.json | |
cache: true | |
- name: 'Dotnet Tool Restore' | |
run: dotnet tool restore | |
- name: "Dotnet Cake Build" | |
run: dotnet cake --target=Build | |
- name: "Dotnet Cake Test" | |
run: dotnet cake --target=Test | |
- name: "Dotnet Cake Pack" | |
run: dotnet cake --target=Pack | |
- name: 'Publish Test Result Artifacts' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
path: './Artifacts/TestResults/*' | |
- name: 'Publish Package Artifacts' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages | |
path: './Artifacts/Packages/*' | |
publish-test-results: | |
name: "Publish Tests Results" | |
needs: build | |
if: always() | |
permissions: | |
checks: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Download Test Result Artifacts" | |
uses: actions/download-artifact@v3.0.2 | |
with: | |
name: test-results | |
path: "./Artifacts" | |
- name: "Publish Test Summary" | |
uses: test-summary/action@v2 | |
if: always() | |
with: | |
paths: "./Artifacts/*.xml" | |
- name: Parse Trx files | |
uses: NasAmin/trx-parser@v0.5.0 | |
id: trx-parser | |
with: | |
TRX_PATH: "./Artifacts/TestResults" | |
REPO_TOKEN: ${{ github.token }} | |
- name: Code Coverage Report | |
uses: irongut/CodeCoverageSummary@v1.3.0 | |
with: | |
filename: Artifacts/**/coverage.cobertura.xml | |
badge: true | |
fail_below_min: false | |
format: markdown | |
hide_branch_rate: false | |
hide_complexity: true | |
indicators: true | |
output: both | |
thresholds: '60 80' | |
- name: Add Coverage PR Comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
if: github.event_name == 'pull_request' | |
with: | |
recreate: true | |
path: code-coverage-results.md | |
push-github-packages: | |
name: "Push GitHub Packages" | |
needs: build | |
if: github.ref == 'refs/heads/main' || github.event_name == 'release' | |
env: | |
name: "GitHub Packages" | |
url: "https://github.com/${{github.repository}}/packages" | |
permissions: | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Download Artifact" | |
uses: actions/download-artifact@v3.0.2 | |
with: | |
name: "packages" | |
path: "./Artifacts" | |
- name: "Dotnet NuGet Add Source" | |
run: dotnet nuget add source https://nuget.pkg.github.com/scottt732/index.json --name GitHub --username 'scottt732' --password '${{ github.token }}' --store-password-in-clear-text | |
shell: pwsh | |
- name: "Hmm" | |
run: find . -name .git -prune -o -name bin -prune -o -name obj -prune -o -name .vs -prune -o -name .vscode -prune -o -name .devcontainer -prune -o -name _ReSharper.Caches -prune -o -name .scripts -prune -o -name .nuget -prune -o -name .github -prune -o -type f -print | |
- name: "Dotnet NuGet Push Libraries" | |
run: dotnet nuget push ${{ github.workspace }}/Artifacts/*.nupkg --api-key '${{ github.token }}' --source GitHub --skip-duplicate | |
shell: pwsh | |
- name: "Dotnet NuGet Push Symbols" | |
run: dotnet nuget push ${{ github.workspace }}/Artifacts/*.snupkg --api-key '${{ github.token }}' --source GitHub --skip-duplicate | |
shell: pwsh |