remote_cypress_workflow [] #139
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
cd osd | |
current_directory_now=$(pwd) | |
echo "Run Tests Current working directory now: $current_directory_now" | |
npx cypress run --browser chromium --spec $current_directory/osd/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 |