forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
166 lines (151 loc) · 6.12 KB
/
remote_cypress_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
163
164
165
166
name: remote_cypress_workflow
run-name: remote_cypress_workflow [${{ inputs.UNIQUE_ID}}] # Unique workflow number appended to the workflow run-name to filter the run results based on that.
# trigger on every PR for all branches
on:
push:
branches: [ '**' ]
workflow_dispatch:
inputs:
test_repo:
description: 'Cypress test repo'
default: ''
required: false
type: string
test_branch:
description: 'Cypress test branch (default: source branch)'
required: false
type: string
specs:
description: 'Tests to run (default: osd:ciGroup)'
required: false
type: string
build_id:
description: 'Build Id'
required: false
type: string
OS_URL:
description: 'OpenSearch release artifact'
required: false
type: string
OSD_URL:
description: 'OpenSearch Dashboards release artifact'
required: false
type: string
UNIQUE_ID:
description: 'Unique Id for the workflow execution'
required: true
type: string
env:
TEST_REPO: ${{ inputs.test_repo != '' && inputs.test_repo || github.repository }}
TEST_BRANCH: "${{ inputs.test_branch != '' && inputs.test_branch || github.base_ref }}"
OSD_PATH: 'osd'
START_CMD: 'node ../scripts/opensearch_dashboards --dev --no-base-path --no-watch --savedObjects.maxImportPayloadBytes=10485760 --server.maxPayloadBytes=1759977 --logging.json=false --data.search.aggs.shardDelay.enabled=true'
OPENSEARCH_SNAPSHOT_CMD: 'node ../scripts/opensearch snapshot -E cluster.routing.allocation.disk.threshold_enabled=false'
CYPRESS_BROWSER: 'chromium'
JOB_ID: ${{ inputs.UNIQUE_ID}}
OPENSEARCH: ${{ inputs.OS_URL != '' && inputs.OS_URL || 'https://artifacts.opensearch.org/releases/bundle/opensearch/2.10.0/opensearch-2.10.0-linux-x64.tar.gz' }}
DASHBOARDS: ${{ inputs.OSD_URL != '' && inputs.OSD_URL || 'https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/2.10.0/opensearch-dashboards-2.10.0-linux-x64.tar.gz' }}
OPENSEARCH_DIR: 'cypress/opensearch'
DASHBOARDS_DIR: 'cypress/opensearch-dashboards'
SECURITY_ENABLED: 'false'
RUN_DASHBOARDS_SUCCESS: 'false'
jobs:
cypress-tests:
runs-on: ubuntu-latest
container:
image: docker://opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2
options: --user 1001
env:
# prevents extra Cypress installation progress messages
CI: 1
# avoid warnings like "tput: No value for $TERM and no -T specified"
TERM: xterm
name: Run cypress tests (${{ inputs.UNIQUE_ID}})
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: ./osd
repository: ${{ env.TEST_REPO }}
ref: '${{ env.TEST_BRANCH }}'
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: './osd/.nvmrc'
registry-url: 'https://registry.npmjs.org'
- name: Setup Yarn
run: |
npm uninstall -g yarn
npm i -g [email protected]
yarn config set network-timeout 1000000 -g
- name: Cache Cypress
id: cache-cypress
uses: actions/cache@v1
with:
path: ~/.cache/Cypress
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: Download and extract Opensearch artifacts
run: |
current_directory=$(pwd)
echo "Current working directory: $current_directory"
mkdir -p $current_directory/${{ env.OPENSEARCH_DIR }}
ls -l
source osd/scripts/bwc/utils.sh
open_artifact $current_directory/${{ env.OPENSEARCH_DIR }} ${{ env.OPENSEARCH }}
- name: Run OpenSearch
run: |
current_directory=$(pwd)
echo "Current working directory: $current_directory"
source osd/scripts/cypress_tests.sh
run_opensearch
- name: Download and extract Opensearch Dashboards artifacts
run: |
current_directory=$(pwd)
echo "Current working directory: $current_directory"
mkdir -p $current_directory/${{ env.DASHBOARDS_DIR }}
source osd/scripts/bwc/utils.sh
open_artifact $current_directory/${{ env.DASHBOARDS_DIR }} ${{ env.DASHBOARDS }}
- name: Copy tests
run: |
current_directory=$(pwd)
echo "Current working directory: $current_directory"
SOURCE_PATH="$current_directory/osd/cypress/integration/dasboard_sanity_test.spec.js"
DESTINATION_PATH="$current_directory/${{ env.DASHBOARDS_DIR }}/cypress/integration"
mkdir -p "$DESTINATION_PATH"
cp -r "$SOURCE_PATH" "$DESTINATION_PATH/"
ls -R "$DESTINATION_PATH/"
- name: Run OpenSearch Dashboards
id: run-dashboards
run: |
current_directory=$(pwd)
echo "Current working directory: $current_directory"
source osd/scripts/cypress_tests.sh
run_dashboards
- name: Run tests
run: |
current_directory=$(pwd)
echo "Run Tests Current working directory: $current_directory"
npx cypress run --browser chromium --spec $current_directory/${{ env.DASHBOARDS_DIR }}/cypress/integration/dasboard_sanity_test.spec.js
# Screenshots are only captured on failure, will change this once we do visual regression tests
- uses: actions/upload-artifact@v3
if: failure()
with:
name: osd-cypress-screenshots
path: ${{ env.OSD_PATH }}/cypress/screenshots
retention-days: 1
- uses: actions/upload-artifact@v3
if: always()
with:
name: osd-cypress-videos
path: ${{ env.OSD_PATH }}/cypress/videos
retention-days: 1
- uses: actions/upload-artifact@v3
if: always()
with:
name: osd-cypress-results
path: ${{ env.OSD_PATH }}/cypress/results
retention-days: 1