Merge pull request #25 from EFNext/feat/mongo-integration #139
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| checks: write | |
| pull-requests: write | |
| jobs: | |
| build-and-test: | |
| name: Build & Test | |
| runs-on: ubuntu-latest | |
| env: | |
| CI: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET SDKs | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 8.0.x | |
| 9.0.x | |
| 10.0.x | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', 'Directory.Packages.props') }} | |
| restore-keys: | | |
| nuget-${{ runner.os }}- | |
| - name: Restore | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --no-restore -c Release | |
| - name: Test | |
| # MongoDB integration tests run in the dedicated `mongodb-tests` job — | |
| # list the non-Mongo projects explicitly so Build & Test doesn't need | |
| # Docker or pay the container startup cost on every PR. | |
| run: | | |
| set -e | |
| for proj in \ | |
| tests/ExpressiveSharp.Tests \ | |
| tests/ExpressiveSharp.IntegrationTests \ | |
| tests/ExpressiveSharp.Generator.Tests \ | |
| tests/ExpressiveSharp.EntityFrameworkCore.IntegrationTests; do | |
| dotnet test --no-build -c Release \ | |
| --project "$proj" \ | |
| --results-directory ./test-results \ | |
| -- \ | |
| --report-trx --report-trx-filename "$(basename "$proj").trx" \ | |
| --coverage \ | |
| --coverage-output-format cobertura \ | |
| --coverage-output "$(basename "$proj").coverage.xml" | |
| done | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: | | |
| ./test-results/*.trx | |
| ./test-results/*.coverage.xml | |
| retention-days: 14 | |
| - name: Upload coverage to Codecov | |
| if: always() | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./test-results/*.coverage.xml | |
| fail_ci_if_error: false | |
| - name: Test report | |
| if: always() | |
| uses: dorny/test-reporter@v1 | |
| with: | |
| name: Test Results | |
| path: ./test-results/*.trx | |
| reporter: dotnet-trx | |
| - name: Pack | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: >- | |
| dotnet pack --no-build -c Release | |
| -p:VersionSuffix=ci.${{ github.run_number }} | |
| --output ./packages | |
| - name: Upload NuGet packages | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nuget-packages | |
| path: | | |
| ./packages/*.nupkg | |
| ./packages/*.snupkg | |
| retention-days: 14 | |
| container-tests: | |
| name: Container Tests (${{ matrix.database }}) | |
| runs-on: ubuntu-latest | |
| needs: build-and-test | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| database: [SqlServer, Postgres, PomeloMySql, Cosmos] | |
| env: | |
| CI: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET SDKs | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 8.0.x | |
| 9.0.x | |
| 10.0.x | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: nuget-${{ runner.os }}-${{ matrix.database }}-${{ hashFiles('**/*.csproj', 'Directory.Packages.props') }} | |
| restore-keys: | | |
| nuget-${{ runner.os }}-${{ matrix.database }}- | |
| nuget-${{ runner.os }}- | |
| - name: Restore | |
| run: >- | |
| dotnet restore | |
| tests/ExpressiveSharp.EntityFrameworkCore.IntegrationTests/ExpressiveSharp.EntityFrameworkCore.IntegrationTests.csproj | |
| -p:TestDatabase=${{ matrix.database }} | |
| - name: Build | |
| run: >- | |
| dotnet build --no-restore -c Release | |
| tests/ExpressiveSharp.EntityFrameworkCore.IntegrationTests/ExpressiveSharp.EntityFrameworkCore.IntegrationTests.csproj | |
| -p:TestDatabase=${{ matrix.database }} | |
| - name: Test | |
| run: | | |
| if [ "${{ matrix.database }}" = "Cosmos" ]; then | |
| # Cosmos vNext emulator binds host port 8081 (the .NET SDK | |
| # connects to the gateway-advertised endpoint, which must | |
| # match the host-side port), so only one emulator can run | |
| # at a time. Run TFMs sequentially. | |
| for tfm in net8.0 net9.0 net10.0; do | |
| echo "::group::Cosmos tests ($tfm)" | |
| dotnet test --no-build -c Release \ | |
| --project tests/ExpressiveSharp.EntityFrameworkCore.IntegrationTests \ | |
| -p:TestDatabase=${{ matrix.database }} \ | |
| -f "$tfm" \ | |
| --results-directory ./test-results \ | |
| -- \ | |
| --report-trx --report-trx-filename "results-$tfm.trx" | |
| echo "::endgroup::" | |
| done | |
| else | |
| dotnet test --no-build -c Release \ | |
| --project tests/ExpressiveSharp.EntityFrameworkCore.IntegrationTests \ | |
| -p:TestDatabase=${{ matrix.database }} \ | |
| --results-directory ./test-results \ | |
| -- \ | |
| --report-trx --report-trx-filename results.trx | |
| fi | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: container-test-results-${{ matrix.database }} | |
| path: ./test-results/*.trx | |
| retention-days: 14 | |
| - name: Test report | |
| if: always() | |
| uses: dorny/test-reporter@v1 | |
| with: | |
| name: Container Test Results (${{ matrix.database }}) | |
| path: ./test-results/*.trx | |
| reporter: dotnet-trx | |
| mongodb-tests: | |
| name: Container Tests (MongoDB) | |
| runs-on: ubuntu-latest | |
| needs: build-and-test | |
| timeout-minutes: 10 | |
| env: | |
| CI: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET SDKs | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 8.0.x | |
| 9.0.x | |
| 10.0.x | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: nuget-${{ runner.os }}-MongoDB-${{ hashFiles('**/*.csproj', 'Directory.Packages.props') }} | |
| restore-keys: | | |
| nuget-${{ runner.os }}-MongoDB- | |
| nuget-${{ runner.os }}- | |
| - name: Restore | |
| run: >- | |
| dotnet restore | |
| tests/ExpressiveSharp.MongoDB.IntegrationTests/ExpressiveSharp.MongoDB.IntegrationTests.csproj | |
| - name: Build | |
| run: >- | |
| dotnet build --no-restore -c Release | |
| tests/ExpressiveSharp.MongoDB.IntegrationTests/ExpressiveSharp.MongoDB.IntegrationTests.csproj | |
| - name: Test | |
| run: >- | |
| dotnet test --no-build -c Release | |
| --project tests/ExpressiveSharp.MongoDB.IntegrationTests | |
| --results-directory ./test-results | |
| -- | |
| --report-trx --report-trx-filename results.trx | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: container-test-results-MongoDB | |
| path: ./test-results/*.trx | |
| retention-days: 14 | |
| - name: Test report | |
| if: always() | |
| uses: dorny/test-reporter@v1 | |
| with: | |
| name: Container Test Results (MongoDB) | |
| path: ./test-results/*.trx | |
| reporter: dotnet-trx |