Skip to content

remote_cypress_workflow [] #126

remote_cypress_workflow []

remote_cypress_workflow [] #126

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'
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:
repository: ${{ env.SOURCE_REPO }}
ref: '${{ env.SOURCE_BRANCH }}'
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
- name: Setup Yarn
run: |
npm uninstall -g yarn
npm i -g [email protected]
- name: Checkout
uses: actions/checkout@v2
with:
path: ${{ env.OSD_PATH }}
repository: ${{ env.TEST_REPO }}
ref: '${{ env.TEST_BRANCH }}'
- name: Get Cypress version
id: cypress_version
run: |
current_directory=$(pwd)
echo "Current working directory: $current_directory"
echo "name=cypress_version::$(cat ./package.json | jq '.devDependencies.cypress' | tr -d '"')" >> $GITHUB_OUTPUT
- 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 }}
source 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 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 scripts/bwc/utils.sh
open_artifact $current_directory/${{ env.DASHBOARDS_DIR }} ${{ env.DASHBOARDS }}
- name: Run OpenSearch Dashboards
run: |
current_directory=$(pwd)
echo "Current working directory: $current_directory"
source scripts/cypress_tests.sh
run_dashboards
- name: Run tests
uses: cypress-io/github-action@v2
with:
working-directory: ${{ env.OSD_PATH }}
wait-on: 'http://localhost:9200, http://localhost:5601'
wait-on-timeout: 60000
command: yarn cypress:run-without-security --browser chromium --spec 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