Skip to content

Commit 08d0e6b

Browse files
committed
Introduce workflow for codecov upload
1 parent 4801d37 commit 08d0e6b

File tree

2 files changed

+60
-18
lines changed

2 files changed

+60
-18
lines changed

.github/workflows/ci.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Code Coverage
2+
3+
on:
4+
pull_request:
5+
branches: [ main, prod-beta, prod-stable, stage-beta, stage-stable ]
6+
push:
7+
branches: [ main ]
8+
9+
env:
10+
BRANCH: ${{ github.base_ref }}
11+
12+
jobs:
13+
build:
14+
name: koku-ui codecov
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
node-version: [18]
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
28+
- name: Cache node modules
29+
id: cache-npm
30+
uses: actions/cache@v4
31+
env:
32+
cache-name: cache-node-modules
33+
with:
34+
# npm cache files are stored in `~/.npm` on Linux/macOS
35+
path: ~/.npm
36+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
37+
restore-keys: |
38+
${{ runner.os }}-build-${{ env.cache-name }}-
39+
${{ runner.os }}-build-
40+
${{ runner.os }}-
41+
42+
- name: Install dependencies
43+
run: npm install
44+
45+
- name: Test
46+
run: npm test -- --collect-coverage --max-workers=4
47+
48+
- name: Upload coverage report
49+
if: ${{ success() }}
50+
uses: codecov/codecov-action@v4.2.0
51+
env:
52+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
53+
with:
54+
directory: coverage
55+
plugin: pycoverage # Only run one plugin so that all do not run. There is no way to disable plugins entirely.
56+

.github/workflows/pull_request.yml

+4-18
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
name: Pull request
2+
23
on:
34
pull_request:
4-
branches:
5-
- main
6-
- master
7-
- prod-beta
8-
- prod-stable
9-
- stage-beta
10-
- stage-stable
5+
branches: [ main, prod-beta, prod-stable, stage-beta, stage-stable ]
6+
117
env:
128
BRANCH: ${{ github.base_ref }}
139

@@ -53,14 +49,4 @@ jobs:
5349

5450
- name: Test
5551
if: ${{ success() }}
56-
run: npm test -- --collect-coverage --max-workers=4
57-
58-
- name: Upload coverage report
59-
if: ${{ success() }}
60-
uses: codecov/codecov-action@v4.2.0
61-
env:
62-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
63-
with:
64-
directory: coverage
65-
plugin: pycoverage # Only run one plugin so that all do not run. There is no way to disable plugins entirely.
66-
52+
run: npm test

0 commit comments

Comments
 (0)