-
Notifications
You must be signed in to change notification settings - Fork 52
92 lines (78 loc) · 2.64 KB
/
publish-pypi.yaml
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
name: Publish to PyPI
on:
release:
types: [published]
jobs:
publish-tests:
name: Release Tests
if: github.repository == 'hidet-org/hidet'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
runs-on: [self-hosted, Linux, X64, gpu]
container:
image: nvidia/cuda:11.8.0-devel-ubuntu20.04
options: --gpus all
steps:
- name: Install dependencies via apt
run: |
apt update && DEBIAN_FRONTEND=noninteractive apt install -y ccache git graphviz
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.19.x'
- name: Install dependencies via pip
run: |
python -m pip install --upgrade pip
pip install torch torchvision torchaudio
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Build hidet
run: |
bash scripts/wheel/build_wheel.sh
WHEEL=$(find ./scripts/wheel/built_wheel -maxdepth 1 -name '*.whl')
echo "WHEEL_NAME=$WHEEL" >> $GITHUB_ENV
echo "Built wheel: ${{ env.WHEEL_NAME }}"
- name: Install hidet
run: |
pip install --no-deps --force-reinstall ${{ env.WHEEL_NAME }}
# Run tests
- name: Run tests with operator cache cleared
run: |
python -m pytest -v --durations=20 --clear-cache ./tests
# Build the docs
- name: Install docs dependencies
run: |
pip install -r docs/requirements.txt
- name: Build docs
run: |
cd docs; make clean; make html
publish:
name: Publish to PyPI
needs: [publish-tests] # require tests to pass before deploy runs
if: github.event_name == 'release' && github.event.action == 'published' && startsWith(github.event.release.tag_name, 'v')
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Build package
uses: ./.github/actions/
with:
version: ${{ steps.get_version.outputs.VERSION }}
- name: Show the wheel
run: |
ls scripts/wheel/built_wheel
- name: Publish
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages_dir: scripts/wheel/built_wheel