-
Notifications
You must be signed in to change notification settings - Fork 21
212 lines (186 loc) · 6.38 KB
/
Copy pathmain.yml
File metadata and controls
212 lines (186 loc) · 6.38 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: CI/CD Pipeline
on:
push:
branches: [main]
tags:
- 'v*' # Match tags starting with v, e.g., v1.0.0
pull_request:
branches: [main]
jobs:
lint:
runs-on: Linux
env:
NVIDIA_DRIVER_CAPABILITIES: all
NVIDIA_VISIBLE_DEVICES: all
NVIDIA_DISABLE_REQUIRE: 1
container: &container_template
image: 192.168.3.13:5000/dexsdk:ubuntu22.04-cuda12.8.0-h5ffmpeg-v3
volumes:
- "/cache:/cache"
- "/usr/share/vulkan/icd.d:/usr/share/vulkan/icd.d"
- "/usr/share/vulkan/implicit_layer.d:/usr/share/vulkan/implicit_layer.d"
- "/usr/share/glvnd/egl_vendor.d:/usr/share/glvnd/egl_vendor.d"
- "/tmp/.X11-unix:/tmp/.X11-unix"
- "/dev/shm/shared:/dev/shm/shared"
- "/usr/share/nvidia:/usr/share/nvidia"
options: --memory 100g --gpus device=1 --shm-size 53687091200
steps:
- uses: actions/checkout@v4
- name: Code Style check
run: |
echo "Workspace: ${GITHUB_WORKSPACE}"
ls
pip install black==26.3.1
black --check --diff --color ./
if [ $? -ne 0 ]; then
echo "Code style check failed, please run [black ./] before commit!"
exit 1
fi
build:
needs: lint
runs-on: Linux
env:
NVIDIA_DRIVER_CAPABILITIES: all
NVIDIA_VISIBLE_DEVICES: all
NVIDIA_DISABLE_REQUIRE: 1
DOCS_MAX_VERSIONS: 5
container: *container_template
steps:
- uses: actions/checkout@v4
- name: Cache Python dependencies
id: cache-pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-docs-${{ hashFiles('docs/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-docs-
# Restore the full multi-version site from the last successful build.
# The key never matches exactly (run_id is unique), so restore-keys is
# always used to pick up the most recently saved full site.
- name: Restore full multi-version docs site
if: github.event_name == 'push'
uses: actions/cache/restore@v4
with:
path: docs/build/html
key: docs-full-site-${{ github.repository }}-${{ github.run_id }}
restore-keys: |
docs-full-site-${{ github.repository }}-
- name: Build docs
shell: bash
run: |
pip install -e . --extra-index-url http://pyp.open3dv.site:2345/simple/ --trusted-host pyp.open3dv.site
pip install -r docs/requirements.txt
python3 docs/scripts/sync_readme.py
cd ${GITHUB_WORKSPACE}/docs
pip uninstall pymeshlab -y
pip install pymeshlab==2023.12.post3
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
VERSION="${GITHUB_REF_NAME}"
echo "Building docs for release tag ${VERSION}..."
sphinx-build source build/html/${VERSION}
cd build/html
# Prune old release versions beyond the window
mapfile -t TAG_DIRS < <(ls -d v*/ 2>/dev/null | sort -V)
while [[ ${#TAG_DIRS[@]} -gt ${DOCS_MAX_VERSIONS:-5} ]]; do
echo "Pruning old version: ${TAG_DIRS[0]}"
rm -rf "${TAG_DIRS[0]}"
TAG_DIRS=("${TAG_DIRS[@]:1}")
done
else
echo "Building dev docs for main branch..."
# Only rebuild main/ — all other version dirs come from the cache
rm -rf build/html/main
sphinx-build source build/html/main
cd build/html
fi
# Regenerate versions.json and root index.html from all present dirs
python3 ${GITHUB_WORKSPACE}/docs/scripts/generate_versions_json.py \
--build-dir .
# Save the updated full site so the next run can restore all versions
- name: Save full multi-version docs site
if: github.event_name == 'push'
uses: actions/cache/save@v4
with:
path: docs/build/html
key: docs-full-site-${{ github.repository }}-${{ github.run_id }}
- name: Upload docs artifact
if: github.event_name == 'push'
uses: actions/upload-pages-artifact@v3
with:
path: ${{ github.workspace }}/docs/build/html
test:
if: github.event_name == 'pull_request'
needs: lint
runs-on: Linux
env:
NVIDIA_DRIVER_CAPABILITIES: all
NVIDIA_VISIBLE_DEVICES: all
NVIDIA_DISABLE_REQUIRE: 1
container: *container_template
steps:
- uses: actions/checkout@v4
- name: Run tests
run: |
pip install -e . --extra-index-url http://pyp.open3dv.site:2345/simple/ --trusted-host pyp.open3dv.site
echo "Unit test Start"
export HF_ENDPOINT=https://hf-mirror.com
pytest tests
publish:
if: github.event_name == 'push'
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
steps:
- name: Deploy GitHub Pages
uses: actions/deploy-pages@v4
release-build:
if: startsWith(github.ref, 'refs/tags/v')
needs: lint
runs-on: Linux
container: *container_template
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: (Release) Install build tools
run: |
python -m pip install --upgrade pip
pip install build
- name: (Release) Build sdist and wheel
run: |
python -m build
# - name: (Release) Create GitHub Release (draft)
# uses: softprops/action-gh-release@v2
# with:
# draft: true
# generate_release_notes: true
# files: |
# dist/*
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: (Release) Upload distributions
uses: actions/upload-artifact@v4
with:
name: python-distributions
path: dist/
release-publish:
if: startsWith(github.ref, 'refs/tags/v')
needs: release-build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/embodichain
permissions:
contents: read
id-token: write # PyPI Trusted Publishing
steps:
- name: (Release) Download distributions
uses: actions/download-artifact@v4
with:
name: python-distributions
path: dist/
- name: (Release) Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1