Merge pull request #36 from gabito1451/update-root-README-for-fronten… #8
This file contains hidden or 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: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-test: | |
| name: Lint, type-check, test, and build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js 20 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| cache-dependency-path: package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Detect package scripts | |
| id: pkg | |
| run: | | |
| node -e "const fs = require('fs'); const pkg = require('./package.json'); const s = pkg.scripts || {}; const out = [`has_lint=${'lint' in s}`, `has_type_check=${'type-check' in s}`, `has_build=${'build' in s}`, `has_test=${'test' in s}`].join('\n'); fs.appendFileSync(process.env.GITHUB_OUTPUT, out + '\n');" | |
| - name: Run lint | |
| if: steps.pkg.outputs.has_lint == 'true' | |
| run: npm run lint | |
| - name: Run TypeScript type-check | |
| if: steps.pkg.outputs.has_type_check == 'true' | |
| run: npm run type-check | |
| - name: Run tests | |
| if: steps.pkg.outputs.has_test == 'true' | |
| run: npm test | |
| - name: Build app | |
| if: steps.pkg.outputs.has_build == 'true' | |
| run: npm run build |