Skip to content

Update CITATION.cff #45

Update CITATION.cff

Update CITATION.cff #45

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: Check if version exists on PyPI
id: pypi_version_check
run: |
pip install requests
PACKAGE_NAME="pyorganoid"
VERSION=$(python setup.py --version)
response=$(curl -s -o /dev/null -w "%{http_code}" https://pypi.org/project/$PACKAGE_NAME/$VERSION/)
if [ $response -eq 200 ]; then
echo "Version $VERSION already exists on PyPI."
echo "::set-output name=exists::true"
else
echo "Version $VERSION does not exist on PyPI."
echo "::set-output name=exists::false"
fi
- name: Publish to PyPI
if: steps.pypi_version_check.outputs.exists == 'false'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
pip install twine
twine upload dist/* --verbose
- name: Check if version exists on Conda
id: conda_version_check
run: |
PACKAGE_NAME="pyorganoid"
VERSION=$(python setup.py --version)
response=$(curl -s -o /dev/null -w "%{http_code}" https://anaconda.org/$ANACONDA_USER/$PACKAGE_NAME/$VERSION/download/linux-64/$PACKAGE_NAME-$VERSION.tar.bz2)
if [ $response -eq 200 ]; then
echo "Version $VERSION already exists on Conda."
echo "::set-output name=exists::true"
else
echo "Version $VERSION does not exist on Conda."
echo "::set-output name=exists::false"
fi
- name: Install Conda and dependencies
if: steps.conda_version_check.outputs.exists == 'false'
uses: goanpeca/setup-miniconda@v2
with:
auto-update-conda: true
miniforge-variant: Mambaforge
python-version: 3.8
- name: Install conda-build and anaconda-client
if: steps.conda_version_check.outputs.exists == 'false'
run: |
conda install -y conda-build anaconda-client
- name: Build Conda package
if: steps.conda_version_check.outputs.exists == 'false'
shell: bash -l {0}
run: |
conda config --set anaconda_upload no
source $(conda info --base)/etc/profile.d/conda.sh
conda activate base
conda-build . --output-folder build_output
- name: Publish to Conda
if: steps.conda_version_check.outputs.exists == 'false'
env:
ANACONDA_API_TOKEN: ${{ secrets.CONDA_TOKEN }}
run: |
source $(conda info --base)/etc/profile.d/conda.sh
conda activate base
anaconda -t $ANACONDA_API_TOKEN upload build_output/**/pyorganoid-*.tar.bz2 --force
- name: Build documentation
if: success()
run: |
cd docs
make clean
make html
- name: Deploy to GitHub Pages
if: success()
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/html
publish_branch: gh-pages