Skip to content

Commit 24e1701

Browse files
add release scripts for responsibleai-text and responsibleai-vision pypi packages (#2156)
1 parent 058814a commit 24e1701

File tree

2 files changed

+177
-0
lines changed

2 files changed

+177
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Release responsibleai-text 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-text
42+
shell: bash -l {0}
43+
run: |
44+
pip install -r requirements.txt
45+
pip install -r requirements-dev.txt
46+
working-directory: responsibleai_text
47+
48+
- name: Setup spacy
49+
shell: bash -l {0}
50+
run: |
51+
python -m spacy download en_core_web_sm
52+
53+
- name: pip freeze
54+
run: pip freeze
55+
56+
- name: build wheel for responsibleai-text
57+
shell: bash -l {0}
58+
run: python setup.py sdist bdist_wheel
59+
working-directory: responsibleai_text
60+
61+
# run tests before publishing to PyPI
62+
63+
- name: install responsibleai-text wheel locally
64+
shell: bash -l {0}
65+
run: find ./dist/ -name '*.whl' -exec pip install {} \;
66+
working-directory: responsibleai_text
67+
68+
- name: run responsibleai-text tests
69+
shell: bash -l {0}
70+
run: pytest ./tests/
71+
working-directory: responsibleai_text
72+
73+
# publish to PyPI
74+
- name: Publish responsibleai-text package to Test PyPI
75+
if: ${{ github.event.inputs.type == 'Test' }}
76+
uses: pypa/gh-action-pypi-publish@release/v1
77+
with:
78+
user: __token__
79+
password: ${{ secrets.TEST_PYPI_API_TOKEN_RESPONSIBLEAI_TEXT }}
80+
repository_url: https://test.pypi.org/legacy/
81+
packages_dir: responsibleai_text/dist/
82+
- name: Publish responsibleai-text package to PyPI
83+
if: ${{ github.event.inputs.type == 'Prod' }}
84+
uses: pypa/gh-action-pypi-publish@release/v1
85+
with:
86+
user: __token__
87+
password: ${{ secrets.PYPI_API_TOKEN_RESPONSIBLEAI_TEXT }}
88+
packages_dir: responsibleai_text/dist/
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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

Comments
 (0)