From b0d7da3a3affbb0ea3379af133e4767953b02184 Mon Sep 17 00:00:00 2001 From: Ilya Matiach Date: Thu, 29 Jun 2023 12:26:39 -0400 Subject: [PATCH] add release scripts for responsibleai-text and responsibleai-vision pypi packages --- .github/workflows/release-rai-text.yml | 88 +++++++++++++++++++++++ .github/workflows/release-rai-vision.yml | 89 ++++++++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 .github/workflows/release-rai-text.yml create mode 100644 .github/workflows/release-rai-vision.yml diff --git a/.github/workflows/release-rai-text.yml b/.github/workflows/release-rai-text.yml new file mode 100644 index 0000000000..92abb52708 --- /dev/null +++ b/.github/workflows/release-rai-text.yml @@ -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/ diff --git a/.github/workflows/release-rai-vision.yml b/.github/workflows/release-rai-vision.yml new file mode 100644 index 0000000000..68bdc72913 --- /dev/null +++ b/.github/workflows/release-rai-vision.yml @@ -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/