-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
69f5d4a
commit 087b42a
Showing
4 changed files
with
106 additions
and
49 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- ci-wheel | ||
tags: | ||
- "v[0-9]+*" | ||
|
||
env: | ||
TORCH_CUDA_ARCH_LIST: "8.0 8.6 8.9+PTX" # Need fix for 9.0 | ||
PUNICA_CI_TORCH_VERSION: "2.1.0" | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python: ["3.10", "3.11"] | ||
cuda: ["11.8", "12.1"] | ||
runs-on: [self-hosted] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Build wheel | ||
run: | | ||
chown -R $CI_UID:$CI_GID "$GITHUB_WORKSPACE" | ||
version="$(cat version.txt)" | ||
docker run --rm -t \ | ||
-v "$CI_RUNNER_CACHE_DIR":/ci-cache \ | ||
-v "$GITHUB_WORKSPACE":/app \ | ||
-e PUNICA_CI_PYTHON_VERSION=${{ matrix.python }} \ | ||
-e PUNICA_CI_CUDA_VERSION=${{ matrix.cuda }} \ | ||
-e PUNICA_CI_TORCH_VERSION=$PUNICA_CI_TORCH_VERSION \ | ||
-e PUNICA_BUILD_VERSION=$version \ | ||
-e TORCH_CUDA_ARCH_LIST="$TORCH_CUDA_ARCH_LIST" \ | ||
--user $CI_UID:$CI_GID \ | ||
pytorch/manylinux-builder:cuda${{ matrix.cuda }} \ | ||
bash /app/ci/run-ci-build-wheel.bash | ||
- run: du -h dist/* | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: wheel-cuda${{ matrix.cuda }}-python${{ matrix.python }} | ||
path: dist/* | ||
|
||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
path: dist/ | ||
merge-multiple: true | ||
pattern: wheel-* | ||
|
||
- run: ls -lah dist/ | ||
|
||
- uses: softprops/action-gh-release@v1 | ||
with: | ||
draft: true | ||
files: | | ||
dist/punica-*.whl | ||
dist/punica-*.tar.gz | ||
- name: Clone wheel index | ||
run: git clone https://oauth2:${WHL_TOKEN}@github.com/punica-ai/whl.git punica-whl | ||
env: | ||
WHL_TOKEN: ${{ secrets.WHL_TOKEN }} | ||
|
||
- name: Update wheel index | ||
shell: python | ||
run: | | ||
import pathlib | ||
import hashlib | ||
import re | ||
for path in sorted(pathlib.Path("dist").glob("*.whl")): | ||
with open(path, "rb") as f: | ||
sha256 = hashlib.sha256(f.read()).hexdigest() | ||
ver, cu = re.findall(r"punica-([0-9.]+)\+cu(\d+)-", path.name)[0] | ||
with open(f"punica-whl/cu{cu}/index.html", "a") as f: | ||
f.write(f'<a href="https://github.com/punica-ai/punica/releases/download/v{ver}/{path.name}#sha256={sha256}">{path.name}</a><br>\n') | ||
- name: Push wheel index | ||
run: | | ||
cd punica-whl | ||
git config --local user.name "github-actions[bot]" | ||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git add -A | ||
git commit -m "update whl" | ||
git push | ||
- name: Upload sdist to pypi | ||
run: | | ||
pip install twine | ||
python -m twine upload --repository testpypi --username=__token__ dist/*.tar.gz | ||
env: | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters