chore(format): re-ran prettier #139
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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Main Workflow | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
validate: | |
name: Validate Using Latest Node LTS | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: pnpm | |
- name: Run Lint and Typecheck | |
uses: cypress-io/github-action@v5 | |
with: | |
runTests: false | |
- run: pnpm install --frozen-lockfile | |
- run: pnpm lint | |
- run: pnpm typecheck | |
build: | |
name: Build website | |
runs-on: ubuntu-latest | |
container: | |
image: cypress/browsers:node18.6.0-chrome105-ff104 | |
options: --user 1001 | |
needs: validate | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: pnpm | |
- name: Download build cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ github.workspace }}/.next/cache | |
# Generate a new cache whenever packages or source files change. | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx', '**.scss') }} | |
# If source files changed but packages didn't, rebuild from a prior cache. | |
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}- | |
- name: Build website | |
uses: cypress-io/github-action@v5 | |
with: | |
runTests: false | |
- run: pnpm build | |
- name: Save build folder | |
uses: actions/upload-artifact@v3 | |
with: | |
name: out | |
if-no-files-found: error | |
path: out | |
deploy: | |
name: Deploy to mlaursen.com | |
if: ${{ github.ref == 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# this is required so that the github-pages-deploy-action works | |
# for some reason | |
with: | |
persist-credentials: false | |
- name: Download build folder | |
uses: actions/download-artifact@v3 | |
with: | |
name: out | |
path: out | |
- name: Deploy to gh-pages | |
uses: JamesIves/github-pages-deploy-action@v4.4.1 | |
with: | |
branch: gh-pages | |
folder: out | |
test-chrome-prod: | |
name: Test Chrome (Prod) | |
runs-on: ubuntu-latest | |
container: | |
image: cypress/browsers:node18.6.0-chrome105-ff104 | |
options: --user 1001 | |
needs: deploy | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: pnpm | |
- name: "Cypress Tests - Chrome" | |
uses: cypress-io/github-action@v5 | |
with: | |
browser: chrome | |
record: true | |
config: baseUrl=https://mlaursen.com | |
spec: cypress/e2e/* | |
group: "UI - Chrome" | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: chrome-cypress-screenshots | |
path: cypress/screenshots | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: chrome-cypress-videos | |
path: cypress/videos | |
test-firefox-prod: | |
name: Test Firefox (Prod) | |
runs-on: ubuntu-latest | |
container: | |
image: cypress/browsers:node18.6.0-chrome105-ff104 | |
options: --user 1001 | |
needs: deploy | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: pnpm | |
- name: "Cypress Tests - Firefox" | |
uses: cypress-io/github-action@v5 | |
with: | |
browser: firefox | |
record: true | |
config: baseUrl=https://mlaursen.com | |
spec: cypress/e2e/* | |
group: "UI - Firefox" | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: firefox-cypress-screenshots | |
path: cypress/screenshots | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: firefox-cypress-videos | |
path: cypress/videos | |
test-chrome-local: | |
name: Test Chrome (Local) | |
if: ${{ github.ref != 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
container: | |
image: cypress/browsers:node18.6.0-chrome105-ff104 | |
options: --user 1001 | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: pnpm | |
- name: Download the build folders | |
uses: actions/download-artifact@v3 | |
with: | |
name: out | |
path: out | |
- name: "Cypress Tests - Chrome" | |
uses: cypress-io/github-action@v5 | |
with: | |
start: pnpm start-static | |
wait-on: "http://localhost:3000" | |
browser: chrome | |
record: true | |
spec: cypress/e2e/* | |
group: "UI - Chrome" | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }} | |
COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }} | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: chrome-cypress-screenshots | |
path: cypress/screenshots | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: chrome-cypress-videos | |
path: cypress/videos | |
test-firefox-local: | |
name: Test Firefox (Local) | |
if: ${{ github.ref != 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
container: | |
image: cypress/browsers:node18.6.0-chrome105-ff104 | |
options: --user 1001 | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: pnpm | |
- name: Download the build folders | |
uses: actions/download-artifact@v3 | |
with: | |
name: out | |
path: out | |
- name: "Cypress Tests - Firefox" | |
uses: cypress-io/github-action@v5 | |
with: | |
start: pnpm start-static | |
wait-on: "http://localhost:3000" | |
browser: firefox | |
record: true | |
spec: cypress/e2e/* | |
group: "UI - Firefox" | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }} | |
COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }} | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: firefox-cypress-screenshots | |
path: cypress/screenshots | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: firefox-cypress-videos | |
path: cypress/videos |