Merge pull request #340 from paquiteau/modopt-2024 #11
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: CD | |
on: | |
push: | |
branches: | |
- master | |
- main | |
jobs: | |
coverage: | |
name: Deploy Coverage Results | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: pip | |
- name: Install dependencies | |
shell: bash -l {0} | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install twine | |
python -m pip install .[doc,test] | |
- name: Run Tests | |
shell: bash -l {0} | |
run: | | |
pytest | |
- name: Check distribution | |
shell: bash -l {0} | |
run: | | |
twine check dist/* | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: coverage.xml | |
flags: unittests | |
api: | |
name: Deploy API Documentation | |
needs: coverage | |
runs-on: ubuntu-latest | |
if: success() | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
shell: bash -l {0} | |
run: | | |
conda install -c conda-forge pandoc | |
python -m pip install --upgrade pip | |
python -m pip install .[doc] | |
- name: Build API documentation | |
shell: bash -l {0} | |
run: | | |
sphinx-apidoc -t docs/_templates -feTMo docs/source modopt | |
sphinx-build -E docs/source docs/_build | |
- name: Deploy API documentation | |
uses: peaceiris/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: docs/_build |