-
Notifications
You must be signed in to change notification settings - Fork 143
179 lines (173 loc) · 5.58 KB
/
cpu-packages.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
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
name: Packages
on:
workflow_dispatch:
push:
branches:
- main
- release*
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-conda:
name: Build Conda
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Ubuntu packages
run: |
sudo apt-get update -y
sudo apt-get install -y protobuf-compiler
- name: Install and upgrade python packages
run: |
python -m pip install --upgrade pip setuptools==59.4.0 wheel pybind11
python -m pip uninstall protobuf -y
python -m pip install --no-binary=protobuf protobuf
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
- name: Generate package for conda
id: conda_build
run: |
echo "conda pkgs dir $CONDA_PKGS_DIRS"
conda update conda
conda install -c conda-forge mamba
mamba install -c conda-forge conda-build boa conda-verify pybind11
conda mambabuild --python ${{ matrix.python-version }} . -c defaults -c conda-forge -c numba -c rapidsai -c nvidia --output-folder ./conda_packages
conda_package=$(find ./conda_packages/ -name "*.tar.bz2")
export CONDA_PACKAGE=$conda_package
echo "conda_package : $conda_package"
echo "conda_package=$conda_package" >> $GITHUB_OUTPUT
- name: Upload conda artifacts to github
uses: actions/upload-artifact@v3
with:
name: conda-${{ matrix.python-version }}
path: ${{ steps.conda_build.outputs.conda_package }}
build-pypi:
name: Build PyPI
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.8]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Ubuntu packages
run: |
sudo apt-get update -y
sudo apt-get install -y protobuf-compiler
- name: Install and upgrade python packages
run: |
python -m pip install --upgrade pip setuptools==59.4.0 wheel tox pybind11
python -m pip uninstall protobuf -y
python -m pip install --no-binary=protobuf protobuf
- name: Build source package for PyPI
run: |
python setup.py sdist
- name: Check distribution is valid
run: |
./ci/check_dist.sh
- name: Build wheels for PyPI
uses: pypa/[email protected]
env:
CIBW_SKIP: cp36-* cp37-* pp* # Don't build wheels for 3.6, 3.7, or PyPy
with:
output-dir: dist
- name: Upload PyPI artifacts to Github
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
# Build docs, treat warnings as errors
- name: Building docs
run: |
tox -e docs
- name: Upload HTML
uses: actions/upload-artifact@v3
with:
name: html-build-artifact
path: docs/build/html
if-no-files-found: error
retention-days: 1
- name: Store PR information
run: |
mkdir ./pr
echo ${{ github.event.number }} > ./pr/pr.txt
echo ${{ github.event.pull_request.merged }} > ./pr/merged.txt
echo ${{ github.event.action }} > ./pr/action.txt
- name: Upload PR information
uses: actions/upload-artifact@v3
with:
name: pr
path: pr/
release-conda:
name: Release Conda
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
if: "startsWith(github.ref, 'refs/tags/')"
needs: [build-conda]
steps:
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v2
with:
name: conda-${{ matrix.python-version }}
path: conda
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
- name: Install conda dependencies
shell: bash -l {0}
run: |
conda install -y anaconda-client conda-build
- name: Push to anaconda
shell: bash -l {0}
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: |
anaconda -t $ANACONDA_TOKEN upload -u nvidia conda/*.tar.bz2
release-pypi:
name: Release PyPI
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [build-pypi]
steps:
- uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Create GitHub Release
uses: fnkr/[email protected]
env:
GHR_PATH: ./dist
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Push to PyPi
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip install --upgrade wheel pip setuptools twine
twine upload dist/*