From 8b267a5b6237f09f59f8cd74762ca67a67486357 Mon Sep 17 00:00:00 2001 From: Billy Zhou Date: Tue, 25 Jun 2024 18:25:55 -0700 Subject: [PATCH 1/4] chore: separate smoke test --- .github/workflows/smoke.yaml | 130 +++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 .github/workflows/smoke.yaml diff --git a/.github/workflows/smoke.yaml b/.github/workflows/smoke.yaml new file mode 100644 index 00000000..210598b0 --- /dev/null +++ b/.github/workflows/smoke.yaml @@ -0,0 +1,130 @@ +name: Smoke Test + +on: + workflow_dispatch: + +jobs: + smoke_test: + name: Smoke Test + runs-on: ubuntu-latest + environment: cdn-prod-release + permissions: write-all + steps: + - name: Checkout AWS RUM Web Client Repository + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: '20.x' + registry-url: 'https://registry.npmjs.org' + + - name: Cache NPM modules + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Build Release + run: | + npm ci + npm run release + + - name: Install PlayWright + run: npx playwright install --with-deps chromium + + - name: Fetch AWS Credentials for Gamma Deployment + run: | + export AWS_ROLE_ARN=${{ secrets.ROLE_GAMMA }} + export AWS_WEB_IDENTITY_TOKEN_FILE=/tmp/awscreds + export AWS_DEFAULT_REGION=us-east-1 + + echo AWS_WEB_IDENTITY_TOKEN_FILE=$AWS_WEB_IDENTITY_TOKEN_FILE >> $GITHUB_ENV + echo AWS_ROLE_ARN=$AWS_ROLE_ARN >> $GITHUB_ENV + echo AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION >> $GITHUB_ENV + + curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r '.value' > $AWS_WEB_IDENTITY_TOKEN_FILE + + - name: Publish to CloudWatch RUM Gamma CDN + id: publish-cdn-gamma + run: | + chmod u+x .github/scripts/deploy.sh + .github/scripts/deploy.sh ${{ secrets.BUCKET_GAMMA }} + + - name: Validate Gamma versions.csv file + run: | + chmod u+x .github/scripts/validate_versions.sh + .github/scripts/validate_versions.sh ${{ secrets.BUCKET_GAMMA }} + + - name: Fetch AWS Credentials for Gamma Smoke Test + run: | + export AWS_ROLE_ARN=${{ secrets.SMOKE_TEST_ROLE }} + export AWS_WEB_IDENTITY_TOKEN_FILE=/tmp/awscreds + export AWS_DEFAULT_REGION=us-east-1 + + echo AWS_WEB_IDENTITY_TOKEN_FILE=$AWS_WEB_IDENTITY_TOKEN_FILE >> $GITHUB_ENV + echo AWS_ROLE_ARN=$AWS_ROLE_ARN >> $GITHUB_ENV + echo AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION >> $GITHUB_ENV + + curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r '.value' > $AWS_WEB_IDENTITY_TOKEN_FILE + + - name: Update Gamma Smoke Test Application + id: update-smoke-test-gamma-cdn + run: | + chmod u+x .github/scripts/update_smoke_test.sh + .github/scripts/update_smoke_test.sh ${{ secrets.SMOKE_MONITOR }} ${{ secrets.SMOKE_REGION }} ${{ secrets.SMOKE_ARN }} ${{ secrets.SMOKE_IDENTITY }} ${{ secrets.CONFIG_ENDPOINT }} ${{ secrets.CDN_GAMMA }} + + - name: Build Smoke Test Application - NPM/ES + id: build-npm-es-application-pre-release + run: | + chmod u+x .github/scripts/build_npm_applications.sh + .github/scripts/build_npm_applications.sh "PRE" "NPM-ES" + + - name: Build Smoke Test Application - NPM/CJS + id: build-npm-cjs-application-pre-release + run: | + chmod u+x .github/scripts/build_npm_applications.sh + .github/scripts/build_npm_applications.sh "PRE" "NPM-CJS" + + - name: Upload Gamma Smoke Tests to CloudFront + id: upload-smoke-test-gamma + run: | + chmod u+x .github/scripts/upload_smoke_test.sh + .github/scripts/upload_smoke_test.sh ${{ secrets.SMOKE_BUCKET }} + + - name: Run Smoke Test (NPM ES) + env: + URL: ${{ secrets.SMOKE_URL }} + MONITOR: ${{ secrets.SMOKE_MONITOR }} + ENDPOINT: ${{ secrets.SMOKE_ENDPOINT }} + NAME: ${{ secrets.SMOKE_MONITOR_NAME }} + INSTALL_METHOD: 'NPM-ES' + run: | + curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r '.value' > $AWS_WEB_IDENTITY_TOKEN_FILE + npm run smoke:headless + timeout-minutes: 10 + + - name: Run Smoke Test (NPM CJS) + env: + URL: ${{ secrets.SMOKE_URL }} + MONITOR: ${{ secrets.SMOKE_MONITOR }} + ENDPOINT: ${{ secrets.SMOKE_ENDPOINT }} + NAME: ${{ secrets.SMOKE_MONITOR_NAME }} + INSTALL_METHOD: 'NPM-CJS' + run: | + curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r '.value' > $AWS_WEB_IDENTITY_TOKEN_FILE + npm run smoke:headless + timeout-minutes: 10 + + - name: Run Gamma Smoke Test (CDN GAMMA) + env: + URL: ${{ secrets.SMOKE_URL }} + MONITOR: ${{ secrets.SMOKE_MONITOR }} + ENDPOINT: ${{ secrets.SMOKE_ENDPOINT }} + NAME: ${{ secrets.SMOKE_MONITOR_NAME }} + INSTALL_METHOD: 'CDN' + run: | + curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r '.value' > $AWS_WEB_IDENTITY_TOKEN_FILE + npm run smoke:headless From 3bff62e71580d79d9ce7a17c70dfc0d40ac0add9 Mon Sep 17 00:00:00 2001 From: Billy Zhou Date: Tue, 25 Jun 2024 18:31:06 -0700 Subject: [PATCH 2/4] chore: add on push to smoke branch --- .github/workflows/smoke.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/smoke.yaml b/.github/workflows/smoke.yaml index 210598b0..ddfee562 100644 --- a/.github/workflows/smoke.yaml +++ b/.github/workflows/smoke.yaml @@ -2,6 +2,8 @@ name: Smoke Test on: workflow_dispatch: + push: + branches: smoke jobs: smoke_test: From 5e273fdd4e15236117c4ac89768a1eab155ed962 Mon Sep 17 00:00:00 2001 From: Billy Zhou Date: Tue, 25 Jun 2024 18:33:23 -0700 Subject: [PATCH 3/4] fix: change environ to gamma release --- .github/workflows/smoke.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/smoke.yaml b/.github/workflows/smoke.yaml index ddfee562..c7efe3bb 100644 --- a/.github/workflows/smoke.yaml +++ b/.github/workflows/smoke.yaml @@ -9,7 +9,7 @@ jobs: smoke_test: name: Smoke Test runs-on: ubuntu-latest - environment: cdn-prod-release + environment: cdn-gamma-release permissions: write-all steps: - name: Checkout AWS RUM Web Client Repository From c4f427abfe990f986f98d0a3a73988e248b728d6 Mon Sep 17 00:00:00 2001 From: Billy Zhou Date: Tue, 25 Jun 2024 18:36:00 -0700 Subject: [PATCH 4/4] chore: rename to gamma smoke test --- .github/workflows/smoke.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/smoke.yaml b/.github/workflows/smoke.yaml index c7efe3bb..2642c463 100644 --- a/.github/workflows/smoke.yaml +++ b/.github/workflows/smoke.yaml @@ -1,4 +1,4 @@ -name: Smoke Test +name: Gamma Smoke Test on: workflow_dispatch: @@ -7,7 +7,7 @@ on: jobs: smoke_test: - name: Smoke Test + name: Gamma Smoke Test runs-on: ubuntu-latest environment: cdn-gamma-release permissions: write-all