|
| 1 | +name: Release responsibleai-vision to PyPI |
| 2 | + |
| 3 | +# trigger manually only ("collaborator" or more permissions required) |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + type: |
| 8 | + description: "Test or Prod PyPI?" |
| 9 | + required: true |
| 10 | + default: "Test" |
| 11 | + |
| 12 | +jobs: |
| 13 | + release-error-analysis: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: fail if Test nor Prod |
| 17 | + if: ${{ ! (github.event.inputs.type == 'Test' || github.event.inputs.type == 'Prod') }} |
| 18 | + run: | |
| 19 | + echo "Only Test or Prod can be used." |
| 20 | + exit 1 |
| 21 | +
|
| 22 | + # build wheel |
| 23 | + - uses: actions/checkout@v3 |
| 24 | + |
| 25 | + - uses: conda-incubator/setup-miniconda@v2 |
| 26 | + with: |
| 27 | + auto-update-conda: true |
| 28 | + python-version: 3.7 |
| 29 | + |
| 30 | + - name: Install pytorch |
| 31 | + shell: bash -l {0} |
| 32 | + run: | |
| 33 | + conda install --yes --quiet pytorch torchvision captum cpuonly -c pytorch |
| 34 | +
|
| 35 | + - name: update and upgrade pip, setuptools, wheel, and twine |
| 36 | + shell: bash -l {0} |
| 37 | + run: | |
| 38 | + python -m pip install --upgrade pip |
| 39 | + pip install --upgrade setuptools wheel twine |
| 40 | +
|
| 41 | + - name: install requirements.txt for responsibleai-vision |
| 42 | + shell: bash -l {0} |
| 43 | + run: | |
| 44 | + pip install -r requirements.txt |
| 45 | + pip install -r requirements-dev.txt |
| 46 | + working-directory: responsibleai_vision |
| 47 | + |
| 48 | + - name: Install automl dependencies |
| 49 | + shell: bash -l {0} |
| 50 | + run: | |
| 51 | + pip install -r requirements-automl.txt |
| 52 | + working-directory: responsibleai_vision |
| 53 | + |
| 54 | + - name: pip freeze |
| 55 | + run: pip freeze |
| 56 | + |
| 57 | + - name: build wheel for responsibleai-vision |
| 58 | + shell: bash -l {0} |
| 59 | + run: python setup.py sdist bdist_wheel |
| 60 | + working-directory: responsibleai_vision |
| 61 | + |
| 62 | + # run tests before publishing to PyPI |
| 63 | + |
| 64 | + - name: install responsibleai-vision wheel locally |
| 65 | + shell: bash -l {0} |
| 66 | + run: find ./dist/ -name '*.whl' -exec pip install {} \; |
| 67 | + working-directory: responsibleai_vision |
| 68 | + |
| 69 | + - name: run responsibleai-vision tests |
| 70 | + shell: bash -l {0} |
| 71 | + run: pytest ./tests/ |
| 72 | + working-directory: responsibleai_vision |
| 73 | + |
| 74 | + # publish to PyPI |
| 75 | + - name: Publish responsibleai-vision package to Test PyPI |
| 76 | + if: ${{ github.event.inputs.type == 'Test' }} |
| 77 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 78 | + with: |
| 79 | + user: __token__ |
| 80 | + password: ${{ secrets.TEST_PYPI_API_TOKEN_RESPONSIBLEAI_VISION }} |
| 81 | + repository_url: https://test.pypi.org/legacy/ |
| 82 | + packages_dir: responsibleai_vision/dist/ |
| 83 | + - name: Publish responsibleai-vision package to PyPI |
| 84 | + if: ${{ github.event.inputs.type == 'Prod' }} |
| 85 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 86 | + with: |
| 87 | + user: __token__ |
| 88 | + password: ${{ secrets.PYPI_API_TOKEN_RESPONSIBLEAI_VISION }} |
| 89 | + packages_dir: responsibleai_vision/dist/ |
0 commit comments