Update setup.py #48
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: Python CI/CD | |
on: | |
push: | |
branches: | |
- main # Change this to your default branch if it's not 'main' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
python -m spacy download en_core_web_sm | |
pip install pytest pytest-cov # install pytest and pytest-cov | |
- name: Run tests with pytest | |
run: pytest --cov=./ --cov-report=xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # if needed | |
file: ./coverage.xml | |
create_release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Read VERSION file | |
id: version | |
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV | |
- name: Generate new_version artifact # Add this step | |
run: echo "${{ env.VERSION }}" > new_version.txt | |
- name: Upload new_version artifact # And this step | |
uses: actions/upload-artifact@v2 | |
with: | |
name: new_version | |
path: new_version.txt | |
- name: Create GitHub Release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ env.VERSION }} | |
release_name: Release ${{ env.VERSION }} | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
deploy-pypi: | |
needs: create_release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: pip install twine wheel setuptools # Add setuptools here | |
- name: Build and Publish | |
env: | |
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
python setup.py sdist bdist_wheel | |
twine upload dist/* -u $PYPI_USERNAME -p $PYPI_PASSWORD | |
# deploy-conda: | |
# needs: create_release | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v2 | |
# - name: Set up Conda | |
# run: | | |
# wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh | |
# bash miniconda.sh -b -p $HOME/miniconda | |
# source "$HOME/miniconda/etc/profile.d/conda.sh" | |
# conda config --set always_yes yes --set changeps1 no | |
# conda update -q conda | |
# - name: Download new_version artifact | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: new_version | |
# - name: Set TAG_NAME from artifact | |
# run: echo "TAG_NAME=$(cat new_version.txt)" >> $GITHUB_ENV | |
# - name: Enable Anaconda Upload | |
# run: conda config --set anaconda_upload yes | |
# - name: Install conda-build | |
# run: conda install conda-build | |
# - name: Install pip via conda | |
# run: pip install -r requirements.txt | |
# - name: Add forge channel | |
# run: conda config --add channels conda-forge | |
# - name: Install yq via pip | |
# run: pip install yq | |
# - name: Update version in meta.yaml | |
# run: yq -y ".package.version = \"${{ env.TAG_NAME }}\"" conda/meta.yaml > conda/temp_meta.yaml && mv conda/temp_meta.yaml conda/meta.yaml | |
# - name: Build and Publish to Anaconda | |
# env: | |
# ANACONDA_USERNAME: ${{ secrets.ANACONDA_USERNAME }} | |
# ANACONDA_PASSWORD: ${{ secrets.ANACONDA_PASSWORD }} | |
# run: | | |
# conda build -c conda-forge . | |
# anaconda login --user $ANACONDA_USERNAME --password $ANACONDA_PASSWORD | |
# anaconda upload $HOME/miniconda/conda-bld/**/artifician*.tar.bz2 |