Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.github: add nightly wheel builds #50

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Nightly Push

on:
# run every day at 11:15am
schedule:
- cron: '15 11 * * *'

jobs:
nightly:
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
architecture: x64
- name: Checkout
uses: actions/checkout@v4
- name: Install Dependencies
run: |
set -eux

pip install -U twine toml
- name: Build Docker
run: |
set -eux

docker build --progress=plain -t torchft-maturin .

- name: Set Nightly Version
run: |
set -eux

python scripts/patch_nightly_version.py

cat Cargo.toml
cat pyproject.toml

- name: Build Wheels
run: |
set -eux

VERSIONS=(
"3.9"
"3.10"
"3.11"
"3.12"
"3.13"
)

for version in "${VERSIONS[@]}"; do
docker run --rm -v $(pwd):/io -t torchft-maturin build --release --out dist --interpreter "$version"
done

- name: Twine Check
run: twine check --strict dist/*

- name: Upload to Pypi
run: twine upload --skip-existing dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.NIGHTLY_PYPI_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ __pycache__
*.so
**/*.stderr
.pyre
dist/

# Torch
cifar/
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "torchft"
version = "0.1.0"
version = "0.1.1"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::configure()
.protoc_arg("--experimental_allow_proto3_optional")
.compile_protos(&["proto/torchft.proto"], &["proto"])?;
.compile(&["proto/torchft.proto"], &["proto"])?;
Ok(())
}
29 changes: 29 additions & 0 deletions scripts/patch_nightly_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from datetime import date

import toml


def get_nightly_version():
today = date.today()
return f"{today.year}.{today.month}.{today.day}"


CARGO_FILE = "Cargo.toml"
PYPROJECT_FILE = "pyproject.toml"


cargo = toml.load(CARGO_FILE)
cargo["package"]["version"] = get_nightly_version()

print(cargo)

with open(CARGO_FILE, "w") as f:
toml.dump(cargo, f)

pyproject = toml.load(PYPROJECT_FILE)
pyproject["project"]["name"] = "torchft-nightly"

print(pyproject)

with open(PYPROJECT_FILE, "w") as f:
toml.dump(pyproject, f)
Loading