Skip to content

Commit 9f64423

Browse files
Merge pull request #2 from pollen-robotics/1-actions-specific-to-this-project
fix #1 : add secret gist for coverage badage
2 parents 3b60129 + c7e4a6e commit 9f64423

File tree

3 files changed

+90
-1
lines changed

3 files changed

+90
-1
lines changed

.github/workflows/lint.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Linter
2+
3+
on: [push]
4+
5+
jobs:
6+
7+
black:
8+
runs-on: ubuntu-20.04
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: psf/black@stable
12+
with:
13+
options: "--check --verbose"
14+
15+
flake8:
16+
runs-on: ubuntu-20.04
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Set up Python 3.8
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: "3.8"
23+
cache: 'pip' # caching pip dependencies
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install flake8
28+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
29+
- name: Lint with flake8
30+
run: |
31+
# stop the build if there are Python syntax errors or undefined names
32+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
33+
# option --exit-zero can be added to this line to set these errors as warnings
34+
flake8 . --count --max-complexity=10 --max-line-length=128 --statistics

.github/workflows/pytest.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Pytest
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
tests:
7+
8+
runs-on: ubuntu-20.04
9+
10+
steps:
11+
- uses: actions/checkout@v3
12+
- name: Set up Python 3.8
13+
uses: actions/setup-python@v4
14+
with:
15+
python-version: "3.8"
16+
cache: 'pip' # caching pip dependencies
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install pytest coverage
21+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
22+
- name: Unit tests
23+
run: |
24+
coverage run -m pytest
25+
coverage xml
26+
coverage json
27+
coverage html
28+
- name: Archive code coverage html report
29+
uses: actions/upload-artifact@v3
30+
with:
31+
name: code-coverage-report
32+
path: htmlcov
33+
- name: Get Cover
34+
uses: orgoro/coverage@v3
35+
with:
36+
coverageFile: coverage.xml
37+
token: ${{ secrets.GITHUB_TOKEN }}
38+
- name: Extract results
39+
run: |
40+
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
41+
echo "total=$TOTAL" >> $GITHUB_ENV
42+
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY
43+
- name: Make badge
44+
uses: schneegans/[email protected]
45+
with:
46+
# GIST_TOKEN is a GitHub personal access token with scope "gist".
47+
auth: ${{ secrets.GIST_TOKEN }}
48+
gistID: 58642e8fe4589e710e26627e39ff92d7 # replace with your real Gist id.
49+
filename: covbadge.json
50+
label: Coverage
51+
message: ${{ env.total }}%
52+
minColorRange: 50
53+
maxColorRange: 90
54+
valColorRange: ${{ env.total }}
55+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Template code and examples for python project respecting the [PEP8 coding style]
1212

1313
A *.gitignore* file makes sure that the Python temporary files are not committed. It is adapted from [here](https://github.com/github/gitignore/blob/main/Python.gitignore).
1414

15-
git LFS is configured to handle all non script files (3D models, deep learning model, images, etc.). The list of file is defined in *.gitattributes.* Also, a good practice is to use another repo as a submodule containing all the data.
15+
git LFS could be configured to handle all non script files (3D models, deep learning model, images, etc.). The list of file is defined in *gitattributes_example.* If you want to use LFS rename this file *.gitattributes*. Then run ```git lfs install```. Also, a good practice is to use another repo as a submodule containing all the data.
1616

1717
A git hook can be installed to automatically checks PEP8 compliance before a commit. See *scripts/git_hooks*.
1818

0 commit comments

Comments
 (0)