Repository navigation
chore: add test harness and linting. #1
Workflow file for this run
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: Tests | |
| on: | |
| push: | |
| branches: [ main, develop, 'feat/**' ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| jobs: | |
| unit-tests: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run unit tests | |
| run: npm run test:unit | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v3 | |
| if: always() | |
| with: | |
| files: ./coverage/lcov.info | |
| flags: unit | |
| integration-tests: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| services: | |
| mock-api: | |
| image: ghcr.io/quantcdn/quant-mock-api:4.0.0 | |
| ports: | |
| - 4010:4010 | |
| options: >- | |
| --health-cmd "nc -z 127.0.0.1 4010" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Wait for mock API | |
| run: | | |
| timeout 30 sh -c 'until curl -f http://localhost:4010/ 2>/dev/null; do sleep 1; done' | |
| - name: Run integration tests | |
| env: | |
| MOCK_API_URL: http://localhost:4010 | |
| run: npm run test:integration | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v3 | |
| if: always() | |
| with: | |
| files: ./coverage/lcov.info | |
| flags: integration | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run linter | |
| run: npm run lint | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Check dist files | |
| run: | | |
| if [ ! -f "dist/index.js" ]; then | |
| echo "Build failed: dist/index.js not found" | |
| exit 1 | |
| fi | |