-
Notifications
You must be signed in to change notification settings - Fork 36
163 lines (147 loc) · 6.5 KB
/
remote-integ-tests-workflow.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
# Running search relevance integ tests stored in https://github.com/opensearch-project/opensearch-dashboards-functional-test
# In the future we should pull dependencies from bundled build snapshots. Because that is not available
# yet we build the cluster from source (besides core Opensearch, which is a pulled min artifact).
name: Remote integ tests workflow
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
jobs:
test-without-security:
name: Run integ tests without security
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
java: [11]
include:
- os: windows-latest
cypress_cache_folder: ~/AppData/Local/Cypress/Cache
- os: ubuntu-latest
cypress_cache_folder: ~/.cache/Cypress
runs-on: ${{ matrix.os }}
steps:
- name: Set up Java 11
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '11'
- uses: actions/checkout@v2
- name: Fetch Version Information
id: fetch_version
run: |
if [[ "${{ github.event_name }}" == "push" ]]; then
pr_number=$(curl -sSL -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }}/pulls" \
| jq -r '.[0].number')
url_number=$(curl -sSL -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }}/pulls" \
| jq -r '.[0].url')
pr_data=$(curl -sSL -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"$url_number")
BRANCH_NAME=$(echo "$pr_data" | jq -r '.base.ref')
echo "BRANCH_NAME is $BRANCH_NAME"
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "Base branch name is "${{ github.event.pull_request.base.ref }}""
BRANCH_NAME="${{ github.event.pull_request.base.ref }}"
fi
CURRENT_VERSION=$(node -p "require('./package.json').version")
MAJOR_VERSION=$(echo $CURRENT_VERSION | cut -d. -f1)
MINOR_VERSION=$(echo $CURRENT_VERSION | cut -d. -f2)
PATCH_VERSION=$(echo $CURRENT_VERSION | cut -d. -f3)
OPENSEARCH_VERSION="$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION"
echo "OPENSEARCH_VERSION: $OPENSEARCH_VERSION"
echo "OPENSEARCH_VERSION=$OPENSEARCH_VERSION" >> $GITHUB_ENV
echo "OPENSEARCH_DASHBOARDS_VERSION=$BRANCH_NAME" >> $GITHUB_ENV
echo "OPENSEARCH_DASHBOARDS_FTREPO_VERSION=$BRANCH_NAME" >> $GITHUB_ENV
echo "SEARCH_PROCESSOR_PLUGIN_VERSION=$BRANCH_NAME" >> $GITHUB_ENV
echo "SEARCH_PROCESSOR_VERSION=$MAJOR_VERSION.$MINOR_VERSION.0" >> $GITHUB_ENV
shell: bash
- name: Enable longer filenames
if: ${{ matrix.os == 'windows-latest' }}
run: git config --system core.longpaths true
# It doesn't matter what plugin we use, but by launching OpenSearch
# from a plugin repo, we don't need to checkout and build
# OpenSearch itself.
- name: Checkout search-processor
uses: actions/checkout@v2
with:
path: search-processor
repository: opensearch-project/search-processor
ref: ${{ env.SEARCH_PROCESSOR_PLUGIN_VERSION }}
- name: Run OpenSearch with plugin
run: |
cd search-processor
./gradlew run -Dopensearch.version=${{ env.SEARCH_PROCESSOR_VERSION }} &
t=0
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9200)" != "200" ]]; do
sleep 5
let t=$t+5
if [[ $t -gt 300 ]]; then
exit 1
fi
done
shell: bash
- name: Checkout OpenSearch Dashboards
uses: actions/checkout@v2
with:
repository: opensearch-project/OpenSearch-Dashboards
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }}
path: OpenSearch-Dashboards
- name: Checkout Search Relevance OpenSearch Dashboards plugin
uses: actions/checkout@v2
with:
path: OpenSearch-Dashboards/plugins/dashboards-search-relevance
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: './OpenSearch-Dashboards/.nvmrc'
registry-url: 'https://registry.npmjs.org'
- name: Install Yarn
shell: bash
run: |
YARN_VERSION=$(node -p "require('./OpenSearch-Dashboards/package.json').engines.yarn")
echo "Installing yarn@$YARN_VERSION"
npm i -g yarn@$YARN_VERSION
- name: Bootstrap the plugin
run: |
cd OpenSearch-Dashboards/plugins/dashboards-search-relevance
yarn osd bootstrap
- name: Run OpenSearch Dashboards server
run: |
cd OpenSearch-Dashboards
yarn start --no-base-path --no-watch --server.host="0.0.0.0" --opensearch.requestTimeout=120000 &
shell: bash
# Windows and Mac OS take a while to start, so we need a long sleep
- name: Sleep until OSD server starts
run: sleep 900
shell: bash
- name: Checkout opensearch-dashboards-functional-test
uses: actions/checkout@v2
with:
path: opensearch-dashboards-functional-test
repository: opensearch-project/opensearch-dashboards-functional-test
ref: ${{ env.OPENSEARCH_DASHBOARDS_FTREPO_VERSION }}
- name: Get Cypress version
id: cypress_version
run: |
echo "::set-output name=cypress_version::$(cat ./opensearch-dashboards-functional-test/package.json | jq '.devDependencies.cypress' | tr -d '"')"
- name: Cache Cypress
id: cache-cypress
uses: actions/cache@v1
with:
path: ${{ matrix.cypress_cache_folder }}
key: cypress-cache-v2-${{ runner.os }}-${{ hashFiles('**/package.json') }}
env:
CYPRESS_INSTALL_BINARY: ${{ steps.cypress_version.outputs.cypress_version }}
- run: npx cypress cache list
- run: npx cypress cache path
- name: Run search-relevance cypress tests
uses: cypress-io/github-action@v2
with:
working-directory: opensearch-dashboards-functional-test
command: yarn run cypress run --env SECURITY_ENABLED=false --browser chrome --spec cypress/integration/plugins/search-relevance-dashboards/*.js
env:
CYPRESS_CACHE_FOLDER: ${{ matrix.cypress_cache_folder }}