Skip to content

Fix tests

Fix tests #15

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
paths-ignore:
- '**.md'
- 'docs/**'
- '.editorconfig.example'
pull_request:
branches: [ main ]
paths-ignore:
- '**.md'
- 'docs/**'
- '.editorconfig.example'
env:
DOTNET_VERSION: '9.0.x'
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
build:
name: Build and Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=test-results.trx"
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}
path: '**/test-results.trx'
pack:
name: Pack NuGet Packages
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore dependencies
run: dotnet restore
- name: Pack Analyzer
run: dotnet pack src/ThrowsAnalyzer/ThrowsAnalyzer.csproj --configuration Release --no-restore --output ./artifacts
- name: Pack CLI Tool
run: dotnet pack src/ThrowsAnalyzer.Cli/ThrowsAnalyzer.Cli.csproj --configuration Release --no-restore --output ./artifacts
- name: List artifacts
run: ls -lh ./artifacts
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: ./artifacts/*.nupkg
retention-days: 7
analyze:
name: Code Analysis
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore dependencies
run: dotnet restore
- name: Build for analysis
run: dotnet build --configuration Release --no-restore /p:TreatWarningsAsErrors=false
- name: Summary
run: |
echo "## Build Summary" >> $GITHUB_STEP_SUMMARY
echo "✅ Build completed successfully" >> $GITHUB_STEP_SUMMARY
echo "✅ All tests passed" >> $GITHUB_STEP_SUMMARY
echo "✅ Analyzer package created" >> $GITHUB_STEP_SUMMARY
echo "✅ CLI tool package created" >> $GITHUB_STEP_SUMMARY