-
Notifications
You must be signed in to change notification settings - Fork 85
test: publish to gamma and run smoke test on merge #725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
65b1f77
7a83c26
2d01a3f
3dd8da2
81efcd0
2577276
1799997
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| name: AWS RUM Web Client Smoke Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, release/*.*.*] | ||
|
|
||
| jobs: | ||
| smoke-test: | ||
| name: Run Smoke Tests | ||
| runs-on: ubuntu-latest | ||
| environment: smoke-test | ||
| permissions: write-all | ||
| steps: | ||
| - name: Checkout AWS RUM Web Client Repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20.x' | ||
| registry-url: 'https://registry.npmjs.org' | ||
|
|
||
| - name: Cache NPM modules | ||
| uses: actions/cache@v4 | ||
| 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 }} ${{ secrets.SMOKE_MONITOR_2 }} ${{ secrets.SMOKE_ARN_2 }} ${{ secrets.SMOKE_IDENTITY_2 }} | ||
|
|
||
| - 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 }} | ||
| MONITOR2: ${{ secrets.SMOKE_MONITOR_2 }} | ||
| 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 }} | ||
| MONITOR_2: ${{ secrets.SMOKE_MONITOR_2 }} | ||
| 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit/suggestion: Given there's some overlap with the cd.yaml workflow, we could explore if we could simplify the workflows to reduce redundancy across the workflows and only have to maintain the workflow for gamma in one place.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes from description, I would like to do this but it's risky to edit cd.yaml without doing tons of manual testing |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: do you want this on merges to release branch as well? I understand merging to main.
in our release workflow, we only merge stuff to release branch when we are getting the release ready. We typically cut a branch from main. After we do that, we run the release workflow which would end up running the smoke tests anyhow.
Are we duplicating test runs and making the release flow longer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These only run in the background when we merge to main, and give us checkmarks for each commit. We are not blocking release activity or pull requests, so this doesn't restrict our work in any way.
I think it's worthwhile because it is still possible to make rebasing errors on release branches, which is why we also run unit and integration tests against release branches