Dev #129
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: CI | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| pull_request: | |
| branches: | |
| - main | |
| release: | |
| types: [created] | |
| jobs: | |
| black: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install Black | |
| run: pip install black | |
| - name: Run Black | |
| run: black --check --verbose -- . | |
| pylint: | |
| runs-on: ubuntu-22.04 | |
| needs: black | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install Pylint | |
| run: | | |
| pip install pylint | |
| - name: Run Pylint | |
| run: find . -type f -name "*.py" | xargs pylint --disable=import-error,missing-module-docstring,invalid-name,not-callable,duplicate-code --load-plugins=pylint.extensions.docparams | |
| tests: | |
| runs-on: ubuntu-22.04 | |
| container: | |
| image: ghcr.io/bastien-mva/docker_image:latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install package locally and run tests | |
| run: | | |
| pip install '.[tests]' | |
| pip install -e . | |
| jupyter nbconvert Getting_started.ipynb --to python --output tests/untestable_getting_started | |
| cd tests | |
| python _create_readme_getting_started_and_docstrings_tests.py | |
| pytest --cov --cov-branch --cov-report=xml . | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| build_package: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install build | |
| run: pip install build | |
| - name: Build package | |
| run: | | |
| rm -rf dist/ | |
| python -m build | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| publish_package: | |
| runs-on: ubuntu-22.04 | |
| needs: | |
| - build_package | |
| - tests | |
| if: github.event_name == 'release' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install Twine | |
| run: pip install twine | |
| - name: download artifacts and publish | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Publish package | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPLN_TOKEN }} | |
| run: python -m twine upload dist/* | |
| pages: | |
| runs-on: ubuntu-22.04 | |
| # needs: publish_package | |
| # if: github.event_name == 'release' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install dependencies | |
| run: pip install '.[build-doc]' | |
| - name: Install Pandoc | |
| run: | | |
| wget https://github.com/jgm/pandoc/releases/download/1.15.1/pandoc-1.15.1-1-amd64.deb | |
| sudo dpkg -i pandoc-1.15.1-1-amd64.deb | |
| - name: Convert README | |
| run: | | |
| pandoc README.md --from markdown --to rst -s -o docs/source/readme.rst | |
| echo "HEEEEEERE" | |
| cat docs/source/readme.rst | |
| - name: Build docs | |
| run: | | |
| pip install . | |
| pip install quarto-cli | |
| cd docs/source/tutorials/ | |
| quarto render | |
| cd ../../../ | |
| make -C docs html | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs/build/html |