Skip to content

Commit 551fc4e

Browse files
authored
.github: add nightly wheel builds (#50)
1 parent 2bb8873 commit 551fc4e

File tree

5 files changed

+94
-2
lines changed

5 files changed

+94
-2
lines changed

.github/workflows/nightly.yaml

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