-
Notifications
You must be signed in to change notification settings - Fork 34
232 lines (203 loc) · 6.68 KB
/
test.yml
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: Tests
on:
push:
branches-ignore:
- "dependabot/**"
pull_request:
schedule:
- cron: "0 8 * * *"
permissions:
id-token: write
contents: read
jobs:
test:
name: Test
if: github.event_name != 'schedule'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13]
test-args:
- "--features aws-auth"
- "--no-default-features --features rustls-tls --package opensearch --test cert"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Rust Client
uses: actions/checkout@v4
with:
path: client
- name: Setup Rust tools
uses: ./client/.github/actions/setup-rust-tools
- name: Install Java
if: matrix.os == 'windows-latest'
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
- name: Run OpenSearch
id: opensearch
uses: ./client/.github/actions/run-released-opensearch
with:
version: 2.16.0
secured: true
- name: Run Tests
working-directory: client
run: cargo make test ${{ matrix.test-args }}
env:
OPENSEARCH_URL: ${{ steps.opensearch.outputs.opensearch_url }}
OPENSEARCH_PASSWORD: ${{ steps.opensearch.outputs.admin_password }}
- name: Upload Coverage Data
uses: codecov/codecov-action@v5
with:
files: ./client/test_results/opensearch.lcov
flags: unit
token: ${{ secrets.CODECOV_TOKEN }}
- name: Save OpenSearch logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: opensearch-${{ matrix.os }}-${{ matrix.test-args }}
path: |
opensearch-*/logs/*
test-yaml:
name: YAML Tests (Released OpenSearch)
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version:
- 2.16.0
- 2.14.0
- 2.12.0
- 2.10.0
- 2.8.0
- 2.6.0
- 2.4.1
- 2.2.1
- 2.0.1
- 1.3.14
- 1.2.4
- 1.1.0
secured: [true, false]
steps:
- name: Checkout Rust Client
uses: actions/checkout@v4
with:
path: client
- name: Setup Rust tools
uses: ./client/.github/actions/setup-rust-tools
- name: Run OpenSearch
id: opensearch
uses: ./client/.github/actions/run-released-opensearch
with:
version: ${{ matrix.version }}
secured: ${{ matrix.secured }}
- name: Run integration tests
working-directory: client
run: cargo make test-yaml
env:
OPENSEARCH_URL: ${{ steps.opensearch.outputs.opensearch_url }}
OPENSEARCH_PASSWORD: ${{ steps.opensearch.outputs.admin_password }}
- uses: codecov/codecov-action@v5
with:
files: ./client/test_results/opensearch.lcov
flags: integration
token: ${{ secrets.CODECOV_TOKEN }}
- name: Save OpenSearch logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: opensearch-logs-${{ matrix.version }}-${{ matrix.secured }}
path: |
opensearch-*/logs/*
test-yaml-unreleased:
name: YAML Tests (Unreleased OpenSearch)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { opensearch_ref: "1.x", java_version: "11" }
- { opensearch_ref: "2.x", java_version: "17" }
- { opensearch_ref: "main", java_version: "21" }
steps:
- name: GitHub App token
id: github_app_token
uses: actions/create-github-app-token@v1
if: github.event_name == 'schedule' && github.repository == 'opensearch-project/opensearch-rs'
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout Rust Client
uses: actions/checkout@v4
with:
path: client
- name: Setup Rust tools
uses: ./client/.github/actions/setup-rust-tools
- name: Checkout OpenSearch
uses: actions/checkout@v4
with:
repository: opensearch-project/opensearch
ref: ${{ matrix.opensearch_ref }}
path: opensearch
- name: Get OpenSearch Commit SHA
id: opensearch-git
working-directory: opensearch
shell: bash -eo pipefail {0}
run: echo sha=`git log -1 --format='%H'` >> $GITHUB_OUTPUT
- name: Restore cached OpenSearch
id: cache-restore
uses: actions/cache/restore@v4
with:
path: opensearch-*
key: opensearch-${{ steps.opensearch-git.outputs.sha }}
- name: Install Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ matrix.java_version }}
- name: Build OpenSearch
if: steps.cache-restore.outputs.cache-hit != 'true'
shell: bash -eo pipefail {0}
run: |
pushd ./opensearch
./gradlew :distribution:archives:linux-tar:assemble
popd
tar -xzf ./opensearch/distribution/archives/linux-tar/build/distributions/opensearch-*.tar.gz
- name: Save cached OpenSearch
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: opensearch-*
key: opensearch-${{ steps.opensearch-git.outputs.sha }}
- name: Start OpenSearch
id: opensearch
uses: ./client/.github/actions/start-opensearch
- name: Run integration tests
working-directory: client
run: cargo make test-yaml
env:
OPENSEARCH_URL: ${{ steps.opensearch.outputs.url }}
OPENSEARCH_PASSWORD: ${{ steps.opensearch.outputs.admin_password }}
- uses: codecov/codecov-action@v5
if: github.event_name != 'schedule'
with:
files: ./client/test_results/opensearch.lcov
flags: integration
token: ${{ secrets.CODECOV_TOKEN }}
- name: Save OpenSearch logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: opensearch-logs-${{ matrix.opensearch_ref }}
path: |
opensearch-*/logs/*
- name: Create issue about failure
if: failure() && github.event_name == 'schedule' && github.repository == 'opensearch-project/opensearch-rs'
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ steps.github_app_token.outputs.token }}
with:
filename: ./client/.github/test-failure-issue-template.md
update_existing: true