Bump VersionPrefix to 0.1.3 #24
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
| name: Valir CI | |
| on: | |
| push: | |
| branches: [develop] | |
| pull_request: | |
| branches: [develop] | |
| env: | |
| DOTNET_VERSION: "10.0.x" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --no-restore --configuration Release | |
| - name: Run unit tests | |
| run: dotnet test tests/Valir.Tests --no-build --configuration Release --filter "FullyQualifiedName!~Integration" --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage | |
| - name: Upload unit test coverage | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: coverage-unit-tests | |
| path: ./coverage/**/coverage.cobertura.xml | |
| retention-days: 30 | |
| integration-tests: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| services: | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --no-restore --configuration Release | |
| - name: Run integration tests | |
| run: dotnet test tests/Valir.Tests --no-build --configuration Release --filter "FullyQualifiedName~Integration" --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage | |
| env: | |
| REDIS_CONNECTION: localhost:6379 | |
| - name: Upload integration test coverage | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: coverage-integration-tests | |
| path: ./coverage/**/coverage.cobertura.xml | |
| retention-days: 30 | |
| coverage-report: | |
| runs-on: ubuntu-latest | |
| needs: [build, integration-tests] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Download unit test coverage | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: coverage-unit-tests | |
| path: ./coverage/unit | |
| - name: Download integration test coverage | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: coverage-integration-tests | |
| path: ./coverage/integration | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: ./coverage/unit/**/coverage.cobertura.xml,./coverage/integration/**/coverage.cobertura.xml | |
| fail_ci_if_error: false | |
| verbose: true | |
| - name: Check coverage threshold | |
| run: | | |
| dotnet tool install --global dotnet-reportgenerator-globaltool | |
| reportgenerator \ | |
| -reports:./coverage/**/coverage.cobertura.xml \ | |
| -targetdir:./coverage-report \ | |
| -reporttypes:TextSummary | |
| echo "Coverage Summary:" | |
| cat ./coverage-report/Summary.txt | |
| # Extract line coverage percentage and check threshold (50%) | |
| LINE_COVERAGE=$(grep "Line coverage:" ./coverage-report/Summary.txt | grep -oP '\d+\.?\d*' | head -1) | |
| echo "Line coverage: $LINE_COVERAGE%" | |
| if (( $(echo "$LINE_COVERAGE < 50" | bc -l) )); then | |
| echo "::error::Code coverage ($LINE_COVERAGE%) is below threshold (50%)" | |
| exit 1 | |
| fi | |
| package: | |
| runs-on: ubuntu-latest | |
| needs: [build, integration-tests] | |
| if: github.ref == 'refs/heads/develop' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Pack NuGet packages | |
| run: | | |
| dotnet pack src/Valir.Abstractions -c Release -o ./packages | |
| dotnet pack src/Valir.Core -c Release -o ./packages | |
| dotnet pack src/Valir.Redis -c Release -o ./packages | |
| dotnet pack src/Valir.AspNet -c Release -o ./packages | |
| dotnet pack src/Valir.EntityFrameworkCore -c Release -o ./packages | |
| dotnet pack src/Valir.Brokers.Kafka -c Release -o ./packages | |
| dotnet pack src/Valir.Brokers.RabbitMQ -c Release -o ./packages | |
| dotnet pack src/Valir.Brokers.AzureSB -c Release -o ./packages | |
| - name: Upload packages artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: nuget-packages | |
| path: ./packages/*.nupkg |