feat(ci): add entrypoints + add version checks + add minimal release testing + uncomment publishing to pypi (#1589)
This commit is contained in:
2
.github/workflows/full_tests.yml
vendored
2
.github/workflows/full_tests.yml
vendored
@@ -206,3 +206,5 @@ jobs:
|
|||||||
echo "::error::Failed to delete Docker image. HTTP status: $HTTP_RESPONSE"
|
echo "::error::Failed to delete Docker image. HTTP status: $HTTP_RESPONSE"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# TODO(Steven): Check dockerimages pull in ubuntu
|
||||||
|
|||||||
77
.github/workflows/release.yml
vendored
77
.github/workflows/release.yml
vendored
@@ -20,12 +20,12 @@ on:
|
|||||||
- 'v*.*.*' # Trigger on tags like v0.1.0, v1.0.0
|
- 'v*.*.*' # Trigger on tags like v0.1.0, v1.0.0
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# TODO(Steven): Publish draft/pre-release and to test pypi
|
# This job builds the Python package and publishes it to PyPI
|
||||||
# TODO(Steven): Tag documentation with the same version as the package
|
|
||||||
# TODO(Steven): Define entry points for main CLI scripts
|
|
||||||
build-and-publish:
|
build-and-publish:
|
||||||
name: Build and publish Python distributions
|
name: Build and publish Python distributions
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.extract_info.outputs.tag_version }}
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
id-token: write
|
id-token: write
|
||||||
@@ -41,26 +41,34 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.10'
|
||||||
|
|
||||||
- name: Extract Version and Package Name
|
- name: Extract Version
|
||||||
id: extract_info
|
id: extract_info
|
||||||
|
# Extract version from tag (e.g., v0.1.0 -> 0.1.0)
|
||||||
# zizmor: ignore[template-injection]
|
# zizmor: ignore[template-injection]
|
||||||
run: |
|
run: |
|
||||||
# Extract version from tag (e.g., v0.1.0 -> 0.1.0)
|
|
||||||
VERSION=${{ github.ref_name }}
|
VERSION=${{ github.ref_name }}
|
||||||
VERSION_NUMBER=${VERSION#v}
|
VERSION_NUMBER=${VERSION#v}
|
||||||
echo "tag_version=$VERSION_NUMBER" >> $GITHUB_OUTPUT
|
echo "tag_version=$VERSION_NUMBER" >> $GITHUB_OUTPUT
|
||||||
|
- name: Check if version matches pyproject.toml
|
||||||
|
# zizmor: ignore[template-injection]
|
||||||
|
run: |
|
||||||
|
TAG_VERSION=${{ steps.extract_info.outputs.tag_version }}
|
||||||
|
|
||||||
# Extract package name from pyproject.toml
|
PYPROJECT_VERSION=$(grep '^version = ' pyproject.toml | awk -F' = ' '{print $2}' | tr -d '"')
|
||||||
PACKAGE_NAME=$(grep -oP 'name = "\K[^"]+' pyproject.toml)
|
|
||||||
echo "package_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
|
if [[ "$TAG_VERSION" != "$PYPROJECT_VERSION" ]]; then
|
||||||
|
echo "Error: Tag version ($TAG_VERSION) does not match pyproject.toml version ($PYPROJECT_VERSION)." >&2
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Tag version matches pyproject.toml version: $TAG_VERSION. Proceeding with release."
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Check if version exists on PyPI
|
- name: Check if version exists on PyPI
|
||||||
# zizmor: ignore[template-injection]
|
# zizmor: ignore[template-injection]
|
||||||
run: |
|
run: |
|
||||||
PACKAGE_NAME=${{ steps.extract_info.outputs.package_name }}
|
|
||||||
NEW_VERSION=${{ steps.extract_info.outputs.tag_version }}
|
NEW_VERSION=${{ steps.extract_info.outputs.tag_version }}
|
||||||
|
|
||||||
response=$(curl -s "https://pypi.org/pypi/$PACKAGE_NAME/$NEW_VERSION/json")
|
response=$(curl -s "https://pypi.org/pypi/lerobot/$NEW_VERSION/json")
|
||||||
if echo "$response" | grep -q "message"; then
|
if echo "$response" | grep -q "message"; then
|
||||||
echo "Version $NEW_VERSION is available on PyPI. Proceeding with release."
|
echo "Version $NEW_VERSION is available on PyPI. Proceeding with release."
|
||||||
else
|
else
|
||||||
@@ -80,9 +88,46 @@ jobs:
|
|||||||
# zizmor: ignore[template-injection]
|
# zizmor: ignore[template-injection]
|
||||||
run: gh release create ${{ github.ref_name }} --release-name "Release ${{ github.ref_name }}" --generate-notes ./dist/*
|
run: gh release create ${{ github.ref_name }} --release-name "Release ${{ github.ref_name }}" --generate-notes ./dist/*
|
||||||
|
|
||||||
# TODO(Steven): Uncomment when ready to publish to PyPI
|
- name: Publish to PyPI
|
||||||
# - name: Publish to PyPI
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
# if: startsWith(github.ref, 'refs/tags/v')
|
uses: pypa/gh-action-pypi-publish@v1.12.4 # zizmor: ignore[unpinned-uses, use-trusted-publishing]
|
||||||
# uses: pypa/gh-action-pypi-publish@v1.12.4
|
with:
|
||||||
# with:
|
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
# password: ${{ secrets.PYPI_API_TOKEN }}
|
|
||||||
|
# This job runs end-to-end tests on the release
|
||||||
|
test-release:
|
||||||
|
name: Test Release
|
||||||
|
needs: [build-and-publish]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
env:
|
||||||
|
MUJOCO_GL: egl
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
lfs: true
|
||||||
|
persist-credentials: false
|
||||||
|
- name: Install apt dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update && sudo apt-get install -y build-essential \
|
||||||
|
git curl libglib2.0-0 libegl1-mesa-dev ffmpeg libusb-1.0-0-dev \
|
||||||
|
speech-dispatcher libgeos-dev portaudio19-dev
|
||||||
|
- name: Setup uv and Python
|
||||||
|
uses: astral-sh/setup-uv@v6 # zizmor: ignore[unpinned-uses]
|
||||||
|
with:
|
||||||
|
enable-cache: true
|
||||||
|
version: ${{ env.UV_VERSION }}
|
||||||
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
|
- name: Install lerobot release
|
||||||
|
run: uv run pip install lerobot==${{ needs.build-and-publish.outputs.version }} # zizmor: ignore[template-injection]
|
||||||
|
|
||||||
|
- name: Check lerobot version
|
||||||
|
run: uv run lerobot --version
|
||||||
|
|
||||||
|
- name: Run end-to-end tests
|
||||||
|
run: uv run make test-end-to-end
|
||||||
|
|
||||||
|
|
||||||
|
# TODO(Steven): Publish draft/pre-release and to test pypi
|
||||||
|
# TODO(Steven): Tag documentation with the same version as the package
|
||||||
|
|||||||
@@ -156,6 +156,17 @@ all = [
|
|||||||
"lerobot[xarm]"
|
"lerobot[xarm]"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[project.scripts]
|
||||||
|
lerobot-calibrate="lerobot.calibrate:main"
|
||||||
|
lerobot-find-cameras="lerobot.find_cameras:main"
|
||||||
|
lerobot-find-port="lerobot.find_port:main"
|
||||||
|
lerobot-record="lerobot.record:main"
|
||||||
|
lerobot-replay="lerobot.replay:main"
|
||||||
|
lerobot-setup-motors="lerobot.setup_motors:main"
|
||||||
|
lerobot-teleoperate="lerobot.teleoperate:main"
|
||||||
|
lerobot-eval="lerobot.scripts.eval:main"
|
||||||
|
lerobot-train="lerobot.scripts.train:main"
|
||||||
|
|
||||||
# ---------------- Tool Configurations ----------------
|
# ---------------- Tool Configurations ----------------
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
where = ["src"]
|
where = ["src"]
|
||||||
|
|||||||
Reference in New Issue
Block a user