Initial commit #27
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: CI/CT/CD | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pytest | |
- name: Run unit tests | |
run: | | |
pytest tests | |
- name: Build PyPI package | |
if: success() | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: Publish to PyPI | |
if: success() | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
pip install twine | |
twine upload dist/* --verbose | |
- name: Install Conda | |
if: success() | |
uses: goanpeca/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
miniforge-variant: Mambaforge | |
python-version: 3.8 | |
- name: Build Conda package | |
if: success() | |
run: | | |
conda install conda-build anaconda-client | |
conda config --set anaconda_upload no | |
conda-build . --output-folder build_output | |
- name: Publish to Conda | |
if: success() | |
env: | |
ANACONDA_USER: ${{ secrets.CONDA_USERNAME }} | |
ANACONDA_PASSWORD: ${{ secrets.CONDA_PASSWORD }} | |
run: | | |
anaconda login --username $ANACONDA_USER --password $ANACONDA_PASSWORD | |
anaconda upload build_output/**/pyorganoid-*.tar.bz2 --force | |
- name: Build documentation | |
run: | | |
cd docs | |
make clean | |
make html | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: docs/build/html |