Skip to content

CI - Development

CI - Development #63

Workflow file for this run

name: CI - Development
on:
push:
branches: [ develop ]
schedule:
# Run nightly builds on develop branch
- cron: '0 2 * * *' # 2 AM UTC daily
env:
DOTNET_VERSION: '8.0.x'
jobs:
comprehensive-test:
name: Comprehensive Testing
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: [ubuntu-latest]
configuration: [Debug, Release]
include:
- runner: ubuntu-latest
os-label: "GitHub-Hosted"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore
- name: Build solution
run: dotnet build --no-restore --configuration ${{ matrix.configuration }}
- name: Run all tests
run: dotnet test --no-build --configuration ${{ matrix.configuration }} --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage
- name: Upload coverage to Codecov
if: matrix.runner == 'ubuntu-latest' && matrix.configuration == 'Release'
uses: codecov/codecov-action@v3
with:
directory: ./coverage
flags: unittests,${{ matrix.os-label }}
name: codecov-${{ matrix.os-label }}
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
needs: comprehensive-test
if: success()
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: testdb
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Run integration tests
run: dotnet test --configuration Release --filter "Category=Integration" --verbosity normal
env:
ConnectionStrings__Default: "Host=localhost;Database=testdb;Username=postgres;Password=postgres"
performance-tests:
name: Performance Tests
runs-on: ubuntu-latest
needs: comprehensive-test
if: success()
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Run performance tests
run: dotnet test --configuration Release --filter "Category=Performance" --verbosity normal
- name: Run benchmarks
run: |
if [ -d "./benchmarks" ]; then
dotnet run --project ./benchmarks --configuration Release
else
echo "No benchmarks project found, skipping..."
fi
package-preview:
name: Create Preview Package
runs-on: ubuntu-latest
needs: [comprehensive-test, integration-tests]
if: success()
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: Set preview version
run: |
PREVIEW_VERSION="0.1.0-preview.$(date +%Y%m%d%H%M%S)"
echo "PACKAGE_VERSION=$PREVIEW_VERSION" >> $GITHUB_ENV
echo "Preview version set to: $PREVIEW_VERSION"
- name: Build and pack
run: dotnet pack --configuration Release --output ./packages -p:PackageVersion=${{ env.PACKAGE_VERSION }}
- name: Upload preview package
uses: actions/upload-artifact@v4
with:
name: preview-package-${{ env.PACKAGE_VERSION }}
path: ./packages/*.nupkg
retention-days: 7
- name: Publish to development feed
if: github.ref == 'refs/heads/develop'
run: |
dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
dotnet nuget push ./packages/*.nupkg --source "github" --skip-duplicate