Skip to content

Commit 221acc2

Browse files
committed
.github: add nightly wheel builds
1 parent 2bb8873 commit 221acc2

File tree

5 files changed

+95
-2
lines changed

5 files changed

+95
-2
lines changed

.github/workflows/nightly.yaml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Nightly Push
2+
3+
on:
4+
pull_request:
5+
# run every day at 11:15am
6+
schedule:
7+
- cron: '15 11 * * *'
8+
9+
jobs:
10+
nightly:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Setup Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: "3.10"
17+
architecture: x64
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
- name: Install Dependencies
21+
run: |
22+
set -eux
23+
24+
pip install -U twine toml
25+
- name: Build Docker
26+
run: |
27+
set -eux
28+
29+
docker build --progress=plain -t torchft-maturin .
30+
31+
- name: Set Nightly Version
32+
run: |
33+
set -eux
34+
35+
python scripts/patch_nightly_version.py
36+
37+
cat Cargo.toml
38+
cat pyproject.toml
39+
40+
- name: Build Wheels
41+
run: |
42+
set -eux
43+
44+
VERSIONS=(
45+
"3.9"
46+
"3.10"
47+
"3.11"
48+
"3.12"
49+
"3.13"
50+
)
51+
52+
for version in "${VERSIONS[@]}"; do
53+
docker run --rm -v $(pwd):/io -t torchft-maturin build --release --out dist --interpreter "$version"
54+
done
55+
56+
- name: Twine Check
57+
run: twine check --strict dist/*
58+
59+
- name: Upload to Pypi
60+
run: twine upload dist/*
61+
env:
62+
TWINE_USERNAME: __token__
63+
TWINE_PASSWORD: ${{ secrets.NIGHTLY_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/

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "torchft"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
edition = "2021"
55

66
[dependencies]

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

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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)
27+
28+
with open(PYPROJECT_FILE, "w") as f:
29+
toml.dump(pyproject, f)

0 commit comments

Comments
 (0)