This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Documentation and Code Coverage | |
on: | |
push: | |
pull_request: | |
types: | |
- closed | |
branches: | |
- main | |
jobs: | |
run: | |
name: Build documentation on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- uses: tlylt/install-graphviz@v1 | |
- name: Install pandoc | |
run: sudo apt-get install -y pandoc protobuf-compiler | |
- name: Install requirements | |
run: python -m pip install -r requirements.txt | |
- name: Install requirements dev | |
run: python -m pip install -r requirements-dev.txt | |
- name: Cache pip | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
${{ runner.os }}- | |
- name: protobuf version | |
run: | | |
protoc --version | |
python -c "import google.protobuf as gp;print(gp.__version__)" | |
- name: Generate coverage report | |
run: | | |
pip install pytest | |
pip install pytest-cov | |
export PYTHONPATH=. | |
pytest --cov=./teachpyx/ --cov-report=xml --durations=10 --ignore-glob=**LONG*.py --ignore-glob=**notebook*.py --ignore-glob=**pygame*.py | |
export PYTHONPATH= | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
# - name: Install | |
# run: python setup.py install | |
- name: Copy license | |
run: cp LICENSE* ./_doc | |
- name: Copy changelogs | |
run: cp CHANGELOGS* ./_doc | |
- name: Documentation | |
run: | | |
export PYTHONPATH=. | |
python -m sphinx ./_doc ./dist/html -n -w doc.txt | |
- name: Summary | |
run: cat doc.txt | |
- name: Check for errors and warnings | |
run: | | |
if [[ $(grep ERROR doc.txt) ]]; then | |
echo "Documentation produces errors." | |
grep ERROR doc.txt | |
exit 1 | |
fi | |
if [[ $(grep WARNING doc.txt | grep -v 'download' | grep -v 'CERTIFICATE_VERIFY_FAILED') ]]; then | |
echo "Documentation produces warnings." | |
cat doc.txt | grep WARNING | grep -v 'CERTIFICATE_VERIFY_FAILED' | grep -v 'download' | |
exit 1 | |
fi | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./dist/html/** |