chore(e2e): simplify Cypress record key usage (#29327)
This commit is contained in:
parent
fe3ba12801
commit
4fe04e63ac
|
|
@ -63,9 +63,12 @@ github:
|
||||||
# combination here.
|
# combination here.
|
||||||
contexts:
|
contexts:
|
||||||
- lint-check
|
- lint-check
|
||||||
|
- cypress-matrix (0, chrome)
|
||||||
- cypress-matrix (1, chrome)
|
- cypress-matrix (1, chrome)
|
||||||
- cypress-matrix (2, chrome)
|
- cypress-matrix (2, chrome)
|
||||||
- cypress-matrix (3, chrome)
|
- cypress-matrix (3, chrome)
|
||||||
|
- cypress-matrix (4, chrome)
|
||||||
|
- cypress-matrix (5, chrome)
|
||||||
- frontend-build
|
- frontend-build
|
||||||
- pre-commit
|
- pre-commit
|
||||||
- python-lint
|
- python-lint
|
||||||
|
|
|
||||||
|
|
@ -130,12 +130,12 @@ jobs:
|
||||||
CYPRESS_BROWSER: ${{ matrix.browser }}
|
CYPRESS_BROWSER: ${{ matrix.browser }}
|
||||||
PARALLEL_ID: ${{ matrix.parallel_id }}
|
PARALLEL_ID: ${{ matrix.parallel_id }}
|
||||||
PARALLELISM: 6
|
PARALLELISM: 6
|
||||||
CYPRESS_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||||
with:
|
with:
|
||||||
run: cypress-run-all ${{ env.USE_DASHBOARD }}
|
run: cypress-run-all ${{ env.USE_DASHBOARD }}
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
if: github.event_name == 'workflow_dispatch' && (steps.check.outputs.python || steps.check.outputs.frontend)
|
if: github.event_name == 'workflow_dispatch' && (steps.check.outputs.python || steps.check.outputs.frontend)
|
||||||
with:
|
with:
|
||||||
name: screenshots
|
|
||||||
path: ${{ github.workspace }}/superset-frontend/cypress-base/cypress/screenshots
|
path: ${{ github.workspace }}/superset-frontend/cypress-base/cypress/screenshots
|
||||||
|
name: cypress-artifact-${{ github.run_id }}-${{ github.job }}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ from datetime import datetime
|
||||||
XVFB_PRE_CMD = "xvfb-run --auto-servernum --server-args='-screen 0, 1024x768x24' "
|
XVFB_PRE_CMD = "xvfb-run --auto-servernum --server-args='-screen 0, 1024x768x24' "
|
||||||
REPO = os.getenv("GITHUB_REPOSITORY") or "apache/superset"
|
REPO = os.getenv("GITHUB_REPOSITORY") or "apache/superset"
|
||||||
GITHUB_EVENT_NAME = os.getenv("GITHUB_REPOSITORY") or "push"
|
GITHUB_EVENT_NAME = os.getenv("GITHUB_REPOSITORY") or "push"
|
||||||
|
CYPRESS_RECORD_KEY = os.getenv("CYPRESS_RECORD_KEY") or ""
|
||||||
|
|
||||||
|
|
||||||
def compute_hash(file_path: str) -> str:
|
def compute_hash(file_path: str) -> str:
|
||||||
|
|
@ -55,13 +56,7 @@ def get_cypress_cmd(
|
||||||
|
|
||||||
if use_dashboard:
|
if use_dashboard:
|
||||||
# Run using cypress.io service
|
# Run using cypress.io service
|
||||||
cypress_key = os.getenv("CYPRESS_KEY")
|
spec: str = "cypress/e2e/*/**/*"
|
||||||
command = f"echo {cypress_key} | base64 --decode"
|
|
||||||
cypress_record_key = (
|
|
||||||
subprocess.check_output(command, shell=True).decode("utf-8").strip()
|
|
||||||
)
|
|
||||||
os.environ["CYPRESS_RECORD_KEY"] = cypress_record_key
|
|
||||||
spec: str = "*/**/*"
|
|
||||||
cmd = (
|
cmd = (
|
||||||
f"{XVFB_PRE_CMD} "
|
f"{XVFB_PRE_CMD} "
|
||||||
f'{cypress_cmd} --spec "{spec}" --browser {browser} '
|
f'{cypress_cmd} --spec "{spec}" --browser {browser} '
|
||||||
|
|
@ -70,7 +65,7 @@ def get_cypress_cmd(
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# Run local, but split the execution
|
# Run local, but split the execution
|
||||||
os.environ.pop("CYPRESS_KEY", None)
|
os.environ.pop("CYPRESS_RECORD_KEY", None)
|
||||||
spec_list_str = ",".join(sorted(spec_list))
|
spec_list_str = ",".join(sorted(spec_list))
|
||||||
if _filter:
|
if _filter:
|
||||||
spec_list_str = ",".join(sorted([s for s in spec_list if _filter in s]))
|
spec_list_str = ",".join(sorted([s for s in spec_list if _filter in s]))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue