Merge pull request #224 from dorssel/dependabot/github_actions/all-ac… #494
This file contains hidden or 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
| # SPDX-FileCopyrightText: 2024 Frans van Dorsselaer | |
| # | |
| # SPDX-License-Identifier: MIT | |
| --- | |
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
| name: Build | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: {} | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| issues: read | |
| checks: write | |
| pull-requests: write | |
| id-token: write | |
| attestations: write | |
| env: | |
| NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 | |
| with: | |
| cache: true | |
| cache-dependency-path: | | |
| global.json | |
| '**/Directory.Packages.props' | |
| .config/dotnet-tools.json | |
| - name: Restore dependencies | |
| run: | | |
| dotnet tool restore | |
| dotnet restore | |
| - name: Build | |
| run: | | |
| dotnet build --configuration Release --no-restore --binaryLogger:build.binlog | |
| - name: Test | |
| run: | | |
| dotnet test --configuration Release --no-build \ | |
| --report-spekt-junit \ | |
| --coverage --coverage-output-format cobertura | |
| - name: Package | |
| run: | | |
| dotnet pack --configuration Release --no-build | |
| - name: Upload Package Artifact | |
| id: upload | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: artifacts | |
| path: | | |
| **/*.nupkg | |
| **/*.snupkg | |
| retention-days: 14 | |
| - name: Build Attestation | |
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository | |
| uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 | |
| with: | |
| subject-name: artifacts.zip | |
| subject-digest: sha256:${{ steps.upload.outputs.artifact-digest }} | |
| - name: Upload test results to Codecov | |
| if: ${{ !cancelled() }} | |
| uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 | |
| with: | |
| fail_ci_if_error: true | |
| report_type: test_results | |
| files: TestResults/TestResults.xml | |
| disable_search: true | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 | |
| with: | |
| fail_ci_if_error: true | |
| files: TestResults/*.cobertura.xml | |
| disable_search: true | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Submit Dependencies to GitHub | |
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository | |
| uses: advanced-security/component-detection-dependency-submission-action@31f25a8de68ae5ce2ca274bc28546a78683c15ce # v0.1.4 | |
| with: | |
| detectorArgs: MSBuildBinaryLog=Enable | |
| detectorsFilter: MSBuildBinaryLog | |
| - name: Dependency Review | |
| if: github.event_name == 'pull_request' | |
| uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0 | |
| with: | |
| comment-summary-in-pr: always |