forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (118 loc) · 4.75 KB
/
cypress_workflow_with_s3.yml
File metadata and controls
134 lines (118 loc) · 4.75 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
name: Run cypress tests with S3
# trigger once PR has been merged
on:
push:
branches: ['main', '[0-9]+\.x', '[0-9]+\.[0-9]+']
paths-ignore:
- '**/*.md'
- 'docs/**'
- '.lycheeignore'
- 'CODEOWNERS'
- 'changelogs/fragments/**'
workflow_dispatch:
inputs:
test_branch:
description: 'Cypress test branch (default: source branch)'
required: false
type: string
specs:
description: 'Tests to run'
required: false
type: string
pr_number:
description: 'PR Number (optional)'
required: false
type: number
env:
TEST_BRANCH: "${{ inputs.test_branch != '' && inputs.test_branch || github.base_ref }}"
FTR_PATH: 'ftr'
CYPRESS_BROWSER: 'chromium'
CYPRESS_VISBUILDER_ENABLED: true
CYPRESS_DATASOURCE_MANAGEMENT_ENABLED: false
OSD_SNAPSHOT_SKIP_VERIFY_CHECKSUM: true
NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first'
LATEST_VERSION: '2.17.0'
jobs:
cypress-tests:
runs-on: ubuntu-latest
container:
image: docker://opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2
options: --user 1001
env:
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 --csp.warnLegacyBrowsers=false --uiSettings.overrides["query:enhancements:enabled"]=true --uiSettings.overrides[''home:useNewHomePage'']=true --data_source.enabled=true --workspace.enabled=true --opensearch.ignoreVersionMismatch=true'
OPENSEARCH_SNAPSHOT_CMD: '/bin/bash -c "./opensearch-2.17.0/opensearch-tar-install.sh &"'
name: Run cypress tests with S3
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
- name: Setup Yarn
run: |
npm uninstall -g yarn
npm i -g yarn@^1.22.10
- name: Run bootstrap
run: yarn osd bootstrap
- name: Build plugins
run: node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers 12
- name: Setup spec files
if: ${{ inputs.specs == '' }}
shell: bash
run: |
DASHBOARDS_SPEC="$(yarn --silent osd:ciGroupS3)"
echo "DASHBOARDS_SPEC=${DASHBOARDS_SPEC}" >> $GITHUB_ENV
echo "DASHBOARDS_SPEC=${DASHBOARDS_SPEC}"
- name: Download OpenSearch
uses: suisei-cn/actions-download-file@v1.4.0
with:
url: https://artifacts.opensearch.org/releases/bundle/opensearch/${{ env.LATEST_VERSION }}/opensearch-${{ env.LATEST_VERSION }}-linux-x64.tar.gz
- name: Extract OpenSearch
run: |
tar -xzf opensearch-*.tar.gz
rm -f opensearch-*.tar.gz
shell: bash
- name: Remove security plugin
run: |
/bin/bash -c "yes | ./opensearch-${{ env.LATEST_VERSION }}/bin/opensearch-plugin remove opensearch-security"
shell: bash
- name: Run OpenSearch
run: |
/bin/bash -c "./opensearch-${{ env.LATEST_VERSION }}/opensearch-tar-install.sh &"
sleep 30
shell: bash
- name: Clear Cypress Cache
run: npx cypress cache clear
- name: Run Dashboards Cypress tests with query enhancements
uses: cypress-io/github-action@v6
env:
S3_CONNECTION_URL: ${{ secrets.S3_CONNECTION_URL }}
S3_CONNECTION_USERNAME: ${{ secrets.S3_CONNECTION_USERNAME }}
S3_CONNECTION_PASSWORD: ${{ secrets.S3_CONNECTION_PASSWORD }}
with:
install-command: npx cypress install --force
start: ${{ env.START_CMD }}
wait-on: 'http://localhost:9200, http://localhost:5601'
command: yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.DASHBOARDS_SPEC }}
# Compress and upload artifacts for Dashboards repo
- name: Compress Dashboards repo artifacts
if: always()
run: |
mkdir -p dashboard-artifacts-s3
for dir in screenshots videos results; do
if [ -d "cypress/$dir" ]; then
cp -r "cypress/$dir" dashboard-artifacts-s3/
fi
done
tar -czf dashboards-cypress-artifacts-s3.tar.gz -C dashboard-artifacts-s3 .
shell: bash
- name: Upload Dashboards repo artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: dashboards-cypress-artifacts-s3
path: dashboards-cypress-artifacts-s3.tar.gz
retention-days: 1
overwrite: true