Bump Aspire.AppHost.Sdk and Aspire.Hosting.Testing #1732
Workflow file for this run
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
| # 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: CI | |
| on: | |
| push: | |
| branches: ["main", "master"] | |
| # because it's a required check for the merge group | |
| # paths: | |
| # - "OSLC4Net_SDK/**" | |
| # - ".github/workflows/*.yml" | |
| pull_request: | |
| branches: ["main", "master"] | |
| # because it's a required check for the merge group | |
| # paths: | |
| # - "OSLC4Net_SDK/**" | |
| # - ".github/workflows/main.yml" | |
| merge_group: | |
| release: | |
| types: | |
| - published # Run the workflow when a new GitHub release is published | |
| workflow_dispatch: | |
| inputs: | |
| release: | |
| description: "Make the release build" | |
| required: false | |
| type: boolean | |
| default: false | |
| # version: | |
| # description: "Version string" | |
| # required: true | |
| # type: string | |
| env: | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
| DOTNET_NOLOGO: true | |
| # NuGetDirectory: ${{ github.workspace}}/nuget | |
| NuGetDirectory: '${{ github.workspace}}/nupkg_out' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'ci:full') }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| format: | |
| name: Format (dotnet format) | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 10 | |
| defaults: | |
| run: | |
| working-directory: main/OSLC4Net_SDK/ | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1 | |
| with: | |
| disable-sudo: true | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| show-progress: false | |
| persist-credentials: false | |
| path: main | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@2016bd2012dba4e32de620c46fe006a3ac9f0602 # v5.0.1 | |
| with: | |
| dotnet-version: 10.x | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Verify formatting | |
| run: | | |
| dotnet format OSLC4Net.Core.slnx style --verify-no-changes | |
| dotnet format OSLC4Net.Core.slnx whitespace --verify-no-changes | |
| test: | |
| #needs: [format] | |
| permissions: | |
| contents: read # for actions/checkout to fetch code | |
| packages: write # for setup-dotnet to create package | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-24.04, ubuntu-24.04-arm, windows-latest] | |
| version: | |
| [ | |
| # { setup: "8.x", target: "net8.0" }, | |
| # { setup: "9.x", target: "net9.0" }, | |
| { setup: "10.x", target: "net10.0" }, | |
| ] | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 15 | |
| defaults: | |
| run: | |
| working-directory: main/OSLC4Net_SDK/ | |
| env: | |
| NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages | |
| # TAG_VALUE: ${{ github.ref_name || inputs.version }} | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1 | |
| with: | |
| disable-sudo: true | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| show-progress: false | |
| persist-credentials: false | |
| path: main | |
| - name: Checkout Code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| show-progress: false | |
| persist-credentials: false | |
| repository: oslc-op/refimpl | |
| path: refimpl | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@2016bd2012dba4e32de620c46fe006a3ac9f0602 # v5.0.1 | |
| with: | |
| dotnet-version: ${{ matrix.version.setup }} | |
| source-url: https://nuget.pkg.github.com/oslc/index.json | |
| env: | |
| NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
| # - name: Target ${{ matrix.version.target }} only | |
| # shell: pwsh | |
| # run: | | |
| # (Get-Content Tests/OSLC4Net.Test.RefImpl/OSLC4Net.Test.RefImpl.csproj) | | |
| # ForEach-Object { $_ -replace '>net10.0<', '>${{ matrix.version.target }}<' } | | |
| # Set-Content Tests/OSLC4Net.Test.RefImpl/OSLC4Net.Test.RefImpl.csproj | |
| # (Get-Content Tests/OSLC4Net.Client.Tests/OSLC4Net.Client.Tests.csproj) | | |
| # ForEach-Object { $_ -replace '>net10.0<', '>${{ matrix.version.target }}<' } | | |
| # Set-Content Tests/OSLC4Net.Client.Tests/OSLC4Net.Client.Tests.csproj | |
| # (Get-Content Tests/OSLC4Net.Core.DotNetRdfProviderTests/OSLC4Net.Core.DotNetRdfProviderTests.csproj) | | |
| # ForEach-Object { $_ -replace '>net10.0<', '>${{ matrix.version.target }}<' } | | |
| # Set-Content Tests/OSLC4Net.Core.DotNetRdfProviderTests/OSLC4Net.Core.DotNetRdfProviderTests.csproj | |
| # (Get-Content Tests/OSLC4Net.Core.QueryTests/OSLC4Net.Core.QueryTests.csproj) | | |
| # ForEach-Object { $_ -replace '>net10.0<', '>${{ matrix.version.target }}<' } | | |
| # Set-Content Tests/OSLC4Net.Core.QueryTests/OSLC4Net.Core.QueryTests.csproj | |
| # (Get-Content Tests/OSLC4Net.Test.AspireHost/OSLC4Net.Test.AspireHost.csproj) | | |
| # ForEach-Object { $_ -replace '>net10.0<', '>${{ matrix.version.target }}<' } | | |
| # Set-Content Tests/OSLC4Net.Test.AspireHost/OSLC4Net.Test.AspireHost.csproj | |
| # (Get-Content Tests/OSLC4NetExamples.Server.Tests/OSLC4NetExamples.Server.Tests.csproj) | | |
| # ForEach-Object { $_ -replace '>net10.0<', '>${{ matrix.version.target }}<' } | | |
| # Set-Content Tests/OSLC4NetExamples.Server.Tests/OSLC4NetExamples.Server.Tests.csproj | |
| - name: Cache NuGet | |
| # id: cache-nuget | |
| uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | |
| # env: | |
| # cache-name: cache-node-modules | |
| with: | |
| # npm cache files are stored in `~/.npm` on Linux/macOS | |
| path: ${{ env.NUGET_PACKAGES }} | |
| key: ${{ runner.os }}-nuget-${{ matrix.version.target }}-${{ hashFiles('.github/workflows/main.yml', '**/Directory.Build.props', '**/packages.config', '**/packages.lock.json', '**/*.slnx', '**/*.csproj') }} | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --no-restore --configuration Release | |
| - name: Test (with Refimpl CM tests) | |
| run: dotnet test --solution OSLC4Net.Core.slnx --no-build --configuration Release --coverage --coverage-output-format cobertura | |
| if: | | |
| matrix.os != 'windows-latest' | |
| - name: Test (without Refimpl CM tests) | |
| run: dotnet test --solution OSLC4Net.Core.slnx --no-build --configuration Release --treenode-filter '/*/*/*/*[TestCategory!=RunningOslcServerRequired]' --coverage --coverage-output-format cobertura | |
| if: | | |
| matrix.os == 'windows-latest' | |
| - name: ReportGenerator | |
| uses: danielpalme/ReportGenerator-GitHub-Action@5.5.3 | |
| with: | |
| reports: '${{ github.workspace }}/**/TestResults/**/*.cobertura.xml' | |
| targetdir: '${{ github.workspace }}/coveragereports' | |
| reporttypes: 'Cobertura;MarkdownSummaryGithub' | |
| - name: Upload coverage into summary | |
| # Only on non windows runners | |
| if: ${{ runner.os != 'Windows' }} | |
| run: | | |
| cat $GITHUB_WORKSPACE/coveragereports/SummaryGithub.md >> $GITHUB_STEP_SUMMARY | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| with: | |
| exclude: .nuget,main/OSLC4Net_SDK/Examples | |
| # files: "${{ github.workspace }}/main/OSLC4Net_SDK/Tests/*/TestResults/*.coverage,${{ github.workspace }}/main/OSLC4Net_SDK/Tests/*/TestResults/*.xml" | |
| files: ${{ github.workspace }}/coveragereports/Cobertura.xml | |
| - name: Pack NuGet packages (snapshot) | |
| shell: pwsh | |
| run: | | |
| dotnet pack -c Release -o $env:NuGetDirectory --include-symbols -p:SymbolPackageFormat=snupkg | |
| if: | | |
| success() && github.ref == 'refs/heads/main' | |
| && matrix.version.target == 'net10.0' && matrix.os == 'windows-latest' | |
| && ! ( github.event_name == 'release' || inputs.release) | |
| - name: Pack NuGet packages (release) | |
| shell: pwsh | |
| run: | | |
| Write-Host $env:GITHUB_REF | |
| if ( $env:GITHUB_REF -match '^refs/tags/v(.*)$' ) { | |
| $VERSION=$matches[1] | |
| Write-Host $VERSION | |
| dotnet pack -c Release -p:RELEASE_VERSION=$VERSION -o $env:NuGetDirectory --include-symbols -p:SymbolPackageFormat=snupkg | |
| } else { | |
| Write-Error "Failed to extract the version from env:GITHUB_REF" | |
| Exit 1 | |
| } | |
| if: | | |
| success() | |
| && matrix.version.target == 'net10.0' && matrix.os == 'windows-latest' | |
| && ( github.event_name == 'release' || inputs.release ) | |
| - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: nuget | |
| # if-no-files-found: error | |
| retention-days: 7 | |
| path: "${{ env.NuGetDirectory }}/*.nupkg" | |
| if: | | |
| success() | |
| && matrix.version.target == 'net10.0' && matrix.os == 'windows-latest' | |
| - name: Publish NuGet packages (GH/always) | |
| shell: pwsh | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| foreach($file in (Get-ChildItem $env:NuGetDirectory -Recurse -Include *.nupkg)) { | |
| dotnet nuget push $file --api-key $env:GITHUB_TOKEN --skip-duplicate | |
| } | |
| if: | | |
| success() | |
| && matrix.version.target == 'net10.0' && matrix.os == 'windows-latest' | |
| && (github.ref == 'refs/heads/main' || github.event_name == 'release' || inputs.release) | |
| - name: Publish NuGet packages (NuGet.org/release) | |
| shell: pwsh | |
| env: | |
| NUGET_APIKEY: ${{ secrets.NUGET_APIKEY }} | |
| run: | | |
| foreach($file in (Get-ChildItem $env:NuGetDirectory -Recurse -Include *.nupkg)) { | |
| dotnet nuget push $file --api-key $env:NUGET_APIKEY --source https://api.nuget.org/v3/index.json --skip-duplicate | |
| } | |
| if: | | |
| success() | |
| && matrix.version.target == 'net10.0' && matrix.os == 'windows-latest' | |
| && (github.event_name == 'release' || inputs.release ) | |
| build-docker-example: | |
| name: Build Docker Image (Example) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1 | |
| with: | |
| disable-sudo: true | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| show-progress: false | |
| persist-credentials: false | |
| path: main | |
| - name: Build Docker image | |
| run: | | |
| cd main/OSLC4Net_SDK | |
| docker build -t oslc4net-example-api -f Examples/OSLC4NetExamples.Server.NetCoreApi/Dockerfile . |