This repository was archived by the owner on Sep 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
212 lines (179 loc) · 6.19 KB
/
release.yml
File metadata and controls
212 lines (179 loc) · 6.19 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
name: Release Pipeline
# generating and testing package artifacts from the main branch
on:
release:
types: [edited, published]
tags-ignore:
- data
workflow_dispatch:
env:
NVCR_REGISTRY: nvcr.io
jobs:
docker_build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
outputs:
monaistream_docker_image_tag: ${{ steps.findPr.outputs.pr }}
steps:
- name: Checkout Source Code
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to DockerHub
uses: docker/login-action@v1.10.0
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- uses: jwalton/gh-find-current-pr@v1
id: findPr
with:
state: all
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3.5.0
with:
images: aihsani/monaistream:${{ steps.findPr.outputs.pr }}
- name: Check if Docker Image with Tag Exists
id: docker_build_check
run: |
if docker manifest inspect "aihsani/monaistream:${{ steps.findPr.outputs.pr }}"; then
echo "::set-output name=skip_docker_build::true"
else
echo "::set-output name=skip_docker_build::false"
fi
- name: Login to NGC Repo
if: steps.docker_build_check.outputs.skip_docker_build == 'false'
uses: docker/login-action@v1.10.0
with:
registry: ${{ env.NVCR_REGISTRY }}
username: ${{ secrets.NGC_USER }}
password: ${{ secrets.NGC_TOKEN }}
- name: Build and Push MONAI SDK Development Docker Image
if: steps.docker_build_check.outputs.skip_docker_build == 'false'
uses: docker/build-push-action@v2.7.0
with:
context: .
push: true
tags: aihsani/monaistream:${{ steps.findPr.outputs.pr }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile.base
build:
needs: docker_build
runs-on: ubuntu-latest
container:
image: "docker://aihsani/monaistream:${{ needs.docker_build.outputs.monaistream_docker_image_tag }}"
credentials:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
steps:
- name: Checkout Source Code
uses: actions/checkout@v2
- name: Install PyDS Library
run: |
cp ./lib/pyds-py3.8-x86.so /opt/nvidia/deepstream/deepstream-6.0/lib/pyds.so
pushd /opt/nvidia/deepstream/deepstream-6.0/lib
python setup.py install
popd
- name: Install MONAIStream Requirements
run: |
python -m pip install -r requirements-dev.txt
packaging:
needs: docker_build
runs-on: ubuntu-latest
container:
image: "docker://aihsani/monaistream:${{ needs.docker_build.outputs.monaistream_docker_image_tag }}"
credentials:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
steps:
- name: Checkout Source Code
uses: actions/checkout@v2
- name: Install PyDS Library
run: |
cp ./lib/pyds-py3.8-x86.so /opt/nvidia/deepstream/deepstream-6.0/lib/pyds.so
pushd /opt/nvidia/deepstream/deepstream-6.0/lib
python setup.py install
popd
- name: Install MONAIStream Requirements
run: |
python -m pip install -r requirements-dev.txt
- name: cache weekly timestamp
id: pip-cache
run: |
echo "::set-output name=datew::$(date '+%Y-%V')"
- name: cache for pip
uses: actions/cache@v2
id: cache
with:
path: |
~/.cache/pip
~/.cache/torch
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
- name: Install dependencies
run: |
python -m pip install --user --upgrade pip setuptools wheel twine
python -m pip install torch>=1.8 torchvision
- name: Test source archive and wheel file
run: |
root_dir=$PWD
echo "$root_dir"
# build tar.gz and wheel
python setup.py check -m -s
python setup.py sdist bdist_wheel
python -m twine check dist/*
# move packages to a temp dir
tmp_dir=$(mktemp -d)
cp dist/monaistream* "$tmp_dir"
rm -r build src/monaistream.egg-info
pushd "$tmp_dir"
ls -al
# install from wheel
python -m pip install monaistream*.whl
python -c 'import monaistream; monaistream.print_config()' 2>&1 | grep -iv "unknown"
python -c 'import monaistream; print(monaistream.__file__)'
python -m pip uninstall -y monaistream
rm monaistream*.whl
# install from tar.gz
name=$(ls *.tar.gz | head -n1)
echo $name
python -m pip install $name
python -c 'import monaistream; monaistream.print_config()' 2>&1 | grep -iv "unknown"
python -c 'import monaistream; print(monaistream.__file__)'
popd
env:
shell: bash
- if: startsWith(github.ref, 'refs/tags/')
name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: dist
path: dist/
- if: startsWith(github.ref, 'refs/tags/')
name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
versioning:
if: github.repository == 'Project-MONAI/MONAIStream'
needs: packaging
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# full history so that we can git describe
with:
fetch-depth: 0
- shell: bash
run: |
git describe --always
python setup.py build
cat build/lib/monaistream/_version.py
- name: Upload version
uses: actions/upload-artifact@v2
with:
name: _version.py
path: build/lib/monaistream/_version.py