This repository was archived by the owner on Nov 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
DX-3003 DX-2971 Workflow Change to One S3 Bucket and CF Test Cleanup #861
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
9f1ca8b
DX-3003
brianluisgomez 888ee18
Update docusaurus.config.js
brianluisgomez c0ca160
Workflow updates
brianluisgomez 8eb7677
Update pr-closed-delete-staging-site.yml
brianluisgomez 993e4cd
Update pr-publish-docsite.yml
brianluisgomez bb4c44d
Merge branch 'main' into DX-3003
brianluisgomez 939d029
Update docusaurus.config.js
brianluisgomez 54ccd8c
Merge branch 'DX-3003' of https://github.com/Bandwidth/api-docs into …
brianluisgomez 2df585a
Update SplashPage.js
brianluisgomez d6801c0
Cypress test updates
brianluisgomez 9cf5885
Merge branch 'main' into DX-3003
brianluisgomez 11fdbc4
Merge branch 'main' into DX-3003
brianluisgomez 8646bac
Update .github/workflows/pr-closed-delete-staging-site.yml
brianluisgomez 0881cfb
Update pr-closed-delete-staging-site.yml
brianluisgomez 208dabb
Merge branch 'DX-3003' of https://github.com/Bandwidth/api-docs into …
brianluisgomez 55d2d97
Merge branch 'main' into DX-3003
brianluisgomez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| # Deletes the staging docsite folder in the staging bucket on a closed PR | ||
|
|
||
| name: PR Closed Delete Staging Site | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [closed] | ||
| branches: | ||
| - 'main' | ||
| paths: | ||
| - 'site/**' | ||
|
|
||
| jobs: | ||
| cypress_cloudfront: | ||
| name: Cypress Against Cloudfront Staged Site | ||
| runs-on: ubuntu-latest | ||
| if: github.event.pull_request.merged == true | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest] | ||
| browser: [chrome] | ||
| steps: | ||
| - name: Setup Node | ||
| uses: actions/setup-node@v2 | ||
| with: | ||
| node-version: 16 | ||
|
|
||
| - name: Checkout | ||
| uses: actions/checkout@v2 | ||
|
|
||
| - name: Configure AWS Credentials | ||
| uses: aws-actions/configure-aws-credentials@v1 | ||
| with: | ||
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| aws-region: us-east-1 | ||
|
|
||
| - name: Set Environment Variables | ||
| run: | | ||
| BRANCH_NAME=${GITHUB_HEAD_REF#refs/heads/} | ||
| BRANCH_NAME=$(echo "$BRANCH_NAME" | tr '[:upper:]' '[:lower:]') | ||
| BRANCH_NAME=$(echo "$BRANCH_NAME" | sed -e "s/[^a-z0-9]/-/g") | ||
| echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | ||
|
|
||
| - name: Create Cypress Config | ||
| run: | | ||
| cd ./site | ||
| cat >staged-cypress.config.js <<EOL | ||
| const { defineConfig } = require("cypress"); | ||
|
|
||
| module.exports = defineConfig({ | ||
| e2e: { | ||
| setupNodeEvents(on, config) { | ||
| // implement node event listeners here | ||
| }, | ||
| baseUrl: "https://${{env.BRANCH_NAME}}.staging-dev.bandwidth.com/" | ||
| }, | ||
| projectId: "oz7rpf", | ||
| pageLoadTimeout: 60000, | ||
| viewportWidth: 1440, | ||
| viewportHeight: 900, | ||
| video: false, | ||
| videoUploadOnPasses: false, | ||
| screenshotOnRunFailure: true, | ||
| retries: 3, | ||
| }); | ||
| EOL | ||
|
|
||
| - name: Cypress Staged Cloudfront Deployment Test | ||
| uses: cypress-io/github-action@v4.2.0 | ||
| timeout-minutes: 40 | ||
| with: | ||
| record: true | ||
| browser: ${{ matrix.browser }} | ||
| working-directory: ./site | ||
| config-file: staged-cypress.config.js | ||
| tag: production | ||
| env: | ||
| CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | ||
| CYPRESS_PROJECT_ID: ${{ secrets.PROJECT_ID }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| COMMIT_INFO_MESSAGE: ${{github.event.pull_request.title}} | ||
| COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha}} | ||
|
|
||
| delete_bucket_folder: | ||
| name: Delete Bucket Folder | ||
| if: ${{ success() || github.event.pull_request.merged == false }} | ||
| needs: [cypress_cloudfront] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Set Environment Variables | ||
| run: | | ||
| BRANCH_NAME=${GITHUB_HEAD_REF#refs/heads/} | ||
| BRANCH_NAME=$(echo "$BRANCH_NAME" | tr '[:upper:]' '[:lower:]') | ||
| BRANCH_NAME=$(echo "$BRANCH_NAME" | sed -e "s/[^a-z0-9]/-/g") | ||
| echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | ||
|
|
||
| - name: Configure AWS Credentials | ||
| uses: aws-actions/configure-aws-credentials@v1 | ||
| with: | ||
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| aws-region: us-east-1 | ||
|
|
||
| - name: Cleanup S3 Bucket | ||
| run: aws s3 rm s3://staging-dev-docsite/ --recursive --exclude "*" --include "${{ env.BRANCH_NAME }}/*" | ||
|
|
||
| notify_for_failures: | ||
| name: Notify for Failures | ||
| needs: [cypress_cloudfront, delete_bucket_folder] | ||
| if: failure() | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Notify Slack of Failures | ||
| uses: Bandwidth/build-notify-slack-action@v1.0.0 | ||
| with: | ||
| job-status: failure | ||
| slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} | ||
| slack-channel: ${{ secrets.SLACK_CHANNEL }} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.