Skip to content

Commit

Permalink
ci: github action and codeclimate coverage report (#42)
Browse files Browse the repository at this point in the history
* ci: github action and codeclimate coverage report

* ci: temporarily disable unittest for Python 3.11

issue already reported to upstream project:
- PeterDing/BaiduPCS-Py#113
  • Loading branch information
xyb authored Mar 22, 2023
1 parent 0c8da3b commit 326ec5d
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, "3.10"]
os:
- ubuntu
#- macOS
#- windows

name: tests
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- run: pip install -r requirements-test.txt

- name: run tests
run: |
make coverage
- name: Send coverage report to codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml

- name: Send coverage report to codeclimate
uses: paambaati/codeclimate-action@v3.2.0
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pre-commit:
pre-commit run --all-files

test: unittest

unittest:
pytest

coverage:
pytest --cov-report html --cov-report xml
4 changes: 4 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[pytest]
DJANGO_SETTINGS_MODULE = baidupcsleecher.settings
python_files = tests.py test_*.py *_tests.py
addopts = -ra --doctest-modules --last-failed --durations=3 --cov --cov-report term-missing

0 comments on commit 326ec5d

Please sign in to comment.