From 74652d783b51169908d021a7b706fb77246c2905 Mon Sep 17 00:00:00 2001 From: Moumita <36885121+MoumitaM@users.noreply.github.com> Date: Wed, 4 Sep 2024 15:53:32 +0530 Subject: [PATCH] ci: trigger sanity suite on pre post release (#1843) * ci: trigger sanity suite on pre post release * chore: updated github actions * chore: updated github actions * chore: updated github actions --- .github/workflows/browserstack-sanity.yml | 35 ----------- .github/workflows/deploy-prod.yml | 6 ++ .github/workflows/deploy-staging.yml | 6 ++ .github/workflows/trigger-sanity-suite.yml | 67 ++++++++++++++++++++++ 4 files changed, 79 insertions(+), 35 deletions(-) delete mode 100644 .github/workflows/browserstack-sanity.yml create mode 100644 .github/workflows/trigger-sanity-suite.yml diff --git a/.github/workflows/browserstack-sanity.yml b/.github/workflows/browserstack-sanity.yml deleted file mode 100644 index ab79ac9cf3..0000000000 --- a/.github/workflows/browserstack-sanity.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Run sanity suite on BrowserStack - -on: - workflow_dispatch: - inputs: - environment: - type: choice - description: Select specific environment to run the tests - options: - - staging - - production - sdkVersion: - description: Version of the SDK - required: true - workflow_call: - inputs: - environment: - type: string - required: true - default: production - sdkVersion: - type: string - required: true - -jobs: - trigger: - runs-on: [self-hosted, Linux, X64] - steps: - - name: Trigger sanity suite test workflow on rudder-client-side-test - run: | - curl -X POST \ - -H "Authorization: token ${{ secrets.PAT }}" \ - -H "Accept: application/vnd.github.v3+json" \ - https://api.github.com/repos/rudderlabs/rudder-client-side-test/dispatches \ - -d '{"event_type":"triggered_by_source_repo", "client_payload": {"environment": "${{ github.event.inputs.environment }}", "sdkVersion": "${{ github.event.inputs.sdkVersion }}"}}' diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index 68bf3f45bb..c6fe81c7b6 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -43,3 +43,9 @@ jobs: RS_PROD_BUGSNAG_API_KEY: ${{ secrets.RS_PROD_BUGSNAG_API_KEY }} SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} SLACK_RELEASE_CHANNEL_ID: ${{ secrets.SLACK_RELEASE_CHANNEL_ID_NON_PROD }} + + trigger-sanity-suite: + uses: ./.github/workflows/trigger-sanity-suite.yml + name: Trigger Sanity Suite + with: + environment: production diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index fcec8a3443..86e74a8c06 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -48,3 +48,9 @@ jobs: RS_STAGING_BUGSNAG_API_KEY: ${{ secrets.RS_STAGING_BUGSNAG_API_KEY }} SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} SLACK_RELEASE_CHANNEL_ID: ${{ secrets.SLACK_RELEASE_CHANNEL_ID_NON_PROD }} + + trigger-sanity-suite: + uses: ./.github/workflows/trigger-sanity-suite.yml + name: Trigger Sanity Suite + with: + environment: staging diff --git a/.github/workflows/trigger-sanity-suite.yml b/.github/workflows/trigger-sanity-suite.yml new file mode 100644 index 0000000000..dcdc774068 --- /dev/null +++ b/.github/workflows/trigger-sanity-suite.yml @@ -0,0 +1,67 @@ +name: Run sanity suite on BrowserStack + +on: + workflow_dispatch: + inputs: + environment: + type: choice + description: Select specific environment to run the tests + options: + - staging + - production + monorepoVersion: + description: Version of the Monorepo + required: true + workflow_call: + inputs: + environment: + type: string + default: production + +jobs: + extract-monorepo-version: + name: Extract Monorepo Version + runs-on: ubuntu-latest + + outputs: + version: ${{ steps.determine_version.outputs.current_version }} + + steps: + - name: Determine checkout SHA + id: getSHA + run: | + if [ "${{ inputs.environment }}" = 'staging' ]; then + sha=${{ github.event.pull_request.head.sha }} + else + sha=${{ github.sha }} + fi + echo "Checkout SHA: $sha" + echo "SHA=$sha" >> $GITHUB_OUTPUT + + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ steps.getSHA.outputs.SHA }} + + - name: Determine the Monorepo version + id: determine_version + run: | + if [ -n "${{ inputs.monorepoVersion }}" ]; then + current_version="${{ inputs.monorepoVersion }}" + else + current_version=$(jq -r .version package.json) + fi + echo "current_version=$current_version" >> $GITHUB_OUTPUT + + trigger: + runs-on: [self-hosted, Linux, X64] + needs: extract-monorepo-version + + steps: + - name: Trigger sanity suite test workflow on rudder-client-side-test + run: | + curl -X POST \ + -H "Authorization: token ${{ secrets.PAT }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/rudderlabs/rudder-client-side-test/dispatches \ + -d '{"event_type":"triggered_by_source_repo", "client_payload": {"environment": "${{ github.event.inputs.environment }}", "monorepoVersion": "${{ needs.extract-monorepo-version.outputs.version }}"}}'