forked from eshaan-test-org/demo-python-1
-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (84 loc) · 3.81 KB
/
CI.yml
File metadata and controls
100 lines (84 loc) · 3.81 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: CI
on:
pull_request:
workflow_dispatch:
push:
branches:
- master
jobs:
run-tests:
runs-on: [ubuntu-latest]
env:
DEEPSOURCE_DSN_DEV: ${{ secrets.DEEPSOURCE_DSN_DEV }}
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
DEEPSOURCE_DSN_ENTERPRISE_DEV: ${{ secrets.DEEPSOURCE_DSN_ENTERPRISE_DEV }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 1
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up python3.9
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Run tests
run: |
pip install pytest-cov django
coverage run -m pytest tests/test_code.py
coverage xml -o coverage.xml
coverage erase
coverage run -m pytest tests/test_code2.py
coverage xml -o coverage2.xml
coverage erase
# - name: Report test coverage to DeepSource dev (python)
# run: |
# curl https://deepsource.io/cli | sh
# export DEEPSOURCE_DSN=$DEEPSOURCE_DSN_DEV
# # create python artifact
# ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml
# # create another python artifact
# ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage2.xml
# # existing python artifact with same file so update only
# ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml
- name: Report test coverage to DeepSource cloud (go)
if: github.event_name != 'pull_request'
run: |
curl https://deepsource.io/cli | sh
export DEEPSOURCE_DSN=$DEEPSOURCE_DSN
# create go artifact
./bin/deepsource report --analyzer test-coverage --key go --value-file ./go_coverage.out
- name: Report test coverage to DeepSource cloud (python)
run: |
curl https://deepsource.io/cli | sh
export DEEPSOURCE_DSN=$DEEPSOURCE_DSN
# create python artifact
./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml
# create another python artifact
./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage2.xml
# existing python artifact with same file so update only
./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml
# - name: Report test coverage to DeepSource dev (go)
# if: github.event_name != 'pull_request'
# run: |
# curl https://deepsource.io/cli | sh
# export DEEPSOURCE_DSN=$DEEPSOURCE_DSN_DEV
# # create go artifact
# ./bin/deepsource report --analyzer test-coverage --key go --value-file ./go_coverage.out
# - name: Report test coverage to DeepSource enterprise-dev (python)
# run: |
# curl https://deepsource.io/cli | sh
# export DEEPSOURCE_DSN=$DEEPSOURCE_DSN_ENTERPRISE_DEV
# # create python artifact
# ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml
# # create another python artifact
# ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage2.xml
# # existing python artifact with same file so update only
# ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml
# - name: Report test coverage to DeepSource enterprise-dev (go)
# if: github.event_name != 'pull_request'
# run: |
# curl https://deepsource.io/cli | sh
# export DEEPSOURCE_DSN=$DEEPSOURCE_DSN_ENTERPRISE_DEV
# # create go artifact
# ./bin/deepsource report --analyzer test-coverage --key go --value-file ./go_coverage.out