feat: update workflow #5
Workflow file for this run
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: CI | |
on: | |
pull_request: | |
branches: [main, develop] | |
push: | |
branches: [main] | |
jobs: | |
test-and-lint: | |
name: Test and Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Security audit | |
run: npm audit | |
- name: Run linting | |
run: npm run lint | |
- name: Run unit tests | |
run: npm run test:unit | |
- name: Run integration tests | |
run: npm run test:integration | |
- name: Generate combined coverage report | |
run: npm run test:coverage | |
- name: Upload coverage reports | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report | |
path: | | |
coverage/ | |
!coverage/lcov-report/** | |
api-tests: | |
name: API Tests | |
needs: test-and-lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build application | |
run: npm run build | |
- name: Start test server | |
run: npm run start:test & sleep 5 | |
- name: Run API tests | |
run: npm run test:api | |
- name: Stop test server | |
if: always() | |
run: npm run stop:test | |
- name: Upload API test coverage | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: api-coverage | |
path: | | |
coverage/ | |
!coverage/lcov-report/** | |