Failsafe Page Generation #1333
This file contains 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
name: Failsafe Page Generation | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
schedule: | |
# 18:00 GMT+8 every day | |
- cron: '0 10 * * *' | |
env: | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
jobs: | |
wait-for-deployment: | |
uses: ./.github/workflows/vercel-deployment.yml | |
if: (github.event_name == 'push' || github.event_name == 'pull_request') && (github.actor != 'dependabot[bot]') | |
secrets: | |
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
failsafe-generation-stage: | |
name: Failsafe Page Generation (Stage Deployment) | |
runs-on: macos-12 # use macos for failsafe visual test | |
if: contains(github.ref, 'refs/pull') | |
needs: wait-for-deployment | |
env: | |
NEXT_PUBLIC_APP_ENV: stage | |
VERCEL_URL: ${{ needs.wait-for-deployment.outputs.vercel-deployment-url }} | |
steps: | |
- name: Checkout project source | |
uses: actions/checkout@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16.x | |
- name: Install dependency | |
run: npm install --legacy-peer-deps | |
- name: Run failsafe generation | |
run: npm run task:failsafe | |
- name: Install playwright browsers | |
run: npx playwright install --with-deps | |
- name: Run failsafe e2e tests | |
run: npm run test:e2e:failsafe | |
- uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: stage-deployment-failsafe-test-report | |
path: | | |
e2e-failsafe-report | |
artifacts/e2e-test-results | |
retention-days: 14 | |
failsafe-generation-production: | |
name: Failsafe Page Generation (Production Deployment) | |
runs-on: macos-12 # use macos for failsafe visual test | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
needs: wait-for-deployment | |
env: | |
NEXT_PUBLIC_APP_ENV: production | |
steps: | |
- name: Checkout project source | |
uses: actions/checkout@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16.x | |
- name: Install dependency | |
run: npm install --legacy-peer-deps | |
- name: Run failsafe generation | |
run: npm run task:failsafe | |
- name: Install playwright browsers | |
run: npx playwright install --with-deps | |
- name: Run failsafe e2e tests | |
run: npm run test:e2e:failsafe | |
- uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: production-deployment-failsafe-test-report | |
path: | | |
e2e-failsafe-report | |
artifacts/e2e-test-results | |
retention-days: 14 | |
failsafe-generation-production-schedule: | |
name: Failsafe Page Generation (Production Schedule) | |
runs-on: macos-12 # use macos for failsafe visual test | |
# skip waiting for deployment for production schedule generation | |
if: github.ref == 'refs/heads/main' && github.event_name == 'schedule' | |
env: | |
NEXT_PUBLIC_APP_ENV: production | |
steps: | |
- name: Checkout project source | |
uses: actions/checkout@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16.x | |
- name: Install dependency | |
run: npm install --legacy-peer-deps | |
- name: Run failsafe generation | |
run: npm run task:failsafe | |
- name: Install playwright browsers | |
run: npx playwright install --with-deps | |
- name: Run failsafe e2e tests | |
run: npm run test:e2e:failsafe | |
- uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: production-schedule-failsafe-test-report | |
path: | | |
e2e-failsafe-report | |
artifacts/e2e-test-results | |
retention-days: 14 |