Stage 4 – Coursework review and evaluation #16
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: Frontend CI | |
on: | |
pull_request: | |
paths: | |
- 'react-frontend/**' | |
jobs: | |
dependencies: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
- uses: actions/cache@v3 | |
id: cache-node-modules | |
with: | |
path: react-frontend/node_modules | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('react-frontend/package-lock.json') }} | |
- run: npm install | |
working-directory: react-frontend | |
lint: | |
runs-on: ubuntu-latest | |
needs: dependencies | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
- uses: actions/cache@v3 | |
with: | |
path: react-frontend/node_modules | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('react-frontend/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node_modules- | |
- run: npm run lint | |
working-directory: react-frontend | |
build: | |
runs-on: ubuntu-latest | |
needs: lint | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
- uses: actions/cache@v3 | |
with: | |
path: react-frontend/node_modules | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('react-frontend/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node_modules- | |
- run: npm run build | |
working-directory: react-frontend | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: react-frontend/dist |