-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (50 loc) · 1.94 KB
/
codacy.yml
File metadata and controls
60 lines (50 loc) · 1.94 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
name: Client Side Tools and Coverage
on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11 # Choose your Python version
- name: Install dependencies
run: |
sudo apt-get -qq update
sudo apt-get -y -qq install openjdk-8-jdk openjdk-8-jre
pip3 install coverage
pip3 install pytest
- name: Run tests and collect coverage
run: |
# Replace with the actual paths to your test files and source files
coverage run -m pytest /$GITHUB_WORKSPACE/*.py
coverage run -m unittest /$GITHUB_WORKSPACE/*.py
coverage report -m --fail-under=10 # You can set your desired coverage threshold here
continue-on-error: true
- name: Generate coverage XML report
run: |
# Replace with the actual paths to your test files and source files
coverage xml -o $GITHUB_WORKSPACE/coverage.xml
- name: Upload coverage report to Codacy
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
run: |
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r $GITHUB_WORKSPACE/coverage.xml
- name: Run Codacy Analysis CLI with Docker
run: |
export CODACY_CODE=$GITHUB_WORKSPACE
docker run \
--rm=true \
--env CODACY_CODE="$CODACY_CODE" \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume "$CODACY_CODE":"$CODACY_CODE" \
--volume /tmp:/tmp \
codacy/codacy-analysis-cli \
analyze --tool pylint --upload --project-token ${{ secrets.CODACY_PROJECT_TOKEN }} --max-allowed-issues 99999 --commit-uuid $GITHUB_SHA