-
Notifications
You must be signed in to change notification settings - Fork 15
83 lines (77 loc) · 3.12 KB
/
Copy pathci.yml
File metadata and controls
83 lines (77 loc) · 3.12 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
name: CI
on:
- push
- pull_request
- workflow_dispatch
jobs:
ci-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
# - uses: actions/setup-python@v2
# with:
# python-version: '3.9'
- name: Configure Python
run: |
python3 -m pip install ivpm
python3 -m ivpm update -a
./packages/python/bin/python3 -m pip install wheel twine
./packages/python/bin/python3 -m pip install pip setuptools --upgrade
rm -rf dist build *.egg-info src/*.egg-info
sed -i -e "s/^SUFFIX = \"\"$/SUFFIX = \".${GITHUB_RUN_ID}\"/" src/ucis/__version__.py
grep "^SUFFIX = " src/ucis/__version__.py
./packages/python/bin/python3 setup.py bdist_wheel --universal
- name: Run Tests
run: |
./packages/python/bin/python3 -m pip install pytest pytest-cov
./packages/python/bin/python3 -m pip install -e .
./packages/python/bin/python3 -m pytest tests/unit --cov=ucis --cov-report=term-missing --cov-report=html --cov-report=json
- name: Upload Coverage to Summary
if: always()
run: |
# Generate coverage percentage
COVERAGE=$(./packages/python/bin/python3 -c "import json; data=json.load(open('coverage.json')); print(f\"{data['totals']['percent_covered']:.1f}\")")
# Add to GitHub Step Summary
echo "## Test Coverage Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Overall Coverage: ${COVERAGE}%**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Add coverage details
./packages/python/bin/python3 << 'EOF' >> $GITHUB_STEP_SUMMARY
import json
data = json.load(open('coverage.json'))
print("| File | Statements | Missing | Coverage |")
print("|------|------------|---------|----------|")
for file, info in sorted(data['files'].items()):
if 'ucis' in file: # Only show project files
fname = file.split('src/')[-1] if 'src/' in file else file
stmts = info['summary']['num_statements']
missing = info['summary']['missing_lines']
covered = info['summary']['covered_lines']
pct = info['summary']['percent_covered']
print(f"| {fname} | {stmts} | {missing} | {pct:.1f}% |")
EOF
- name: Upload Coverage HTML
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: htmlcov/
- name: Build Docs
run: |
./packages/python/bin/python3 -m pip install -r doc/requirements.txt
make html
touch doc/build/html/.nojekyll
cp -r doc/build/html .
- name: Publish Docs
if: startsWith(github.ref, 'refs/heads/master')
uses: JamesIves/github-pages-deploy-action@4.1.7
with:
branch: gh-pages
folder: html
- name: Publish to PyPi
if: startsWith(github.ref, 'refs/heads/master')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}