Merge pull request #24 from pulkit-sachdeva-dev/pulkit_sachdeva_footer #5
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: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [18.x] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run lint (if configured) | |
| run: | | |
| if npm run | grep -q "lint"; then | |
| npm run lint | |
| else | |
| echo "No lint script defined, skipping." | |
| fi | |
| - name: Build (if configured) | |
| run: | | |
| if npm run | grep -q "build"; then | |
| npm run build | |
| else | |
| echo "No build script defined, skipping." | |
| fi | |
| - name: Run tests | |
| run: | | |
| if npm run | grep -q "test:ci"; then | |
| npm run test:ci | |
| elif npm run | grep -q "test"; then | |
| npm test -- --run | |
| else | |
| echo "No test script defined, skipping tests." | |
| fi |