|
1 |
| -name: CI |
| 1 | +name: Run Tests |
2 | 2 | on:
|
3 | 3 | push:
|
4 | 4 | branches:
|
|
11 | 11 | workflow_dispatch:
|
12 | 12 | jobs:
|
13 | 13 | build:
|
14 |
| - name: Build, lint, and test on Node 18.12.1 and ${{ matrix.os }} |
| 14 | + name: Build, lint, and test on Node ${{ matrix.node-version }} and ${{ matrix.os }} |
15 | 15 |
|
16 | 16 | runs-on: ${{ matrix.os }}
|
17 | 17 | strategy:
|
18 | 18 | matrix:
|
19 |
| - os: [ macOS-latest, ubuntu-latest] |
| 19 | + os: [macOS-latest, ubuntu-latest] |
| 20 | + node-version: ['18', '20'] |
20 | 21 |
|
21 | 22 | steps:
|
22 | 23 | - name: Checkout repo
|
23 |
| - uses: actions/checkout@v2 |
| 24 | + uses: actions/checkout@v4 |
24 | 25 |
|
25 |
| - - uses: actions/setup-node@v2 |
| 26 | + - uses: actions/setup-node@v4 |
26 | 27 | with:
|
27 |
| - node-version: '18.12.1' |
| 28 | + node-version: ${{ matrix.node-version }} |
28 | 29 | cache: 'npm'
|
29 | 30 |
|
30 |
| - - name: build |
| 31 | + - name: Install dependencies |
31 | 32 | run: |
|
32 | 33 | npm cache clean --force
|
33 | 34 | npm set registry https://registry.npmjs.org/
|
34 |
| - npm i |
35 |
| - npm test -- --coverage=true |
36 |
| - npm run build |
| 35 | + npm ci |
| 36 | + |
| 37 | + - name: Check formatting |
| 38 | + run: npm run pretty:check |
| 39 | + |
| 40 | + - name: Lint |
| 41 | + run: npm run lint |
| 42 | + |
| 43 | + - name: Test |
| 44 | + run: npm test -- --coverage=true |
| 45 | + |
| 46 | + - name: Build |
| 47 | + run: npm run build |
37 | 48 |
|
38 | 49 | - name: Upload coverage reports to Codecov
|
39 | 50 | uses: codecov/codecov-action@v3
|
40 | 51 | env:
|
41 | 52 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
| 53 | + |
| 54 | + test: |
| 55 | + name: Run integration test |
| 56 | + runs-on: ubuntu-latest |
| 57 | + steps: |
| 58 | + - name: Checkout repo |
| 59 | + uses: actions/checkout@v4 |
| 60 | + |
| 61 | + - uses: actions/setup-node@v4 |
| 62 | + with: |
| 63 | + node-version: '18' |
| 64 | + cache: 'npm' |
| 65 | + - name: install deps |
| 66 | + run: npm ci |
| 67 | + - name: Build |
| 68 | + run: npm run build |
| 69 | + - name: Start dependencies |
| 70 | + run: docker compose up deps --pull always |
| 71 | + - name: Run integration test |
| 72 | + run: npm run test:integration |
| 73 | + - name: Print logs |
| 74 | + run: docker compose logs |
| 75 | + if: always() |
| 76 | + |
| 77 | + audit: |
| 78 | + name: Find vulnerabilities |
| 79 | + runs-on: ubuntu-latest |
| 80 | + steps: |
| 81 | + - name: Checkout repo |
| 82 | + uses: actions/checkout@v4 |
| 83 | + |
| 84 | + - uses: actions/setup-node@v4 |
| 85 | + with: |
| 86 | + node-version: '20' |
| 87 | + cache: 'npm' |
| 88 | + - name: Run audit |
| 89 | + run: npm audit |
0 commit comments