Skip to content

Commit

Permalink
Add intentional integration test failure to test rollback step
Browse files Browse the repository at this point in the history
  • Loading branch information
arnellebalane committed Feb 8, 2024
1 parent d1559db commit d3f00a7
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 62 deletions.
122 changes: 61 additions & 61 deletions .github/workflows/deploy-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,76 +5,76 @@ on:
- main

jobs:
check-lighthouse-scores:
name: Check lighthouse scores
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci
- run: cp .env.ci .env
- run: npm run build -- --mode=test
- run: npm run lhci -- --upload.token=$LHCI_BUILD_TOKEN
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
LHCI_BUILD_TOKEN: ${{ secrets.LHCI_BUILD_TOKEN }}
# check-lighthouse-scores:
# name: Check lighthouse scores
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: 18
# - run: npm ci
# - run: cp .env.ci .env
# - run: npm run build -- --mode=test
# - run: npm run lhci -- --upload.token=$LHCI_BUILD_TOKEN
# env:
# LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
# LHCI_BUILD_TOKEN: ${{ secrets.LHCI_BUILD_TOKEN }}

run-unit-tests:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cypress-io/github-action@v6
with:
component: true
browser: chrome
# run-unit-tests:
# name: Run unit tests
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: cypress-io/github-action@v6
# with:
# component: true
# browser: chrome

deploy-to-production:
name: Deploy to production
runs-on: ubuntu-latest
needs: [check-lighthouse-scores, run-unit-tests]
environment: production
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci
- run: npm run build
env:
VITE_PUBLIC_FUNCTIONS_URL: ${{ vars.VITE_PUBLIC_FUNCTIONS_URL }}
VITE_PUBLIC_IS_WEB_BUILD: ${{ vars.VITE_PUBLIC_IS_WEB_BUILD }}
VITE_PUBLIC_SENTRY_DSN: ${{ vars.VITE_PUBLIC_SENTRY_DSN }}
VITE_PUBLIC_SENTRY_ENVIRONMENT: ${{ vars.VITE_PUBLIC_SENTRY_ENVIRONMENT }}
FUNCTIONS_SENTRY_ENVIRONMENT: ${{ vars.FUNCTIONS_SENTRY_ENVIRONMENT }}
- uses: netlify/actions/cli@master
with:
args: deploy --prod
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
# deploy-to-production:
# name: Deploy to production
# runs-on: ubuntu-latest
# needs: [check-lighthouse-scores, run-unit-tests]
# environment: production
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: 18
# - run: npm ci
# - run: npm run build
# env:
# VITE_PUBLIC_FUNCTIONS_URL: ${{ vars.VITE_PUBLIC_FUNCTIONS_URL }}
# VITE_PUBLIC_IS_WEB_BUILD: ${{ vars.VITE_PUBLIC_IS_WEB_BUILD }}
# VITE_PUBLIC_SENTRY_DSN: ${{ vars.VITE_PUBLIC_SENTRY_DSN }}
# VITE_PUBLIC_SENTRY_ENVIRONMENT: ${{ vars.VITE_PUBLIC_SENTRY_ENVIRONMENT }}
# FUNCTIONS_SENTRY_ENVIRONMENT: ${{ vars.FUNCTIONS_SENTRY_ENVIRONMENT }}
# - uses: netlify/actions/cli@master
# with:
# args: deploy --prod
# env:
# NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
# NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

run-integration-tests:
name: Run integration tests
runs-on: ubuntu-latest
needs: [deploy-to-production]
# needs: [deploy-to-production]
environment: production
steps:
- uses: actions/checkout@v4
- uses: cypress-io/github-action@v6
with:
record: true
browser: chrome
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
APP_TESTING_ENDPOINT: ${{ vars.APP_TESTING_ENDPOINT }}
- if: ${{ failure() }}
uses: netlify/actions/cli@master
# - uses: actions/checkout@v4
# - uses: cypress-io/github-action@v6
# with:
# # record: true
# browser: chrome
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# APP_TESTING_ENDPOINT: ${{ vars.APP_TESTING_ENDPOINT }}
# - if: ${{ failure() }}
- uses: netlify/actions/cli@master
with:
args: api rollbackSiteDeploy --data '{"site_id":"${{ env.NETLIFY_SITE_ID }}"}'
args: api rollbackSiteDeploy --data "{\"site_id\":\"$NETLIFY_SITE_ID\"}"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
2 changes: 1 addition & 1 deletion cypress/integration/backgrounds.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('backgrounds', () => {
cy.get('[data-cy="settings-form-submit-btn"]').click();
cy.reload();

cy.get('body').should('have.attr', 'data-background');
cy.get('body').should('have.attr', 'not.data-background');
});

it('can specify custom unsplash image as background image', () => {
Expand Down

0 comments on commit d3f00a7

Please sign in to comment.