From 4382484d293d27a38a8215f2bd08db2b605be9e0 Mon Sep 17 00:00:00 2001 From: Shrikant Sharat Kandula Date: Thu, 4 Jul 2024 23:47:13 +0530 Subject: [PATCH] ci: Accept spec input for Cypress run (#34734) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR doesn't have any real affect. It makes the `spec` parameter to the Cypress action, open to being set. In a following PR, we'll make this configurable via an extended `/test` command syntax, from `pr-automation.yml`, coming up. The `spec` parameter to the Cypress action will be the empty string here, since we aren't setting it to anything anywhere. The action is coded to handle empty string here. As evident in this function: https://github.com/cypress-io/github-action/blob/1967c2d49b206850903322893068f989c23db474/index.js#L340. This is what `ci-test-limited.yml` uses, but is not very convenient since we have to make another commit to revert the changes in the file after we're done. Instead, we want to extend the `/test` command's syntax to be able to inline the spec list in the PR description itself. 🤞 **/test rating** > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 701bd3b70a25f3554aac143fdbd4cf1b44d258b9 > Cypress dashboard. > Tags: `@tag.Rating` ## Summary by CodeRabbit - **Chores** - Updated CI workflow to allow specifying spec files for Cypress tests. --- .github/workflows/ci-test-custom-script.yml | 6 ++++++ .github/workflows/pr-cypress.yml | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/ci-test-custom-script.yml b/.github/workflows/ci-test-custom-script.yml index 047a1786d7..e03946326c 100644 --- a/.github/workflows/ci-test-custom-script.yml +++ b/.github/workflows/ci-test-custom-script.yml @@ -14,6 +14,11 @@ on: required: false type: string default: "" + spec: + description: "Spec files to run, one per line" + required: false + type: string + default: "" matrix: description: "Matrix jobs" required: false @@ -350,6 +355,7 @@ jobs: browser: ${{ env.BROWSER_PATH }} install: false config-file: cypress_ci_custom.config.ts + spec: ${{ inputs.spec }} working-directory: app/client env: "NODE_ENV=development" diff --git a/.github/workflows/pr-cypress.yml b/.github/workflows/pr-cypress.yml index edfe7314e7..4cf19d9f3e 100644 --- a/.github/workflows/pr-cypress.yml +++ b/.github/workflows/pr-cypress.yml @@ -6,6 +6,9 @@ on: tags: required: true type: string + spec: + required: false + type: string matrix: required: true type: string @@ -71,6 +74,7 @@ jobs: with: pr: ${{ github.event.number }} tags: ${{ inputs.tags }} + spec: ${{ inputs.spec }} matrix: ${{ inputs.matrix }} ci-test-result: