Release v1.0.1 #794
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: Main | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "**" | |
| paths-ignore: | |
| - "docs/**" | |
| - "README.rst" | |
| - "LICENSE.md" | |
| - "publishing.md" | |
| pull_request: | |
| env: | |
| DOTNET_VERSION: "9.x" | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| OKTA_CLIENT_SECRET: ${{ secrets.OKTA_CLIENT_SECRET }} | |
| OKTA_DUMMY_CI_PW: ${{ secrets.OKTA_DUMMY_CI_PW }} | |
| jobs: | |
| setup: | |
| name: Setup | |
| runs-on: ubuntu-latest | |
| outputs: | |
| dry-run: ${{ steps.check-dry-run.outputs.enabled }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 2 | |
| - name: Check for dry-run mode | |
| id: check-dry-run | |
| run: | | |
| # For PRs, check the actual HEAD commit (not the merge commit) | |
| # For push events, check the latest commit | |
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| # Get the actual branch HEAD commit message (not the merge commit) | |
| COMMIT_MSG=$(git log -1 --pretty=%B HEAD^2 2>/dev/null || git log -1 --pretty=%B) | |
| PR_TITLE="${{ github.event.pull_request.title }}" | |
| else | |
| COMMIT_MSG=$(git log -1 --pretty=%B) | |
| PR_TITLE="" | |
| fi | |
| echo "Event: ${{ github.event_name }}" | |
| echo "Commit message: $COMMIT_MSG" | |
| echo "PR title: $PR_TITLE" | |
| # Check if [dry-run] appears in commit message or PR title | |
| if [[ "$COMMIT_MSG" == *"[dry-run]"* ]] || [[ "$PR_TITLE" == *"[dry-run]"* ]]; then | |
| echo "enabled=true" >> $GITHUB_OUTPUT | |
| echo "π DRY-RUN MODE ENABLED" | |
| else | |
| echo "enabled=false" >> $GITHUB_OUTPUT | |
| fi | |
| preflight: | |
| name: Preflight Checks | |
| needs: [setup] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Get list of changed C# files | |
| id: changed-files | |
| uses: tj-actions/changed-files@v46 | |
| with: | |
| files: | | |
| **.cs | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.*proj') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Check formatting | |
| if: steps.changed-files.outputs.any_changed == 'true' | |
| run: | | |
| dotnet tool restore | |
| dotnet csharpier check ${{ steps.changed-files.outputs.all_changed_files }} | |
| - name: Run analyzer unit tests | |
| run: | | |
| if [[ "${{ needs.setup.outputs.dry-run }}" == "true" ]]; then | |
| echo "π DRY-RUN MODE: Skipping actual test execution" | |
| echo "Would run: dotnet test --no-restore --filter \"FullyQualifiedName~Weaviate.Client.Analyzers.Tests\" --logger \"trx;LogFileName=test-analyzer-results.trx\" --collect:\"XPlat Code Coverage\" --results-directory ./test-results" | |
| # Create dummy test results and coverage files | |
| mkdir -p ./test-results | |
| mkdir -p ./test-results/coverage | |
| echo '<?xml version="1.0" encoding="utf-8"?><coverage line-rate="0.85" branch-rate="0.75"><packages><package name="Weaviate.Client" line-rate="0.85" branch-rate="0.75"><classes></classes></package></packages></coverage>' > ./test-results/coverage/coverage.cobertura.xml | |
| echo '<?xml version="1.0" encoding="utf-8"?><TestRun><ResultSummary outcome="Completed"><Counters total="42" executed="42" passed="42" failed="0" error="0" timeout="0" aborted="0" inconclusive="0" passedButRunAborted="0" notRunnable="0" notExecuted="0" disconnected="0" warning="0" completed="0" inProgress="0" pending="0" /></ResultSummary></TestRun>' > ./test-results/test-unit-results.trx | |
| else | |
| dotnet test --no-restore \ | |
| --filter "FullyQualifiedName~Weaviate.Client.Analyzers.Tests" \ | |
| --logger "trx;LogFileName=test-analyzer-results.trx" \ | |
| --collect:"XPlat Code Coverage" \ | |
| --results-directory ./test-results \ | |
| --settings coverlet.runsettings | |
| fi | |
| - name: Run unit tests with coverage (or dry-run) | |
| run: | | |
| if [[ "${{ needs.setup.outputs.dry-run }}" == "true" ]]; then | |
| echo "π DRY-RUN MODE: Skipping actual test execution" | |
| echo "Would run: dotnet test --no-restore --filter \"FullyQualifiedName~Weaviate.Client.Tests.Unit\" --logger \"trx;LogFileName=test-unit-results.trx\" --collect:\"XPlat Code Coverage\" --results-directory ./test-results" | |
| # Create dummy test results and coverage files | |
| mkdir -p ./test-results | |
| mkdir -p ./test-results/coverage | |
| echo '<?xml version="1.0" encoding="utf-8"?><coverage line-rate="0.85" branch-rate="0.75"><packages><package name="Weaviate.Client" line-rate="0.85" branch-rate="0.75"><classes></classes></package></packages></coverage>' > ./test-results/coverage/coverage.cobertura.xml | |
| echo '<?xml version="1.0" encoding="utf-8"?><TestRun><ResultSummary outcome="Completed"><Counters total="42" executed="42" passed="42" failed="0" error="0" timeout="0" aborted="0" inconclusive="0" passedButRunAborted="0" notRunnable="0" notExecuted="0" disconnected="0" warning="0" completed="0" inProgress="0" pending="0" /></ResultSummary></TestRun>' > ./test-results/test-unit-results.trx | |
| else | |
| dotnet test --no-restore \ | |
| --filter "FullyQualifiedName~Weaviate.Client.Tests.Unit" \ | |
| --logger "trx;LogFileName=test-unit-results.trx" \ | |
| --collect:"XPlat Code Coverage" \ | |
| --results-directory ./test-results \ | |
| --settings coverlet.runsettings | |
| fi | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: test-results-unit | |
| path: ./test-results/*.trx | |
| retention-days: 7 | |
| - name: Upload coverage data | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: coverage-unit | |
| path: ./test-results/**/coverage.cobertura.xml | |
| retention-days: 7 | |
| # ============================================================================= | |
| # Integration Tests - All Weaviate Versions | |
| # Runs concurrently with preflight checks for faster feedback | |
| # To add a new version: Add it to the matrix.version array below | |
| # ============================================================================= | |
| test-weaviate-versions: | |
| name: Test on Weaviate v${{ matrix.version }} | |
| permissions: | |
| contents: read | |
| checks: write | |
| needs: [setup, preflight] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ["1.31.20", "1.32.17", "1.33.5", "1.34.0", "1.35.2"] | |
| uses: ./.github/workflows/test-on-weaviate-version.yml | |
| secrets: inherit | |
| with: | |
| weaviate-version: ${{ matrix.version }} | |
| dry-run: ${{ needs.setup.outputs.dry-run == 'true' }} | |
| run-slow-tests: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && !github.event.pull_request.draft && !contains(github.event.pull_request.body, '[skip-slow]')) }} | |
| test-summary: | |
| name: Test Summary | |
| needs: | |
| - setup | |
| - preflight | |
| - test-weaviate-versions | |
| runs-on: ubuntu-latest | |
| if: always() | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Download all coverage artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: coverage-* | |
| path: ./all-coverage | |
| merge-multiple: true | |
| - name: Install ReportGenerator | |
| run: dotnet tool install -g dotnet-reportgenerator-globaltool | |
| - name: Generate coverage report | |
| run: | | |
| reportgenerator \ | |
| -reports:"./all-coverage/**/coverage.cobertura.xml" \ | |
| -targetdir:"./coveragereport" \ | |
| -reporttypes:"Html;HtmlInline_AzurePipelines;MarkdownSummaryGithub;Cobertura" \ | |
| -title:"Weaviate C# Client Coverage" | |
| - name: Upload HTML coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report-html | |
| path: ./coveragereport | |
| retention-days: 7 | |
| - name: Add coverage to PR comment | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| if: github.event_name == 'pull_request' | |
| with: | |
| header: coverage | |
| path: ./coveragereport/SummaryGithub.md | |
| - name: Download all test results | |
| uses: actions/download-artifact@v4 | |
| continue-on-error: true | |
| with: | |
| pattern: test-results-* | |
| path: ./all-test-results | |
| - name: Generate test summary | |
| run: | | |
| if [[ "${{ needs.setup.outputs.dry-run }}" == "true" ]]; then | |
| echo "π DRY-RUN MODE: Skipping test summary generation" | |
| elif [ -d "./all-test-results" ] && [ -n "$(find ./all-test-results -name "*.trx" 2>/dev/null)" ]; then | |
| echo "π Generating test summary from TRX files..." | |
| dotnet tool update -g dotnet-trx | |
| find ./all-test-results -name "*.trx" -exec trx {} \; | |
| else | |
| echo "β No test failures - all tests passed!" | |
| fi | |
| - name: Check test status | |
| run: | | |
| if [ "${{ needs.preflight.result }}" != "success" ]; then | |
| echo "β Preflight checks failed (formatting or unit tests)" | |
| exit 1 | |
| fi | |
| if [ "${{ needs.test-weaviate-versions.result }}" != "success" ]; then | |
| echo "β Integration tests failed on one or more Weaviate versions" | |
| exit 1 | |
| fi | |
| echo "β All tests passed successfully" | |
| build-and-publish: | |
| name: Build and Publish to NuGet | |
| needs: [test-summary] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Check for required secrets | |
| run: | | |
| if [ -z "${{ secrets.NUGET_APIKEY }}" ]; then echo "Warning: NUGET_APIKEY is not set"; fi | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/.*proj') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Create NuGet package | |
| run: dotnet pack -c Release -o out src/Weaviate.Client/ | |
| - name: Push package to NuGet | |
| run: dotnet nuget push './out/*.nupkg' --skip-duplicate --api-key ${{ secrets.NUGET_APIKEY }} --source https://api.nuget.org/v3/index.json | |
| - name: GH Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| generate_release_notes: true | |
| draft: true | |
| files: ./out/*.nupkg | |
| token: ${{ secrets.GITHUB_TOKEN }} |