Added codecov token for actions #40
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: Build and publish the package to PyPi registry | |
env: | |
PACKAGE_NAME: cluster_conformers | |
on: [ push ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: [3.10.14] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version}} | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install pytest pytest-cov pre-commit | |
pre-commit install | |
- name: Run pre-commit | |
run: pre-commit run --all | |
- name: Run Tests | |
run: | | |
coverage run -m pytest --junitxml=report.xml | |
coverage xml -o coverage/cobertura-coverage.xml | |
coverage report -m | |
- name: Upload coverage to Codecov | |
if: github.ref == 'refs/heads/main' | |
uses: codecov/codecov-action@v1 | |
with: | |
file: ./coverage/cobertura-coverage.xml | |
flags: unittests | |
name: codecov-${{ env.PACKAGE_NAME }} | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
- name: Create distribution | |
if: github.ref == 'refs/heads/main' | |
run: | | |
pip install wheel | |
python setup.py sdist bdist_wheel | |
- name: Upload artifact for publish job | |
if: github.ref == 'refs/heads/main' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.PACKAGE_NAME }}-app | |
path: dist/ | |
documentation: | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.10.14] | |
needs: build | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version}} | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version}} | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install -r dev-requirements.txt | |
pip install -e ".[docs]" | |
- name: Build documentation | |
run: | | |
cd doc | |
make html | |
- name: Deploy pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./doc/_build/html | |
publish: | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download artifact from build job | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.PACKAGE_NAME }}-app | |
path: dist/ | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | |
with: | |
user: ${{ secrets.PYPI_USERNAME }} | |
password: ${{ secrets.PYPI_PASSWORD }} | |
continue-on-error: false |