Skip to content

Add centralized exception handling and new exception types #479

Add centralized exception handling and new exception types

Add centralized exception handling and new exception types #479

Workflow file for this run

name: Main
on:
push:
branches:
- main
tags:
- "**"
paths-ignore:
- "docs/**"
- "README.rst"
- "LICENSE.md"
- "publishing.md"
pull_request:
env:
DOTNET_VERSION: "8.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:
check_formatting:
name: Check Formatting
runs-on: ubuntu-latest
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: Check formatting
if: steps.changed-files.outputs.any_changed == 'true'
run: |
dotnet tool restore
dotnet csharpier check ${{ steps.changed-files.outputs.all_changed_files }}
integration-tests:
name: Run Integration Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
server:
- 1.31.16
- 1.32.11
- 1.33.0
- 1.34.0-rc.0
steps:
- name: Check for required secrets
run: |
if [ -z "${{ secrets.DOCKER_USERNAME }}" ]; then echo "Warning: DOCKER_USERNAME is not set"; fi
if [ -z "${{ secrets.DOCKER_PASSWORD }}" ]; then echo "Warning: DOCKER_PASSWORD is not set"; fi
if [ -z "${{ secrets.NUGET_APIKEY }}" ]; then echo "Warning: NUGET_APIKEY is not set"; fi
- name: Checkout code
uses: actions/checkout@v5
- 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: Run unit tests
run: dotnet test --no-restore --filter "FullyQualifiedName~Weaviate.Client.Tests.Unit" --logger "trx;LogFileName=test-unit-results.trx"
- name: Upload unit test results on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results-unit-${{ matrix.server }}
path: src/Weaviate.Client.Tests/TestResults/test-unit-results.trx
retention-days: 3
- name: Login to Docker Hub
uses: docker/login-action@v3
if: ${{ !github.event.pull_request.head.repo.fork && github.triggering_actor != 'dependabot[bot]' }}
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- name: start weaviate
run: /bin/bash ci/start_weaviate.sh ${{ matrix.server }}
- name: Run quick integration tests
run: |
dotnet test --no-restore --filter "(Category!=Slow&FullyQualifiedName~Weaviate.Client.Tests.Integration)" --logger "trx;LogFileName=test-integration-quick-results.trx"
- name: Upload integration test results on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results-integration-quick-${{ matrix.server }}
path: src/Weaviate.Client.Tests/TestResults/test-integration-quick-results.trx
retention-days: 3
- name: Run slow integration tests
run: |
dotnet test --no-restore --filter "(Category=Slow&FullyQualifiedName~Weaviate.Client.Tests.Integration)" --logger "trx;LogFileName=test-integration-slow-results.trx"
- name: Upload integration test results on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results-integration-slow-${{ matrix.server }}
path: src/Weaviate.Client.Tests/TestResults/test-integration-slow-results.trx
retention-days: 3
- name: stop weaviate
if: always()
run: /bin/bash ci/stop_weaviate.sh ${{ matrix.server }}
- name: Test Report
continue-on-error: true
if: always()
run: |
dotnet tool update -g dotnet-trx
trx
build-and-publish:
name: Build and Publish to NuGet
needs: [integration-tests]
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