Skip to content

build(deps): Bump actions/checkout from 4 to 6 #14

build(deps): Bump actions/checkout from 4 to 6

build(deps): Bump actions/checkout from 4 to 6 #14

Workflow file for this run

name: Build and Test
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
env:
DOTNET_VERSION: '9.0.x'
SOLUTION_FILE: 'DotNetDevMCP.sln'
jobs:
build:
name: Build and Test
runs-on: ${{ matrix.os }}
timeout-minutes: 30
permissions:
contents: read
checks: write
pull-requests: write
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
configuration: [Debug, Release]
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Display .NET info
run: dotnet --info
- name: Restore dependencies
run: dotnet restore ${{ env.SOLUTION_FILE }}
- name: Build solution
run: dotnet build ${{ env.SOLUTION_FILE }} --configuration ${{ matrix.configuration }} --no-restore
- name: Run tests with coverage
run: dotnet test tests/DotNetDevMCP.Core.Tests/DotNetDevMCP.Core.Tests.csproj --configuration ${{ matrix.configuration }} --no-build --verbosity normal --logger "trx;LogFileName=test-results.trx" --collect:"XPlat Code Coverage" --results-directory ./coverage
timeout-minutes: 5
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.configuration == 'Release'
uses: codecov/codecov-action@v4
with:
directory: ./coverage
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.os }}-${{ matrix.configuration }}
path: '**/test-results.trx'
- name: Publish test results
uses: dorny/test-reporter@v1
if: always()
with:
name: Test Results (${{ matrix.os }}-${{ matrix.configuration }})
path: '**/test-results.trx'
reporter: dotnet-trx
code-quality:
name: Code Quality Analysis
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore dependencies
run: dotnet restore ${{ env.SOLUTION_FILE }}
- name: Build solution
run: dotnet build ${{ env.SOLUTION_FILE }} --configuration Release --no-restore
- name: Run code analysis
run: dotnet build ${{ env.SOLUTION_FILE }} --configuration Release --no-restore /p:EnforceCodeStyleInBuild=true /p:TreatWarningsAsErrors=false
package:
name: Create NuGet Packages
runs-on: ubuntu-latest
timeout-minutes: 15
needs: [build, code-quality]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore dependencies
run: dotnet restore ${{ env.SOLUTION_FILE }}
- name: Build solution
run: dotnet build ${{ env.SOLUTION_FILE }} --configuration Release --no-restore
- name: Pack NuGet packages
run: dotnet pack ${{ env.SOLUTION_FILE }} --configuration Release --no-build --output ./artifacts
- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: ./artifacts/*.nupkg
retention-days: 7
publish-demo:
name: Publish Sample Applications
runs-on: ubuntu-latest
timeout-minutes: 15
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Publish OrchestrationDemo
run: dotnet publish samples/OrchestrationDemo/OrchestrationDemo.csproj --configuration Release --output ./publish/OrchestrationDemo
- name: Publish TestingServiceDemo
run: dotnet publish samples/TestingServiceDemo/TestingServiceDemo.csproj --configuration Release --output ./publish/TestingServiceDemo
- name: Upload published artifacts
uses: actions/upload-artifact@v4
with:
name: sample-applications
path: ./publish/**/*
retention-days: 7