-
Notifications
You must be signed in to change notification settings - Fork 46
114 lines (100 loc) · 3.36 KB
/
test-unreleased.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
name: Integration with Unreleased OpenSearch
on:
push:
branches:
- "main"
paths-ignore:
- '*.md'
pull_request:
branches:
- "main"
paths-ignore:
- '*.md'
jobs:
test:
env:
TEST_OPENSEARCH_SERVER: http://localhost:9200
PORT: 9200
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
entry:
- { ruby_version: '3.3', opensearch_ref: '1.x', jdk_version: '11' }
- { ruby_version: '3.3', opensearch_ref: '2.x', jdk_version: '17' }
- { ruby_version: '3.3', opensearch_ref: 'main', jdk_version: '17' }
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.entry.ruby_version }}
- name: Checkout OpenSearch
uses: actions/checkout@v4
with:
repository: opensearch-project/OpenSearch
ref: ${{ matrix.entry.opensearch_ref }}
path: opensearch
- name: Get OpenSearch branch top
id: get-key
working-directory: opensearch
run: echo key=`git log -1 --format='%H'` >> $GITHUB_OUTPUT
- name: Restore cached build
id: cache-restore
uses: actions/cache/restore@v4
with:
path: opensearch/distribution/archives/linux-tar/build/distributions
key: ${{ steps.get-key.outputs.key }}
- name: Setup Java JDK
uses: actions/setup-java@v4
if: steps.cache-restore.outputs.cache-hit != 'true'
with:
distribution: 'temurin'
java-version: ${{ matrix.entry.jdk_version }}
- name: Assemble OpenSearch
if: steps.cache-restore.outputs.cache-hit != 'true'
working-directory: opensearch
run: ./gradlew :distribution:archives:linux-tar:assemble --stacktrace
- name: Save cached build
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: opensearch/distribution/archives/linux-tar/build/distributions
key: ${{ steps.get-key.outputs.key }}
- name: Run OpenSearch
working-directory: opensearch/distribution/archives/linux-tar/build/distributions
run: |
tar xf opensearch-min-*
./opensearch-*/bin/opensearch \
-Enode.attr.testattr=test \
-Epath.repo=/tmp \
-Erepositories.url.allowed_urls='http://snapshot.*' \
-d
for attempt in {1..20}; do
sleep 5
if curl -s localhost:9200; then
echo '=====> ready'
exit 0
fi
echo '=====> waiting...'
done
exit 1
- name: Checkout Ruby Client
uses: actions/checkout@v4
with:
path: ruby-client
- name: Build and test with Rake
run: |
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev
ruby -v
bundle install
working-directory: ruby-client
- name: Perform Integration Tests
working-directory: ruby-client
run: rake test:integration
- name: Save server logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: opensearch-logs-${{ matrix.entry.opensearch_ref }}-ruby-${{ matrix.entry.ruby_version }}
path: |
opensearch/distribution/archives/linux-tar/build/distributions/**/logs/*