Updated frontend tests #165
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: Build and Test Frontend | |
on: | |
pull_request: | |
branches: | |
- main | |
- dev | |
permissions: | |
contents: read | |
actions: read | |
jobs: | |
test-frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
- name: Cache Node.js modules | |
uses: actions/cache@v3 | |
with: | |
path: frontend/node_modules | |
key: ${{ runner.os }}-frontend-node-${{ hashFiles('frontend/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-frontend-node- | |
- name: Install dependencies | |
working-directory: frontend | |
run: npm install | |
- name: Lint | |
working-directory: frontend | |
run: npm run lint | |
- name: Cache Next.js build | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.npm | |
${{ github.workspace }}/frontend/.next/cache | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('frontend/package-lock.json') }}-${{ hashFiles('frontend/**/*.{js,jsx,ts,tsx}') }} | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('frontend/package-lock.json') }}- | |
- name: Build | |
working-directory: frontend | |
run: npm run build | |
- name: Test | |
working-directory: frontend | |
run: npm test |