Fix GHA dependencies and add lint job #2
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 Tests | ||
on: [push, pull_request] | ||
jobs: | ||
Doc: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements_dev.txt | ||
pip install -r dev/requirements.txt | ||
- name: Build doc | ||
run: | | ||
cd doc && make html | ||
cd .. | ||
CheckDocs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements_dev.txt | ||
pip install -r doc/requirements.txt | ||
- name: Check doc build | ||
run: | | ||
cd doc | ||
make html SPHINXOPTS="-W" | ||
cd .. | ||
- name: Check doc coverage | ||
run: | | ||
cd doc | ||
make coverage | ||
cat build/coverage/python.txt | ||
cat build/coverage/python.txt | wc -l | xargs -I % test % -eq 2 | ||
cd .. | ||
- name: Check doc links | ||
run: | | ||
cd doc | ||
make linkcheck | ||
cd .. | ||
Doc: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
bash ./.github/scripts/install_libiio.sh | ||
bash ./.github/scripts/install_part_libs.sh | ||
bash ./.github/scripts/install_pydeps.sh | ||
pip install -r requirements_doc.txt | ||
- name: Build doc | ||
run: | | ||
cd doc && make html | ||
cd .. | ||
DeployMainDoc: | ||
runs-on: ubuntu-latest | ||
needs: [CheckDocs, Doc] | ||
if: github.ref == 'refs/heads/main' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements_dev.txt | ||
pip install -r doc/requirements.txt | ||
- name: Build doc and release | ||
run: | | ||
cd doc && make html | ||
cd .. | ||
- name: Publish doc | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./doc/build/html | ||
destination_dir: main | ||
DeployDevelopmentDoc: | ||
runs-on: ubuntu-latest | ||
needs: [CheckDocs, Doc] | ||
# Only run on pull requests to main and non-forks | ||
if: github.event_name == 'pull_request' && github.base_ref == 'main' && ! github.event.pull_request.head.repo.fork | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements_dev.txt | ||
pip install -r doc/requirements.txt | ||
- name: Build doc and release | ||
run: | | ||
export GIT_BRANCH=${{ github.head_ref }} | ||
export DEV_BUILD=1 | ||
cd doc && make html | ||
cd .. | ||
- name: Publish doc | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./doc/build/html | ||
destination_dir: prs/${{ github.head_ref }} | ||
- name: Add comment to PR | ||
uses: mshick/add-pr-comment@v2 | ||
with: | ||
message: | | ||
Generated documentation for this PR is available at [Link](https://analogdevicesinc.github.io/pyadi-iio/prs/${{ github.head_ref }}/index.html) | ||
Deploy: | ||
runs-on: ubuntu-latest | ||
needs: [Test,Lint,Doc] | ||
Check failure on line 151 in .github/workflows/doc.yml GitHub Actions / Documentation TestsInvalid workflow file
|
||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements_dev.txt | ||
pip install -r doc/requirements.txt | ||
pip install setuptools wheel twine build | ||
- name: Build doc and release | ||
run: | | ||
cd doc && make html | ||
cd .. | ||
python -m build | ||
- name: Publish doc | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./doc/build/html | ||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_TOKEN }} |