Replace Azure Pipelines CI with GitHub Actions #295
Workflow file for this run
This file contains hidden or 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: | |
| build_wheels: | |
| name: Build documentation on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: tlylt/install-graphviz@v1 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install pandoc | |
| run: sudo apt-get install pandoc | |
| - name: Install requirements | |
| run: python -m pip install -r requirements.txt | |
| - name: Install requirements-dev.txt | |
| run: python -m pip install -r requirements-dev.txt | |
| - name: Cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| ${{ runner.os }}- | |
| - name: Generate coverage report | |
| run: | | |
| pip install pytest | |
| pip install pytest-cov | |
| export PYTHONPATH=. | |
| pytest --cov=./sphinx_runpython/ --cov-report=xml --durations=10 --ignore-glob=**LONG*.py --ignore-glob=**notebook*.py | |
| export PYTHONPATH= | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v4 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Install | |
| run: python -m pip install -e . | |
| - name: Copy files | |
| run: | | |
| cp LICENSE* ./_doc | |
| cp CHANGELOGS* ./_doc | |
| - name: Documentation HTML | |
| run: python -m sphinx ./_doc ./dist/html -n -w doc.txt | |
| - name: Summary HTML | |
| 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 'term not in glossary') ]]; then | |
| echo "Documentation produces warnings." | |
| grep WARNING doc.txt | grep -v 'term not in glossary' | |
| exit 1 | |
| fi | |
| - name: Documentation RST | |
| run: python -m sphinx -b rst ./_doc ./dist/rst -n -w doc.txt | |
| - name: Summary RST | |
| 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 'term not in glossary') ]]; then | |
| echo "Documentation produces warnings." | |
| grep WARNING doc.txt | grep -v 'term not in glossary' | |
| exit 1 | |
| fi | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| path: ./dist/** |