From 9f1ca8b0deb66aea90c084fcb37756fb9c00f98d Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 2 Dec 2022 16:12:05 -0500 Subject: [PATCH 01/10] DX-3003 --- .github/workflows/listener.yml | 2 +- .github/workflows/pr-closed-delete-bucket.yml | 36 --- .../pr-closed-delete-staging-site.yml | 118 +++++++++ .github/workflows/pr-publish-docsite.yml | 231 ++---------------- site/docusaurus.config.js | 2 +- site/migration-guides/intro.mdx | 2 +- site/src/pages/apis/global/index.js | 8 +- site/src/pages/apis/index.js | 20 +- site/src/pages/docs/index.js | 14 +- site/src/pages/sdks/index.js | 12 +- 10 files changed, 163 insertions(+), 282 deletions(-) delete mode 100644 .github/workflows/pr-closed-delete-bucket.yml create mode 100644 .github/workflows/pr-closed-delete-staging-site.yml diff --git a/.github/workflows/listener.yml b/.github/workflows/listener.yml index 7943c53af..c3d2d0a21 100644 --- a/.github/workflows/listener.yml +++ b/.github/workflows/listener.yml @@ -49,7 +49,7 @@ jobs: token: ${{ secrets.DX_GITHUB_TOKEN }} repo-name: ${{ github.event.client_payload.originRepo }} pr-number: ${{ github.event.client_payload.prNumber }} - message: 'Preview site: http://bw-api-docs-${{ env.BRANCH_NAME }}.s3-website-us-east-1.amazonaws.com/\nPlease note that it may take a couple minutes for your preview site to become available.\n\nSee the corresponding PR opened on the docsite repository (no action required):\nhttps://github.com/Bandwidth/api-docs/pull/${{ env.PR_NUMBER }}' + message: 'Preview site: http://{{ env.BRANCH_NAME }}.staging-dev.bandwidth.com/\nPlease note that it may take a couple minutes for your preview site to become available.\n\nSee the corresponding PR opened on the docsite repository (no action required):\nhttps://github.com/Bandwidth/api-docs/pull/${{ env.PR_NUMBER }}' merge: if: ${{ github.event.action == 'Merge' }} diff --git a/.github/workflows/pr-closed-delete-bucket.yml b/.github/workflows/pr-closed-delete-bucket.yml deleted file mode 100644 index 2ba193a7f..000000000 --- a/.github/workflows/pr-closed-delete-bucket.yml +++ /dev/null @@ -1,36 +0,0 @@ -# Deletes the staging docsite bucket on PR closed - -name: PR Closed Delete Bucket - -on: - pull_request: - types: [closed] - branches: - - 'main' - paths: - - 'site/**' - -jobs: - delete_bucket: - name: Delete Bucket - runs-on: ubuntu-latest - steps: - - 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: Create Bucket Name - id: create_name - run: | - BUCKET_NAME=bw-api-docs-${GITHUB_HEAD_REF#refs/heads/} - BUCKET_NAME=$(echo "$BUCKET_NAME" | tr '[:upper:]' '[:lower:]') #convert to lowercase for AWS bucket (can't be uppercase) - BUCKET_NAME=$(echo "$BUCKET_NAME" | sed -e "s/[^a-z0-9]/-/g") #replace all remaining non alphanumerics with - - echo $BUCKET_NAME - echo "::set-output name=bucket_name::$BUCKET_NAME" - - name: Delete Bucket - run: | - aws s3 rb s3://$BUCKET_NAME --force --region us-east-1 - env: - BUCKET_NAME: ${{ steps.create_name.outputs.bucket_name }} diff --git a/.github/workflows/pr-closed-delete-staging-site.yml b/.github/workflows/pr-closed-delete-staging-site.yml new file mode 100644 index 000000000..fb972999c --- /dev/null +++ b/.github/workflows/pr-closed-delete-staging-site.yml @@ -0,0 +1,118 @@ +# Deletes the staging docsite folder in the staging bucket on a closed PR + +name: PR Closed Delete Bucket + +on: + pull_request: + types: [closed] + branches: + - 'main' + paths: + - 'site/**' + +jobs: + cypress_cloudfront: + name: Cypress Against Cloudfront Staged Site + runs-on: ubuntu-latest + 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 <> $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 "$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 }} diff --git a/.github/workflows/pr-publish-docsite.yml b/.github/workflows/pr-publish-docsite.yml index 8e4f40c25..be74434d1 100644 --- a/.github/workflows/pr-publish-docsite.yml +++ b/.github/workflows/pr-publish-docsite.yml @@ -71,148 +71,26 @@ jobs: with: node-version: 16 + - 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: Generate Static Site run: | cd site yarn install --pure-lockfile npm run build - - name: Create Bucket Name - id: create_name + - name: Sync Zip to Bucket run: | - BUCKET_NAME=bw-api-docs-${GITHUB_HEAD_REF#refs/heads/} - BUCKET_NAME=$(echo "$BUCKET_NAME" | tr '[:upper:]' '[:lower:]') #convert to lowercase for AWS bucket (can't be uppercase) - BUCKET_NAME=$(echo "$BUCKET_NAME" | sed -e "s/[^a-z0-9]/-/g") #replace all remaining non alphanumerics with - - echo "BUCKET_NAME=$BUCKET_NAME" >> $GITHUB_ENV - - - name: Sync S3 Bucket - uses: Bandwidth/s3-sync-action@v1.3.0 - with: - bucket-name: ${{ env.BUCKET_NAME }} - bucket-region: us-east-1 - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - content-path: ./site/build + aws s3 sync ./site/build s3://staging-dev-docsite/$BRANCH_NAME --acl public-read - - name: Create Cloudfront distribution - id: distribution + - name: Invalidate CF Cache run: | - cat >dist-config.json <staged-cypress.config.js <cloudfront.json - cat >distribution.json - aws cloudfront get-distribution-config --id ${{ needs.publish.outputs.id }} | \ - jq .DistributionConfig.Enabled=false > cloudfront.json - jq -r .DistributionConfig cloudfront.json > distribution.json - response=$(aws cloudfront update-distribution --id ${{ needs.publish.outputs.id }} \ - --if-match $(jq .ETag cloudfront.json -r) \ - --distribution-config file://distribution.json) - aws cloudfront wait distribution-deployed --id ${{ needs.publish.outputs.id }} - aws cloudfront delete-distribution --id ${{ needs.publish.outputs.id }} --if-match $(echo $response | jq .ETag -r) - + alert_if_failure: name: Alert for failure - needs: [cypress, publish, cypress_cloudfront] + needs: [cypress, publish] if: failure() && !github.event.pull_request.draft runs-on: ubuntu-latest steps: @@ -354,5 +153,5 @@ jobs: issue_number: '${{ env.SPECS_PR_NUMBER }}', owner: 'Bandwidth', repo: 'api-specs', - body: 'http://${{ env.BUCKET_NAME }}.s3-website-us-east-1.amazonaws.com/' + body: 'http://$BUCKET_NAME.staging-dev.bandwidth.com/' }) diff --git a/site/docusaurus.config.js b/site/docusaurus.config.js index d1a464cfd..e1bfe64f7 100644 --- a/site/docusaurus.config.js +++ b/site/docusaurus.config.js @@ -31,7 +31,7 @@ module.exports = { onBrokenLinks: 'throw', onBrokenMarkdownLinks: 'warn', favicon: 'img/favicon.ico', - trailingSlash: true, + trailingSlash: undefined, organizationName: 'bandwidth', projectName: 'api-docs', themeConfig: { diff --git a/site/migration-guides/intro.mdx b/site/migration-guides/intro.mdx index fc2ef75fe..89b25a9ab 100644 --- a/site/migration-guides/intro.mdx +++ b/site/migration-guides/intro.mdx @@ -16,4 +16,4 @@ image: '@site/static/img/bw-icon.svg' Home of migration guides between major versions of each SDK language -* [Python](/migration-guides/python) +* [Python](/migration-guides/python/) diff --git a/site/src/pages/apis/global/index.js b/site/src/pages/apis/global/index.js index 8d96d4606..448ea589a 100644 --- a/site/src/pages/apis/global/index.js +++ b/site/src/pages/apis/global/index.js @@ -7,10 +7,10 @@ import SpecVersionDropdown from '@site/src/components/SpecVersionDropdown'; export default function ApiReferencePage() { const {siteConfig} = useDocusaurusContext(); const options = [ - {title: "V1", link: "/apis/global"}, - {title: "V2", link: "/apis/global/v2"}, - {title: "V3", link: "/apis/global/v3"}, - {title: "Beta", link: "/apis/global/beta"} + {title: "V1", link: "/apis/global/"}, + {title: "V2", link: "/apis/global/v2/"}, + {title: "V3", link: "/apis/global/v3/"}, + {title: "Beta", link: "/apis/global/beta/"} ]; const version = "V1" diff --git a/site/src/pages/apis/index.js b/site/src/pages/apis/index.js index 626a29764..bdc217393 100644 --- a/site/src/pages/apis/index.js +++ b/site/src/pages/apis/index.js @@ -6,53 +6,53 @@ const apiList = [ { title: 'Voice API', Svg: require('@site/static/img/api-icons/voice.svg').default, - link: '/apis/voice' + link: '/apis/voice/' }, { title: 'Phone Number Lookup API', Svg: require('@site/static/img/api-icons/phone-number-lookup.svg').default, - link: '/apis/number-lookup' + link: '/apis/number-lookup/' }, { title: 'Numbers API', Svg: require('@site/static/img/api-icons/numbers.svg').default, - link: '/apis/numbers' + link: '/apis/numbers/' }, { title: 'Multi-Factor Authentication API', Svg: require('@site/static/img/api-icons/mfa.svg').default, - link: '/apis/multifactorauth' + link: '/apis/multifactorauth/' }, { title: 'Messaging API', Svg: require('@site/static/img/api-icons/messaging.svg').default, - link: '/apis/messaging' + link: '/apis/messaging/' }, { title: 'International Messaging API', Svg: require('@site/static/img/api-icons/international-messaging.svg').default, - link: '/apis/messaging-international' + link: '/apis/messaging-international/' }, { title: 'Emergency API', Svg: require('@site/static/img/api-icons/emergency.svg').default, - link: '/apis/dash' + link: '/apis/dash/' }, { title: 'Emergency Notifications API', Svg: require('@site/static/img/api-icons/emergency-notifications.svg').default, - link: '/apis/dash-notifications' + link: '/apis/dash-notifications/' }, { title: 'WebRTC API', Svg: require('@site/static/img/api-icons/webrtc.svg').default, - link: '/apis/webrtc' + link: '/apis/webrtc/' }, { title: 'Insights API', Svg: require('@site/static/img/api-icons/insights.svg').default, - link: '/apis/insights' + link: '/apis/insights/' }, /* TODO ONEID-1304 { diff --git a/site/src/pages/docs/index.js b/site/src/pages/docs/index.js index 7f599d1a2..e9b607a66 100644 --- a/site/src/pages/docs/index.js +++ b/site/src/pages/docs/index.js @@ -6,37 +6,37 @@ const productList = [ { title: 'Account', Svg: require('@site/static/img/product-icons/account.svg').default, - link: '/docs/account' + link: '/docs/account/' }, { title: 'Numbers', Svg: require('@site/static/img/product-icons/numbers.svg').default, - link: '/docs/numbers', + link: '/docs/numbers/', }, { title: 'Emergency', Svg: require('@site/static/img/product-icons/emergency.svg').default, - link: '/docs/emergency', + link: '/docs/emergency/', }, { title: 'Voice', Svg: require('@site/static/img/product-icons/voice.svg').default, - link: '/docs/voice', + link: '/docs/voice/', }, { title: 'Multi-Factor Authentication', Svg: require('@site/static/img/product-icons/mfa.svg').default, - link: '/docs/mfa', + link: '/docs/mfa/', }, { title: 'Messaging', Svg: require('@site/static/img/product-icons/messaging.svg').default, - link: '/docs/messaging', + link: '/docs/messaging/', }, { title: 'WebRTC', Svg: require('@site/static/img/product-icons/webrtc.svg').default, - link: '/docs/webrtc', + link: '/docs/webrtc/', }, // { TODO ONEID-1304 // title: 'Identity Management', diff --git a/site/src/pages/sdks/index.js b/site/src/pages/sdks/index.js index 4d93e35fe..a55a220d1 100644 --- a/site/src/pages/sdks/index.js +++ b/site/src/pages/sdks/index.js @@ -6,32 +6,32 @@ const sdkList = [ { title: 'Node', Svg: require('@site/static/img/sdk-icons/node.svg').default, - link: '/sdks/node' + link: '/sdks/node/' }, { title: 'Python', Svg: require('@site/static/img/sdk-icons/python.svg').default, - link: '/sdks/python' + link: '/sdks/python/' }, { title: 'Java', Svg: require('@site/static/img/sdk-icons/java.svg').default, - link: '/sdks/java' + link: '/sdks/java/' }, { title: 'PHP', Svg: require('@site/static/img/sdk-icons/php.svg').default, - link: '/sdks/php' + link: '/sdks/php/' }, { title: 'Ruby', Svg: require('@site/static/img/sdk-icons/ruby.svg').default, - link: '/sdks/ruby' + link: '/sdks/ruby/' }, { title: 'C#', Svg: require('@site/static/img/sdk-icons/csharp.svg').default, - link: '/sdks/csharp' + link: '/sdks/csharp/' }, ]; From 888ee1889cd252394353d06a796bbf47fa5626f8 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 5 Dec 2022 07:29:01 -0500 Subject: [PATCH 02/10] Update docusaurus.config.js --- site/docusaurus.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/docusaurus.config.js b/site/docusaurus.config.js index e1bfe64f7..d1a464cfd 100644 --- a/site/docusaurus.config.js +++ b/site/docusaurus.config.js @@ -31,7 +31,7 @@ module.exports = { onBrokenLinks: 'throw', onBrokenMarkdownLinks: 'warn', favicon: 'img/favicon.ico', - trailingSlash: undefined, + trailingSlash: true, organizationName: 'bandwidth', projectName: 'api-docs', themeConfig: { From c0ca1605ba065c5aa03bbc2e4e006ccafa73a862 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 5 Dec 2022 08:17:38 -0500 Subject: [PATCH 03/10] Workflow updates --- .github/workflows/pr-closed-delete-staging-site.yml | 4 ++-- .github/workflows/pr-publish-docsite.yml | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-closed-delete-staging-site.yml b/.github/workflows/pr-closed-delete-staging-site.yml index fb972999c..bcc728afc 100644 --- a/.github/workflows/pr-closed-delete-staging-site.yml +++ b/.github/workflows/pr-closed-delete-staging-site.yml @@ -53,7 +53,7 @@ jobs: setupNodeEvents(on, config) { // implement node event listeners here }, - baseUrl: "https://$BRANCH_NAME.staging-dev.bandwidth.com/" + baseUrl: "https://${{secrets.BRANCH_NAME}}.staging-dev.bandwidth.com/" }, projectId: "oz7rpf", pageLoadTimeout: 60000, @@ -102,7 +102,7 @@ jobs: aws-region: us-east-1 - name: Cleanup S3 Bucket - run: aws s3 rm s3://staging-dev-docsite/ --recursive --exclude "*" --include "$BRANCH_NAME/*" + run: aws s3 rm s3://staging-dev-docsite/ --recursive --exclude "*" --include "${{ env.BRANCH_NAME }}/*" notify_for_failures: name: Notify for Failures diff --git a/.github/workflows/pr-publish-docsite.yml b/.github/workflows/pr-publish-docsite.yml index be74434d1..dd8134b51 100644 --- a/.github/workflows/pr-publish-docsite.yml +++ b/.github/workflows/pr-publish-docsite.yml @@ -78,6 +78,13 @@ jobs: 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: Generate Static Site run: | cd site @@ -101,7 +108,7 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: 'http://$BRANCH_NAME.staging-dev.bandwidth.com/' + body: 'http://${{ env.BRANCH_NAME }}.staging-dev.bandwidth.com/' }) From 8eb7677fe69406dfda3354f44c19b1b31ece4381 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 5 Dec 2022 08:21:16 -0500 Subject: [PATCH 04/10] Update pr-closed-delete-staging-site.yml --- .github/workflows/pr-closed-delete-staging-site.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-closed-delete-staging-site.yml b/.github/workflows/pr-closed-delete-staging-site.yml index bcc728afc..063c50a3f 100644 --- a/.github/workflows/pr-closed-delete-staging-site.yml +++ b/.github/workflows/pr-closed-delete-staging-site.yml @@ -53,7 +53,7 @@ jobs: setupNodeEvents(on, config) { // implement node event listeners here }, - baseUrl: "https://${{secrets.BRANCH_NAME}}.staging-dev.bandwidth.com/" + baseUrl: "https://${{env.BRANCH_NAME}}.staging-dev.bandwidth.com/" }, projectId: "oz7rpf", pageLoadTimeout: 60000, From 993e4cd9c8bbf7725a6dee6132a27656853dd972 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 6 Dec 2022 08:40:15 -0500 Subject: [PATCH 05/10] Update pr-publish-docsite.yml --- .github/workflows/pr-publish-docsite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-publish-docsite.yml b/.github/workflows/pr-publish-docsite.yml index dd8134b51..580b32d40 100644 --- a/.github/workflows/pr-publish-docsite.yml +++ b/.github/workflows/pr-publish-docsite.yml @@ -97,7 +97,7 @@ jobs: - name: Invalidate CF Cache run: | - aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID}} --paths "/" "/*" + aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID}} --paths "/" "/*" - name: Comment on PR uses: actions/github-script@v3 From 939d0293243656a203c73fc0626298cfe6716491 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 6 Dec 2022 09:09:31 -0500 Subject: [PATCH 06/10] Update docusaurus.config.js --- site/docusaurus.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/docusaurus.config.js b/site/docusaurus.config.js index d1a464cfd..f9a3feb89 100644 --- a/site/docusaurus.config.js +++ b/site/docusaurus.config.js @@ -28,10 +28,10 @@ module.exports = { tagline: 'Learn About Bandwidth\'s Product APIs', url: 'https://dev.bandwidth.com', baseUrl: '/', - onBrokenLinks: 'throw', + onBrokenLinks: 'warn', onBrokenMarkdownLinks: 'warn', favicon: 'img/favicon.ico', - trailingSlash: true, + trailingSlash: false, organizationName: 'bandwidth', projectName: 'api-docs', themeConfig: { From 2df585a0d9d9a6d92ceee4f0911fda84f0ebaa27 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 6 Dec 2022 09:37:22 -0500 Subject: [PATCH 07/10] Update SplashPage.js --- site/src/components/SplashPage.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/site/src/components/SplashPage.js b/site/src/components/SplashPage.js index 7637d5db3..917c28682 100644 --- a/site/src/components/SplashPage.js +++ b/site/src/components/SplashPage.js @@ -6,7 +6,7 @@ const guides = { title: 'Check out our guides', text: `Explore our API guides to learn more about Bandwidth's APIs and the things you can do with us.`, linkText: 'Read the guides →', - link: '/docs' + link: '/docs/' } const guidesImage = require('@site/static/img/guides-splash.svg').default; @@ -14,7 +14,7 @@ const apis = { title: 'Dig into our API reference', text: `Use the API technical reference to get the detailed information developers need when coding. Get the nitty-gritty details about resources in our APIs.`, linkText: 'See our API reference →', - link: '/apis' + link: '/apis/' } const apisImage = require('@site/static/img/apis-splash.svg').default; @@ -22,7 +22,7 @@ const sdks = { title: 'Looking for our SDKs?', text: `We offer SDKs for several popular languages. Build your apps using our official SDKs in the language of your choice.`, linkText: 'Build with Bandwidth →', - link: '/sdks' + link: '/sdks/' } const sdksImage = require('@site/static/img/sdks-splash.svg').default; From d6801c04ee6773a5f1d2354df8e3ca5b5a911a5b Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 9 Dec 2022 10:37:55 -0500 Subject: [PATCH 08/10] Cypress test updates --- site/cypress/e2e/tests/docs.cy.js | 14 +++++++------- site/cypress/e2e/tests/docs_sidebar.cy.js | 2 +- .../e2e/tests/migration_guides_sidebar.cy.js | 2 +- site/cypress/e2e/tests/navbar.cy.js | 2 +- site/cypress/e2e/tests/search.cy.js | 6 +++--- site/cypress/utils/utils.js | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/site/cypress/e2e/tests/docs.cy.js b/site/cypress/e2e/tests/docs.cy.js index 55ec48c80..73def6f21 100644 --- a/site/cypress/e2e/tests/docs.cy.js +++ b/site/cypress/e2e/tests/docs.cy.js @@ -1,7 +1,7 @@ import {testTextLink, testSvgLink} from '../../utils/utils' context('Account Text Link', () => { - testTextLink('/docs', 'Account', 'docs/account', '[data-cy="textLink"]') + testTextLink('/docs/', 'Account', 'docs/account', '[data-cy="textLink"]') }) context('Account SVG Link', () => { @@ -9,7 +9,7 @@ context('Account SVG Link', () => { }) context('Numbers Text Link', () => { - testTextLink('/docs','Numbers','docs/numbers', '[data-cy="textLink"]') + testTextLink('/docs/','Numbers','docs/numbers', '[data-cy="textLink"]') }) context('Numbers SVG Link', () => { @@ -17,7 +17,7 @@ context('Numbers SVG Link', () => { }) context('Voice Text Link', () => { - testTextLink('/docs','Voice', 'docs/voice', '[data-cy="textLink"]') + testTextLink('/docs/','Voice', 'docs/voice', '[data-cy="textLink"]') }) context('Voice SVG Link', () => { @@ -25,7 +25,7 @@ context('Voice SVG Link', () => { }) context('Messaging Text Link', () => { - testTextLink('/docs','Messaging','docs/messaging', '[data-cy="textLink"]') + testTextLink('/docs/','Messaging','docs/messaging', '[data-cy="textLink"]') }) context('Messaging SVG Link', () => { @@ -33,7 +33,7 @@ context('Messaging SVG Link', () => { }) context('WebRTC Text Link', () => { - testTextLink('/docs','WebRTC', 'docs/webrtc' ,'[data-cy="textLink"]') + testTextLink('/docs/','WebRTC', 'docs/webrtc' ,'[data-cy="textLink"]') }) context('WebRTC SVG Link', () => { @@ -41,7 +41,7 @@ context('WebRTC SVG Link', () => { }) context('Multi-Factor Authentication Text Link', () => { - testTextLink('/docs','Multi-Factor Authentication', 'docs/mfa' ,'[data-cy="textLink"]') + testTextLink('/docs/','Multi-Factor Authentication', 'docs/mfa' ,'[data-cy="textLink"]') }) context('Multi-Factor Authentication SVG Link', () => { @@ -49,7 +49,7 @@ context('Multi-Factor Authentication SVG Link', () => { }) context('Emergency Text Link', () => { - testTextLink('/docs','Emergency', 'docs/emergency' ,'[data-cy="textLink"]') + testTextLink('/docs/','Emergency', 'docs/emergency' ,'[data-cy="textLink"]') }) context('Emergency SVG Link', () => { diff --git a/site/cypress/e2e/tests/docs_sidebar.cy.js b/site/cypress/e2e/tests/docs_sidebar.cy.js index 3b0b8c45a..d079cbf47 100644 --- a/site/cypress/e2e/tests/docs_sidebar.cy.js +++ b/site/cypress/e2e/tests/docs_sidebar.cy.js @@ -3,7 +3,7 @@ import {testSidebar} from '../../utils/utils' context('Testing the Docs Sidebar Tabs', () => { beforeEach(() => { - cy.visit('/docs/versions') + cy.visit('/docs/versions/') }) it('Should verify that the Account Management tab and sub-tabs opens and closes properly', () => { diff --git a/site/cypress/e2e/tests/migration_guides_sidebar.cy.js b/site/cypress/e2e/tests/migration_guides_sidebar.cy.js index 0c52e6b4e..66b905c0d 100644 --- a/site/cypress/e2e/tests/migration_guides_sidebar.cy.js +++ b/site/cypress/e2e/tests/migration_guides_sidebar.cy.js @@ -3,7 +3,7 @@ import {testSidebar} from '../../utils/utils' context('Testing the Migration Guides Sidebar Tabs', () => { beforeEach(() => { - cy.visit('/migration-guides') + cy.visit('/migration-guides/') }) it('Should verify that the Python tab and subtabs opens and closes properly', () => { diff --git a/site/cypress/e2e/tests/navbar.cy.js b/site/cypress/e2e/tests/navbar.cy.js index a45cd81b2..b51e4ac4a 100644 --- a/site/cypress/e2e/tests/navbar.cy.js +++ b/site/cypress/e2e/tests/navbar.cy.js @@ -40,7 +40,7 @@ it('Should verify the external link worked', () => { context('Dev Docs Brand Logo/Link', () => { it('cy.go() - go back or forward in the browser\'s history', () => { - cy.visit('/docs') + cy.visit('/docs/') cy.get('.navbar__brand') .click() cy.location('pathname').should('include', '/') diff --git a/site/cypress/e2e/tests/search.cy.js b/site/cypress/e2e/tests/search.cy.js index 14a18a093..707c6f7ed 100644 --- a/site/cypress/e2e/tests/search.cy.js +++ b/site/cypress/e2e/tests/search.cy.js @@ -9,7 +9,7 @@ context('Algolia Search', () => { }) context('Redoc Search', () => { - redocSearchTester('/apis/messaging', 'List') - redocSearchTester('/apis/numbers', 'CampaignManagement') - redocSearchTester('/apis/voice', '/calls') + redocSearchTester('/apis/messaging/', 'List') + redocSearchTester('/apis/numbers/', 'CampaignManagement') + redocSearchTester('/apis/voice/', '/calls') }) diff --git a/site/cypress/utils/utils.js b/site/cypress/utils/utils.js index 05ebb4295..e706bcd11 100644 --- a/site/cypress/utils/utils.js +++ b/site/cypress/utils/utils.js @@ -99,7 +99,7 @@ export const navTester = (path) => { export const downloadButtonTester = (path) => { it('checks the download button to verify it exists',() => { - cy.visit(`/apis/${path}`) + cy.visit(`/apis/${path}/`) cy.get('p') .contains("Download OpenAPI specification") .children('a') From 8646baca4404cf2c9c80ced8ec8812cc1aea1ba8 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 14 Dec 2022 14:59:39 -0500 Subject: [PATCH 09/10] Update .github/workflows/pr-closed-delete-staging-site.yml Co-authored-by: AJ Rice <53190766+ajrice6713@users.noreply.github.com> --- .github/workflows/pr-closed-delete-staging-site.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-closed-delete-staging-site.yml b/.github/workflows/pr-closed-delete-staging-site.yml index 063c50a3f..501b1d43a 100644 --- a/.github/workflows/pr-closed-delete-staging-site.yml +++ b/.github/workflows/pr-closed-delete-staging-site.yml @@ -1,6 +1,6 @@ # Deletes the staging docsite folder in the staging bucket on a closed PR -name: PR Closed Delete Bucket +name: PR Closed Delete Staging Site on: pull_request: From 0881cfbc4fa65de951a53199c3940236cbb80959 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 16 Dec 2022 10:04:22 -0500 Subject: [PATCH 10/10] Update pr-closed-delete-staging-site.yml --- .github/workflows/pr-closed-delete-staging-site.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-closed-delete-staging-site.yml b/.github/workflows/pr-closed-delete-staging-site.yml index 063c50a3f..65b9fd1ba 100644 --- a/.github/workflows/pr-closed-delete-staging-site.yml +++ b/.github/workflows/pr-closed-delete-staging-site.yml @@ -14,6 +14,7 @@ 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: @@ -83,7 +84,8 @@ jobs: COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha}} delete_bucket_folder: - name: Delete Bucket + name: Delete Bucket Folder + if: ${{ success() || github.event.pull_request.merged == false }} needs: [cypress_cloudfront] runs-on: ubuntu-latest steps: