-
Notifications
You must be signed in to change notification settings - Fork 10
59 lines (54 loc) · 1.77 KB
/
run_codecov_on_pull_request.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: codecov.yml
# Run Codecov on PR open or change
on:
push:
branches:
- main
pull_request:
jobs:
codecov:
runs-on: ubuntu-20.04
steps:
- name: Check out this repository code
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
with:
path: empower
fetch-depth: 0
- name: Install Node
if: github.event_name == 'pull_request'
uses: actions/setup-node@v3
with:
node-version: "18"
# Need to run "npm run build" command for bundle analysis: https://docs.codecov.com/docs/webpack-quick-start
- name: Build React and run tests
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
CI=false ./build.sh
npm test -- --coverage --reporters=jest-junit
working-directory: ./empower/react
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: frontend
- name: Run Python Tests
if: github.event_name == 'pull_request'
run: |
pip install -U pytest
pip install pytz
pip install pytest-codecov
pytest --cov=. --cov-report=xml --junitxml=junit.xml -o junit_family=legacy
working-directory: ./empower/flask/src
- name: Upload coverage results to Codecov
if: github.event_name == 'pull_request'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: api
- name: Upload test results to Codecov
if: ${{ !cancelled() && github.event_name == 'pull_request'}}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- run: echo "Job status is ${{ job.status }}."