Skip to content
name: Cypress 12 experimental tests
on:
push:
branches: ['**']
pull_request:
branches: ['**']
paths-ignore:
- '**/*.md'
- 'docs/**'
- '.lycheeignore'
- 'CODEOWNERS'
- 'changelogs/fragments/**'
env:
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'
COMMENT_TAG: '[MANUAL CYPRESS TEST RUN RESULTS]'
COMMENT_SUCCESS_MSG: ':white_check_mark: Cypress test run succeeded!'
COMMENT_FAILURE_MSG: ':x: Cypress test run failed!'
LATEST_VERSION: '3.0.0'
COVERAGE: true
PROJECT_ARTIFACT_NAME: 'project-artifact'
COMBINATIONS: |
[
[],
["SECURITY"],
["WORKSPACE", "DATA_SOURCE", "QUERY_ENHANCEMENTS", "USE_NEW_HOME_PAGE"]
]
jobs:
build-and-validate:
name: Build and validate
runs-on: ubuntu-latest
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 [email protected]
yarn config set network-timeout 1000000 -g
- name: Run bootstrap
run: yarn osd bootstrap
- name: Check for yarn.lock changes
run: |
if [[ `git status --porcelain yarn.lock` ]]; then
echo -e "\033[31mThe yarn.lock file is out of sync!\033[0m"
git diff
exit 1
fi
- name: Generate dev docs
run: yarn docs:generateDevDocs
- name: Check for dev docs changes
run: |
if [[ `git status --porcelain docs/_sidebar.md` ]]; then
echo -e "\033[31mThe dev docs are out of sync; run yarn docs:generateDevDocs and amend the PR.\033[0m"
git diff
exit 1
fi
- name: Run linter
id: linter
run: yarn lint
- name: Validate NOTICE file
id: notice-validate
run: yarn notice:validate
- name: Validate licenses
id: i18n-licenses
run: yarn checkLicenses
- name: Check i18n
id: i18n-check
run: yarn i18n:check
- name: Build plugins
run: node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers 10
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PROJECT_ARTIFACT_NAME }}
path: .
retention-days: 1
include-hidden-files: true
trigger-cypress-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Trigger tests for combinations
run: |
# Function to trigger workflow for a spec suite
trigger_workflow() {
local spec_path="$1"
local spec_name="$2"
local counter=1
echo "$COMBINATIONS" | jq -c '.[]' | while read -r combo; do
# Prepare inputs for gh command
inputs="-f spec_pattern=$spec_path -f run_flag=${spec_name}:${counter} -f artifact_name=${{ env.PROJECT_ARTIFACT_NAME }}"
# Add variables to inputs
echo $combo | jq -r '.[]' | while read -r var; do
inputs="$inputs -f $var=true"
done
echo "Inputs for workflow dispatch: $inputs"
# Trigger the secondary workflow
gh workflow run callable/run_cypress_tests.yml $inputs
# Increment counter
counter=$((counter + 1))
done
}
# Process spec files at the root
trigger_workflow "cypress/integration/*.spec.js" "root"
# Process spec folders
for folder in ./cypress/integration/*/; do
folder_name=$(basename "$folder")
trigger_workflow "cypress/integration/$folder_name/**/*.spec.js" "$folder_name"
done