-
Notifications
You must be signed in to change notification settings - Fork 4
185 lines (156 loc) · 5.63 KB
/
main.yaml
File metadata and controls
185 lines (156 loc) · 5.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
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