Upgraded dependencies #17
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: Testing | |
on: | |
pull_request: | |
branches: [main] | |
concurrency: | |
# Rerun check when the PR is updated, https://stackoverflow.com/a/72408109 | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
DATABASE_HOST: ${{ secrets.DATABASE_HOST }} | |
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }} | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
DATABASE_USERNAME: ${{ secrets.DATABASE_USERNAME }} | |
NEXT_PUBLIC_GOOGLE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_MEASUREMENT_ID }} | |
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }} | |
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }} | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
node-version: [18] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache build folder | |
uses: actions/cache@v3 | |
with: | |
# See here for caching with `yarn` https://github.com/actions/cache/blob/main/examples.md#node---yarn or you can leverage caching with actions/setup-node https://github.com/actions/setup-node | |
path: | | |
~/.npm | |
${{ github.workspace }}/.next/cache | |
# Generate a new cache whenever packages or source files change. | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }} | |
# If source files changed but packages didn't, rebuild from a prior cache. | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}- | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install | |
- name: Cypress run | |
uses: cypress-io/github-action@v6 | |
with: | |
runTests: false | |
build: pnpm build | |
- name: Save build folder | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
if-no-files-found: error | |
path: ${{ github.workspace }}/.next | |
cypress-run-e2e: | |
name: Cypress End-to-End | |
runs-on: ubuntu-22.04 | |
needs: build | |
strategy: | |
matrix: | |
node-version: [18] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download the build folder | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: ${{ github.workspace }}/.next | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install | |
- name: Cypress run | |
uses: cypress-io/github-action@v6 | |
with: | |
# component: true | |
start: pnpm start | |
wait-on: http://localhost:3000 | |
cypress-run-component: | |
name: Cypress Component | |
runs-on: ubuntu-22.04 | |
needs: build | |
strategy: | |
matrix: | |
node-version: [18] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download the build folder | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: ${{ github.workspace }}/.next | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install | |
- name: Cypress run | |
uses: cypress-io/github-action@v6 | |
with: | |
component: true |