Skip to content

Commit

Permalink
add release scripts for responsibleai-text and responsibleai-vision p…
Browse files Browse the repository at this point in the history
…ypi packages
  • Loading branch information
imatiach-msft committed Jun 29, 2023
1 parent 058814a commit b0d7da3
Show file tree
Hide file tree
Showing 2 changed files with 177 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/release-rai-text.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Release responsibleai-text to PyPI

# trigger manually only ("collaborator" or more permissions required)
on:
workflow_dispatch:
inputs:
type:
description: "Test or Prod PyPI?"
required: true
default: "Test"

jobs:
release-error-analysis:
runs-on: ubuntu-latest
steps:
- name: fail if Test nor Prod
if: ${{ ! (github.event.inputs.type == 'Test' || github.event.inputs.type == 'Prod') }}
run: |
echo "Only Test or Prod can be used."
exit 1
# build wheel
- uses: actions/checkout@v3

- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.7

- name: Install pytorch
shell: bash -l {0}
run: |
conda install --yes --quiet pytorch torchvision captum cpuonly -c pytorch
- name: update and upgrade pip, setuptools, wheel, and twine
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel twine
- name: install requirements.txt for responsibleai-text
shell: bash -l {0}
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
working-directory: responsibleai_text

- name: Setup spacy
shell: bash -l {0}
run: |
python -m spacy download en_core_web_sm
- name: pip freeze
run: pip freeze

- name: build wheel for responsibleai-text
shell: bash -l {0}
run: python setup.py sdist bdist_wheel
working-directory: responsibleai_text

# run tests before publishing to PyPI

- name: install responsibleai-text wheel locally
shell: bash -l {0}
run: find ./dist/ -name '*.whl' -exec pip install {} \;
working-directory: responsibleai_text

- name: run responsibleai-text tests
shell: bash -l {0}
run: pytest ./tests/
working-directory: responsibleai_text

# publish to PyPI
- name: Publish responsibleai-text package to Test PyPI
if: ${{ github.event.inputs.type == 'Test' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN_RESPONSIBLEAI_TEXT }}
repository_url: https://test.pypi.org/legacy/
packages_dir: responsibleai_text/dist/
- name: Publish responsibleai-text package to PyPI
if: ${{ github.event.inputs.type == 'Prod' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN_RESPONSIBLEAI_TEXT }}
packages_dir: responsibleai_text/dist/
89 changes: 89 additions & 0 deletions .github/workflows/release-rai-vision.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Release responsibleai-vision to PyPI

# trigger manually only ("collaborator" or more permissions required)
on:
workflow_dispatch:
inputs:
type:
description: "Test or Prod PyPI?"
required: true
default: "Test"

jobs:
release-error-analysis:
runs-on: ubuntu-latest
steps:
- name: fail if Test nor Prod
if: ${{ ! (github.event.inputs.type == 'Test' || github.event.inputs.type == 'Prod') }}
run: |
echo "Only Test or Prod can be used."
exit 1
# build wheel
- uses: actions/checkout@v3

- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.7

- name: Install pytorch
shell: bash -l {0}
run: |
conda install --yes --quiet pytorch torchvision captum cpuonly -c pytorch
- name: update and upgrade pip, setuptools, wheel, and twine
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel twine
- name: install requirements.txt for responsibleai-vision
shell: bash -l {0}
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
working-directory: responsibleai_vision

- name: Install automl dependencies
shell: bash -l {0}
run: |
pip install -r requirements-automl.txt
working-directory: responsibleai_vision

- name: pip freeze
run: pip freeze

- name: build wheel for responsibleai-vision
shell: bash -l {0}
run: python setup.py sdist bdist_wheel
working-directory: responsibleai_vision

# run tests before publishing to PyPI

- name: install responsibleai-vision wheel locally
shell: bash -l {0}
run: find ./dist/ -name '*.whl' -exec pip install {} \;
working-directory: responsibleai_vision

- name: run responsibleai-vision tests
shell: bash -l {0}
run: pytest ./tests/
working-directory: responsibleai_vision

# publish to PyPI
- name: Publish responsibleai-vision package to Test PyPI
if: ${{ github.event.inputs.type == 'Test' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN_RESPONSIBLEAI_VISION }}
repository_url: https://test.pypi.org/legacy/
packages_dir: responsibleai_vision/dist/
- name: Publish responsibleai-vision package to PyPI
if: ${{ github.event.inputs.type == 'Prod' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN_RESPONSIBLEAI_VISION }}
packages_dir: responsibleai_vision/dist/

0 comments on commit b0d7da3

Please sign in to comment.