Skip to content

Commit 3f62c70

Browse files
committed
.github: add nightly wheel builds
1 parent 2bb8873 commit 3f62c70

File tree

4 files changed

+75
-1
lines changed

4 files changed

+75
-1
lines changed

.github/workflows/nightly.yaml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Nightly Build
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Setup Python
11+
uses: actions/setup-python@v5
12+
with:
13+
python-version: "3.10"
14+
architecture: x64
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
- name: Install Dependencies
18+
run: |
19+
set -eux
20+
21+
pip install -U twine toml
22+
- name: Build Docker
23+
run: |
24+
set -eux
25+
26+
docker build --progress=plain -t torchft-maturin .
27+
28+
- name: Set Nightly Version
29+
run: |
30+
set -eux
31+
32+
python scripts/patch_nightly_version.py
33+
34+
- name: Build Wheels
35+
run: |
36+
set -eux
37+
38+
docker run --rm -v $(pwd):/io -t torchft-maturin build --release --out dist --interpreter 3.10
39+
40+
- name: Twine Check
41+
run: twine check --strict dist/*
42+
43+
- name: Upload to Pypi
44+
run: twine upload dist/*
45+
env:
46+
TWINE_USERNAME: __token__
47+
TWINE_PASSWORD: ${{ secrets.pypi_token }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ __pycache__
2626
*.so
2727
**/*.stderr
2828
.pyre
29+
dist/
2930

3031
# Torch
3132
cifar/

build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
fn main() -> Result<(), Box<dyn std::error::Error>> {
88
tonic_build::configure()
99
.protoc_arg("--experimental_allow_proto3_optional")
10-
.compile_protos(&["proto/torchft.proto"], &["proto"])?;
10+
.compile(&["proto/torchft.proto"], &["proto"])?;
1111
Ok(())
1212
}

scripts/patch_nightly_version.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from datetime import date
2+
3+
import toml
4+
5+
6+
def get_nightly_version():
7+
today = date.today()
8+
return f"{today.year}.{today.month}.{today.day}"
9+
10+
11+
CARGO_FILE = "Cargo.toml"
12+
PYPROJECT_FILE = "pyproject.toml"
13+
14+
15+
cargo = toml.load(CARGO_FILE)
16+
cargo["package"]["version"] = get_nightly_version()
17+
18+
print(cargo)
19+
20+
with open(CARGO_FILE, "w") as f:
21+
toml.dump(cargo, f)
22+
23+
pyproject = toml.load(PYPROJECT_FILE)
24+
pyproject["project"]["name"] = "torchft-nightly"
25+
26+
print(pyproject)

0 commit comments

Comments
 (0)