|
1 |
| -name: Code Coverage |
| 1 | +name: CI |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | pull_request:
|
|
8 | 8 |
|
9 | 9 | env:
|
10 | 10 | BRANCH: ${{ github.base_ref }}
|
| 11 | + NODEJS_VERSION: '18' |
11 | 12 |
|
12 | 13 | jobs:
|
13 |
| - build: |
14 |
| - name: koku-ui codecov |
| 14 | + units: |
| 15 | + name: Units |
15 | 16 | runs-on: ubuntu-latest
|
16 |
| - strategy: |
17 |
| - matrix: |
18 |
| - node-version: [18] |
| 17 | + |
19 | 18 | steps:
|
20 | 19 | - name: Checkout code
|
21 | 20 | uses: actions/checkout@v4
|
22 | 21 |
|
23 |
| - - name: Setup Node.js ${{ matrix.node-version }} |
| 22 | + - name: Setup Node.js |
24 | 23 | uses: actions/setup-node@v4
|
25 | 24 | with:
|
26 |
| - node-version: ${{ matrix.node-version }} |
| 25 | + node-version: ${{ env.NODEJS_VERSION }} |
27 | 26 |
|
28 | 27 | - name: Cache node modules
|
29 | 28 | id: cache-npm
|
|
43 | 42 | run: npm install
|
44 | 43 |
|
45 | 44 | - name: Test
|
| 45 | + id: test_run |
46 | 46 | run: npm test -- --collect-coverage --max-workers=4
|
47 | 47 |
|
| 48 | + - uses: actions/upload-artifact@v4 |
| 49 | + if: ${{ steps.test_run.outcome == 'success' }} |
| 50 | + name: Save coverage report |
| 51 | + with: |
| 52 | + name: coverage_report |
| 53 | + path: coverage/ |
| 54 | + retention-days: 10 |
| 55 | + |
| 56 | + |
| 57 | + sanity: |
| 58 | + if: ${{ github.event_name == 'pull_request' }} |
| 59 | + name: Sanity |
| 60 | + runs-on: ubuntu-latest |
| 61 | + |
| 62 | + steps: |
| 63 | + - name: Checkout code |
| 64 | + uses: actions/checkout@v4 |
| 65 | + |
| 66 | + - name: Setup Node.js |
| 67 | + uses: actions/setup-node@v4 |
| 68 | + with: |
| 69 | + node-version: ${{ env.NODEJS_VERSION }} |
| 70 | + |
| 71 | + - name: Cache node modules |
| 72 | + id: cache-npm |
| 73 | + uses: actions/cache@v4 |
| 74 | + env: |
| 75 | + cache-name: cache-node-modules |
| 76 | + with: |
| 77 | + # npm cache files are stored in `~/.npm` on Linux/macOS |
| 78 | + path: ~/.npm |
| 79 | + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
| 80 | + restore-keys: | |
| 81 | + ${{ runner.os }}-build-${{ env.cache-name }}- |
| 82 | + ${{ runner.os }}-build- |
| 83 | + ${{ runner.os }}- |
| 84 | +
|
| 85 | + - name: Install dependencies |
| 86 | + run: npm install |
| 87 | + |
| 88 | + - name: Lint |
| 89 | + run: npm run lint |
| 90 | + |
| 91 | + - name: Build |
| 92 | + run: npm run build |
| 93 | + |
| 94 | + coverage: |
| 95 | + name: Coverage |
| 96 | + needs: [units] |
| 97 | + runs-on: ubuntu-latest |
| 98 | + |
| 99 | + steps: |
| 100 | + - name: Checkout code |
| 101 | + uses: actions/checkout@v4 |
| 102 | + |
| 103 | + - name: Download coverage report |
| 104 | + uses: actions/download-artifact@v4 |
| 105 | + with: |
| 106 | + name: coverage_report |
| 107 | + path: coverage |
| 108 | + |
48 | 109 | - name: Upload coverage report
|
49 | 110 | if: ${{ success() }}
|
50 | 111 | uses: codecov/codecov-action@v4.2.0
|
|
53 | 114 | with:
|
54 | 115 | directory: coverage
|
55 | 116 | plugin: pycoverage # Only run one plugin so that all do not run. There is no way to disable plugins entirely.
|
56 |
| - |
|
0 commit comments