-
Notifications
You must be signed in to change notification settings - Fork 9
86 lines (72 loc) · 2.75 KB
/
release-vision-explanation-methods.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Release vision-explanation-methods to PyPI
# trigger manually only ("collaborator" or more permissions required)
on:
workflow_dispatch:
inputs:
releaseType:
description: "Test or Prod PyPI?"
required: true
default: "Test"
jobs:
release-build:
runs-on: ubuntu-latest
steps:
- name: fail if Test nor Prod
if: ${{ ! (github.event.inputs.releaseType == 'Test' || github.event.inputs.releaseType == 'Prod') }}
run: |
echo "Only Test or Prod can be used."
exit 1
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.8
- name: Install pytorch
shell: bash -l {0}
run: |
conda install --yes --quiet pytorch torchvision captum cpuonly -c pytorch -c conda-forge --strict-channel-priority
- 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 for vision-explanation-methods
shell: bash -l {0}
run: |
pip install -r requirements-test.txt
- name: pip freeze
shell: bash -l {0}
run: pip freeze
- name: build wheel for vision-explanation-methods
shell: bash -l {0}
run: python setup.py sdist bdist_wheel
working-directory: python
# run tests before publishing to PyPI
- name: install vision-explanation-methods wheel locally
shell: bash -l {0}
run: find ./dist/ -name '*.whl' -exec pip install {} \;
working-directory: python
- name: run vision-explanation-methods tests
shell: bash -l {0}
run: pytest ./tests -s -v
- name: Upload a vision-explanation-methods build result
uses: actions/upload-artifact@v2
with:
name: vision_explanation_methods
path: python/dist/
# publish to PyPI
- name: Publish vision-explanation-methods package to Test PyPI
if: ${{ github.event.inputs.releaseType == 'Test' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN_VISION_EXPLANATION_METHODS }}
repository_url: https://test.pypi.org/legacy/
packages_dir: python/dist/
- name: Publish vision-explanation-methods package to PyPI
if: ${{ github.event.inputs.releaseType == 'Prod' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN_VISION_EXPLANATION_METHODS }}
packages_dir: python/dist/