Skip to content

Commit

Permalink
Merge branch 'develop' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
utsabc authored Jan 6, 2025
2 parents e45d58f + 57e977d commit 97c90e9
Show file tree
Hide file tree
Showing 434 changed files with 17,328 additions and 17,744 deletions.
7 changes: 7 additions & 0 deletions .coderabbit/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# .coderabbit/config.yml
reviews:
instructions:
- pattern: '**/*'
instruction: |
# Ignore code coverage issues
Do not mention code coverage warnings or code coverage reports in the review.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ tsconfig.build.tsbuildinfo
nativeSdkLoader.js
nativeSdkLoader.ts
assets/
package.json
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"unicorn/prefer-array-flat-map": "error",
"unicorn/no-useless-spread": "error",
"unicorn/no-useless-length-check": "error",
"unicorn/prefer-export-from": "error",
"unicorn/prefer-export-from": ["error", { "ignoreUsedVariables": true }],
"sonarjs/prefer-immediate-return": "off",
"sonarjs/no-nested-template-literals": "off",
"sonarjs/max-switch-cases": "off",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ permissions:
contents: read # This is required for actions/checkout

env:
NODE_OPTIONS: "--no-warnings"
NODE_OPTIONS: '--no-warnings'

jobs:
get-deploy-inputs:
Expand Down
29 changes: 28 additions & 1 deletion .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
deploy:
name: Deploy to development environment
name: Deploy to Development Environment
if: github.event.pull_request.merged == true
uses: ./.github/workflows/deploy.yml
with:
Expand All @@ -26,3 +26,30 @@ jobs:
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 }}

deploy-sanity-suite:
name: Deploy sanity suite
needs: deploy
uses: ./.github/workflows/deploy-sanity-suite.yml
with:
environment: 'development'
secrets:
AWS_ACCOUNT_ID: ${{ secrets.AWS_DEV_ACCOUNT_ID }}
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_DEV_S3_BUCKET_NAME }}
AWS_S3_SYNC_ROLE: ${{ secrets.AWS_DEV_S3_SYNC_ROLE }}
AWS_CF_DISTRIBUTION_ID: ${{ secrets.AWS_DEV_CF_DISTRIBUTION_ID }}
SANITY_SUITE_WRITE_KEY: ${{ secrets.SANITY_SUITE_DEV_WRITE_KEY }}
SANITY_SUITE_DATAPLANE_URL: ${{ secrets.SANITY_SUITE_DEV_DATAPLANE_URL }}
SANITY_SUITE_CONFIG_SERVER_HOST: ${{ secrets.SANITY_SUITE_DEV_CONFIG_SERVER_HOST }}
BUGSNAG_API_KEY: ${{ secrets.RS_DEV_BUGSNAG_API_KEY }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_RELEASE_CHANNEL_ID: ${{ secrets.SLACK_RELEASE_CHANNEL_ID_NON_PROD }}

trigger-test-suites:
uses: ./.github/workflows/trigger-test-suites.yml
name: Trigger test suites
needs: deploy-sanity-suite
with:
environment: development
secrets:
PAT: ${{ secrets.PAT }}
6 changes: 3 additions & 3 deletions .github/workflows/deploy-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ on:
required: true

permissions:
id-token: write # allows the JWT to be requested from GitHub's OIDC provider
contents: read # This is required for actions/checkout
id-token: write # Allows the JWT to be requested from GitHub's OIDC provider
contents: read # Required for actions/checkout

env:
NODE_OPTIONS: '--no-warnings'

jobs:
deploy:
name: Deploy to NPM
# As we publish the NPM package with provenance, we need to only use the GitHub hosted runners
# As we publish the NPM package with provenance, we must use GitHub-hosted runners
runs-on: ubuntu-latest
if: ${{ inputs.is_called == 'true' || (github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/v')) }}

Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,26 @@ jobs:
SLACK_RELEASE_CHANNEL_ID: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }}

deploy-sanity-suite:
name: Deploy Sanity Suite
name: Deploy sanity suite
needs: deploy
uses: ./.github/workflows/deploy-sanity-suite.yml
with:
environment: 'production'
secrets:
AWS_PROD_ACCOUNT_ID: ${{ secrets.AWS_PROD_ACCOUNT_ID }}
AWS_PROD_S3_BUCKET_NAME: ${{ secrets.AWS_PROD_S3_BUCKET_NAME }}
AWS_PROD_S3_SYNC_ROLE: ${{ secrets.AWS_PROD_S3_SYNC_ROLE }}
AWS_PROD_CF_DISTRIBUTION_ID: ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }}
SANITY_SUITE_PROD_WRITE_KEY: ${{ secrets.SANITY_SUITE_PROD_WRITE_KEY }}
SANITY_SUITE_PROD_DATAPLANE_URL: ${{ secrets.SANITY_SUITE_PROD_DATAPLANE_URL }}
SANITY_SUITE_PROD_CONFIG_SERVER_HOST: ${{ secrets.SANITY_SUITE_PROD_CONFIG_SERVER_HOST }}
RS_PROD_BUGSNAG_API_KEY: ${{ secrets.RS_PROD_BUGSNAG_API_KEY }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_PROD_ACCOUNT_ID }}
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_PROD_S3_BUCKET_NAME }}
AWS_S3_SYNC_ROLE: ${{ secrets.AWS_PROD_S3_SYNC_ROLE }}
AWS_CF_DISTRIBUTION_ID: ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }}
SANITY_SUITE_WRITE_KEY: ${{ secrets.SANITY_SUITE_PROD_WRITE_KEY }}
SANITY_SUITE_DATAPLANE_URL: ${{ secrets.SANITY_SUITE_PROD_DATAPLANE_URL }}
SANITY_SUITE_CONFIG_SERVER_HOST: ${{ secrets.SANITY_SUITE_PROD_CONFIG_SERVER_HOST }}
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
trigger-test-suites:
uses: ./.github/workflows/trigger-test-suites.yml
name: Trigger test suites
needs: deploy-sanity-suite
with:
environment: production
Expand Down
94 changes: 30 additions & 64 deletions .github/workflows/deploy-sanity-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,22 @@ on:
type: string
required: true
secrets:
AWS_STAGING_ACCOUNT_ID:
required: false
AWS_PROD_ACCOUNT_ID:
required: false
AWS_STAGING_S3_BUCKET_NAME:
required: false
AWS_PROD_S3_BUCKET_NAME:
required: false
AWS_STAGING_S3_SYNC_ROLE:
required: false
AWS_PROD_S3_SYNC_ROLE:
required: false
AWS_STAGING_CF_DISTRIBUTION_ID:
required: false
AWS_PROD_CF_DISTRIBUTION_ID:
required: false
SANITY_SUITE_STAGING_WRITE_KEY:
required: false
SANITY_SUITE_PROD_WRITE_KEY:
required: false
SANITY_SUITE_STAGING_DATAPLANE_URL:
required: false
SANITY_SUITE_PROD_DATAPLANE_URL:
required: false
SANITY_SUITE_STAGING_CONFIG_SERVER_HOST:
required: false
SANITY_SUITE_PROD_CONFIG_SERVER_HOST:
required: false
RS_STAGING_BUGSNAG_API_KEY:
required: false
RS_PROD_BUGSNAG_API_KEY:
required: false
AWS_ACCOUNT_ID:
required: true
AWS_S3_BUCKET_NAME:
required: true
AWS_S3_SYNC_ROLE:
required: true
AWS_CF_DISTRIBUTION_ID:
required: true
SANITY_SUITE_WRITE_KEY:
required: true
SANITY_SUITE_DATAPLANE_URL:
required: true
SANITY_SUITE_CONFIG_SERVER_HOST:
required: true
BUGSNAG_API_KEY:
required: true
SLACK_BOT_TOKEN:
required: true
SLACK_RELEASE_CHANNEL_ID:
Expand All @@ -50,7 +34,7 @@ permissions:

env:
NODE_OPTIONS: '--no-warnings'
CACHE_CONTROL: "\"max-age=3600\""
CACHE_CONTROL: '"max-age=3600"'

jobs:
deploy:
Expand All @@ -69,44 +53,26 @@ jobs:
current_version=$(jq -r .version packages/sanity-suite/package.json)
echo "CURRENT_VERSION_VALUE=$current_version" >> $GITHUB_ENV
echo "DATE=$(date)" >> $GITHUB_ENV
echo "BUGSNAG_RELEASE_STAGE=${{ inputs.environment }}" >> $GITHUB_ENV
if [ "${{ inputs.environment }}" == "staging" ]; then
echo "AWS_ACCOUNT_ID=${{ secrets.AWS_STAGING_ACCOUNT_ID }}" >> $GITHUB_ENV
echo "AWS_S3_SYNC_ROLE=${{ secrets.AWS_STAGING_S3_SYNC_ROLE }}" >> $GITHUB_ENV
echo "AWS_S3_BUCKET_NAME=${{ secrets.AWS_STAGING_S3_BUCKET_NAME }}" >> $GITHUB_ENV
echo "AWS_CF_DISTRIBUTION_ID=${{ secrets.AWS_STAGING_CF_DISTRIBUTION_ID }}" >> $GITHUB_ENV
echo "WRITE_KEY=${{ secrets.SANITY_SUITE_STAGING_WRITE_KEY }}" >> $GITHUB_ENV
echo "DATAPLANE_URL=${{ secrets.SANITY_SUITE_STAGING_DATAPLANE_URL }}" >> $GITHUB_ENV
echo "CONFIG_SERVER_HOST=${{ secrets.SANITY_SUITE_STAGING_CONFIG_SERVER_HOST }}" >> $GITHUB_ENV
echo "BUGSNAG_API_KEY=${{ secrets.RS_STAGING_BUGSNAG_API_KEY }}" >> $GITHUB_ENV
echo "BUGSNAG_RELEASE_STAGE=staging" >> $GITHUB_ENV
echo "SDK_CDN_VERSION_PATH_PREFIX=staging/latest/" >> $GITHUB_ENV
echo "SUITE_CDN_PATH=/staging/" >> $GITHUB_ENV
elif [ "${{ inputs.environment }}" == "production" ]; then
echo "AWS_ACCOUNT_ID=${{ secrets.AWS_PROD_ACCOUNT_ID }}" >> $GITHUB_ENV
echo "AWS_S3_SYNC_ROLE=${{ secrets.AWS_PROD_S3_SYNC_ROLE }}" >> $GITHUB_ENV
echo "AWS_S3_BUCKET_NAME=${{ secrets.AWS_PROD_S3_BUCKET_NAME }}" >> $GITHUB_ENV
echo "AWS_CF_DISTRIBUTION_ID=${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }}" >> $GITHUB_ENV
echo "WRITE_KEY=${{ secrets.SANITY_SUITE_PROD_WRITE_KEY }}" >> $GITHUB_ENV
echo "DATAPLANE_URL=${{ secrets.SANITY_SUITE_PROD_DATAPLANE_URL }}" >> $GITHUB_ENV
echo "CONFIG_SERVER_HOST=${{ secrets.SANITY_SUITE_PROD_CONFIG_SERVER_HOST }}" >> $GITHUB_ENV
echo "BUGSNAG_API_KEY=${{ secrets.RS_PROD_BUGSNAG_API_KEY }}" >> $GITHUB_ENV
echo "BUGSNAG_RELEASE_STAGE=production" >> $GITHUB_ENV
echo "SDK_CDN_VERSION_PATH_PREFIX=" >> $GITHUB_ENV
echo "SUITE_CDN_PATH=/" >> $GITHUB_ENV
else
echo "SDK_CDN_VERSION_PATH_PREFIX=dev/latest/" >> $GITHUB_ENV
echo "SUITE_CDN_PATH=/dev/" >> $GITHUB_ENV
fi
- name: Install AWS CLI
uses: unfor19/install-aws-cli-action@master

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/${{ env.AWS_S3_SYNC_ROLE }}
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_S3_SYNC_ROLE }}
aws-region: us-east-1

- name: Setup Node
Expand All @@ -123,10 +89,10 @@ jobs:
- name: Build artifacts
env:
WRITE_KEY: ${{ env.WRITE_KEY }}
DATAPLANE_URL: ${{ env.DATAPLANE_URL }}
CONFIG_SERVER_HOST: ${{ env.CONFIG_SERVER_HOST }}
BUGSNAG_API_KEY: ${{ env.BUGSNAG_API_KEY }}
WRITE_KEY: ${{ secrets.SANITY_SUITE_WRITE_KEY }}
DATAPLANE_URL: ${{ secrets.SANITY_SUITE_DATAPLANE_URL }}
CONFIG_SERVER_HOST: ${{ secrets.SANITY_SUITE_CONFIG_SERVER_HOST }}
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
BUGSNAG_RELEASE_STAGE: ${{ env.BUGSNAG_RELEASE_STAGE }}
SDK_CDN_VERSION_PATH_PREFIX: ${{ env.SDK_CDN_VERSION_PATH_PREFIX }}
HUSKY: 0
Expand All @@ -135,11 +101,11 @@ jobs:
- name: Sync files to S3
run: |
aws s3 cp packages/sanity-suite/dist/ s3://${{ env.AWS_S3_BUCKET_NAME }}/sanity-suite${{ env.SUITE_CDN_PATH }} --recursive --cache-control ${{ env.CACHE_CONTROL }}
aws s3 cp packages/sanity-suite/dist/ s3://${{ secrets.AWS_S3_BUCKET_NAME }}/sanity-suite${{ env.SUITE_CDN_PATH }} --recursive --cache-control ${{ env.CACHE_CONTROL }}
- name: Create Cloudfront invalidation
run: |
AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ env.AWS_CF_DISTRIBUTION_ID }} --paths "/sanity-suite${{ env.SUITE_CDN_PATH }}*"
AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} --paths "/sanity-suite${{ env.SUITE_CDN_PATH }}*"
- name: Send message to Slack channel
id: slack
Expand All @@ -149,7 +115,7 @@ jobs:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
PROJECT_NAME: 'Sanity suite - ${{ inputs.environment }}'
CDN_URL: 'https://cdn.rudderlabs.com/sanity-suite${{ env.SUITE_CDN_PATH }}v3/cdn/index.html'
LINK_TEXT: ${{ ((inputs.environment == 'staging' && format('v{0} - Staging', env.CURRENT_VERSION_VALUE)) || format('v{0}', env.CURRENT_VERSION_VALUE)) }}
LINK_TEXT: ${{ ((inputs.environment == 'development' && format('v{0} - Development', env.CURRENT_VERSION_VALUE)) || (inputs.environment == 'staging' && format('v{0} - Staging', env.CURRENT_VERSION_VALUE)) || format('v{0}', env.CURRENT_VERSION_VALUE)) }}
with:
channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }}
payload: |
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ jobs:
with:
environment: 'staging'
secrets:
AWS_STAGING_ACCOUNT_ID: ${{ secrets.AWS_STAGING_ACCOUNT_ID }}
AWS_STAGING_S3_BUCKET_NAME: ${{ secrets.AWS_STAGING_S3_BUCKET_NAME }}
AWS_STAGING_S3_SYNC_ROLE: ${{ secrets.AWS_STAGING_S3_SYNC_ROLE }}
AWS_STAGING_CF_DISTRIBUTION_ID: ${{ secrets.AWS_STAGING_CF_DISTRIBUTION_ID }}
SANITY_SUITE_STAGING_WRITE_KEY: ${{ secrets.SANITY_SUITE_STAGING_WRITE_KEY }}
SANITY_SUITE_STAGING_DATAPLANE_URL: ${{ secrets.SANITY_SUITE_STAGING_DATAPLANE_URL }}
SANITY_SUITE_STAGING_CONFIG_SERVER_HOST: ${{ secrets.SANITY_SUITE_STAGING_CONFIG_SERVER_HOST }}
RS_STAGING_BUGSNAG_API_KEY: ${{ secrets.RS_STAGING_BUGSNAG_API_KEY }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_STAGING_ACCOUNT_ID }}
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_STAGING_S3_BUCKET_NAME }}
AWS_S3_SYNC_ROLE: ${{ secrets.AWS_STAGING_S3_SYNC_ROLE }}
AWS_CF_DISTRIBUTION_ID: ${{ secrets.AWS_STAGING_CF_DISTRIBUTION_ID }}
SANITY_SUITE_WRITE_KEY: ${{ secrets.SANITY_SUITE_STAGING_WRITE_KEY }}
SANITY_SUITE_DATAPLANE_URL: ${{ secrets.SANITY_SUITE_STAGING_DATAPLANE_URL }}
SANITY_SUITE_CONFIG_SERVER_HOST: ${{ secrets.SANITY_SUITE_STAGING_CONFIG_SERVER_HOST }}
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
uses: ./.github/workflows/trigger-test-suites.yml
needs: deploy-sanity-suite
name: Trigger Sanity Suite
name: Trigger test suites
with:
environment: staging
secrets:
Expand Down
Loading

0 comments on commit 97c90e9

Please sign in to comment.