Skip to content

clean up warnings

clean up warnings #4

Workflow file for this run

# .github/workflows/ci.yml
name: CI
on:
push:
branches: [ main, develop ]
paths-ignore:
- '**.md'
- 'LICENSE'
- '.gitignore'
pull_request:
branches: [ main ]
paths-ignore:
- '**.md'
- 'LICENSE'
- '.gitignore'
env:
DOTNET_VERSION: '9.0.x'
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
build-and-test:
name: Build and Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
configuration: [Debug, Release]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for better build versioning
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration ${{ matrix.configuration }} --no-restore
- name: Run tests
run: dotnet test --configuration ${{ matrix.configuration }} --no-build --verbosity normal --logger trx --results-directory TestResults
if: hashFiles('**/*Tests.csproj') != ''
- name: Upload test results
uses: actions/upload-artifact@v4
if: always() && hashFiles('**/*Tests.csproj') != ''
with:
name: test-results-${{ matrix.os }}-${{ matrix.configuration }}
path: TestResults/*.trx
code-quality:
name: Code Quality Checks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore dependencies
run: dotnet restore
- name: Check code formatting
run: |
dotnet format --verify-no-changes --verbosity diagnostic
continue-on-error: true # Don't fail the build on format issues
- name: Run code analysis
run: |
dotnet build /p:TreatWarningsAsErrors=true /p:AnalysisMode=AllEnabledByDefault
continue-on-error: true # Don't fail on warnings for now
security-scan:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore dependencies
run: dotnet restore
- name: Scan for vulnerable packages
run: |
dotnet list package --vulnerable --include-transitive
- name: Install security scanner
run: |
dotnet tool install --global security-scan
continue-on-error: true
publish-preview:
name: Test Publish
runs-on: ubuntu-latest
needs: [build-and-test]
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Test publish for multiple runtimes
run: |
# Test that publish works for major platforms
for runtime in win-x64 linux-x64 osx-arm64; do
echo "Testing publish for $runtime..."
dotnet publish GeminiClientConsole/GeminiClientConsole.csproj \
--configuration Release \
--runtime $runtime \
--self-contained true \
--output ./test-publish/$runtime \
-p:PublishSingleFile=true \
-p:PublishTrimmed=true
done
- name: Check output sizes
run: |
echo "### Build Sizes" >> $GITHUB_STEP_SUMMARY
echo "| Platform | Size |" >> $GITHUB_STEP_SUMMARY
echo "|----------|------|" >> $GITHUB_STEP_SUMMARY
for dir in ./test-publish/*; do
platform=$(basename $dir)
size=$(du -sh $dir | cut -f1)
echo "| $platform | $size |" >> $GITHUB_STEP_SUMMARY
done