More CI cleanup, add style workflow (#107)

- Changes on the `test.yml` workflow:
  - Using poetry instead of pip. Contrary to what I wrote in #75, it is possible to use poetry (and have the benefits of shorter install times) without the need for having two separate versions of `pyproject.toml` and `poetry.lock`.
  - Reduce the trigger scope to only run when files in these directories are modified:
    - `lerobot/`
    - `tests/`
    - `examples/`
    - `.github/`
- Add `style.yml` workflow for doing a `ruff check` pass on the code
- More cleanup (removed deprecated workflow)
This commit is contained in:
Simon Alibert
2024-04-27 09:37:56 +02:00
committed by GitHub
parent 45f351c618
commit fdf6a0c4e3
12 changed files with 85 additions and 4188 deletions

View File

@@ -1,6 +1,6 @@
# Inspired by
# https://github.com/huggingface/peft/blob/main/.github/workflows/build_docker_images.yml
name: Nightly Builds
name: Builds
on:
workflow_dispatch:
@@ -8,10 +8,6 @@ on:
schedule:
- cron: "0 1 * * *"
# concurrency:
# group: docker-image-builds
# cancel-in-progress: false
env:
PYTHON_VERSION: "3.10"
# CI_SLACK_CHANNEL: ${{ secrets.CI_DOCKER_CHANNEL }}
@@ -40,6 +36,8 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
# HACK(aliberts): to be removed for release
# -----------------------------------------
- name: Checkout gym-aloha
uses: actions/checkout@v4
with:
@@ -61,8 +59,6 @@ jobs:
path: envs/gym-pusht
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
# HACK(aliberts): to be removed for release
# -----------------------------------------
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
@@ -134,6 +130,8 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
# HACK(aliberts): to be removed for release
# -----------------------------------------
- name: Checkout gym-aloha
uses: actions/checkout@v4
with:
@@ -155,8 +153,6 @@ jobs:
path: envs/gym-pusht
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
# HACK(aliberts): to be removed for release
# -----------------------------------------
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:

View File

@@ -1,6 +1,6 @@
# Inspired by
# https://github.com/huggingface/peft/blob/main/.github/workflows/nightly.yml
name: Nightly Tests
name: Nightly
on:
workflow_dispatch:
@@ -11,7 +11,6 @@ env:
DATA_DIR: tests/data
# SLACK_API_TOKEN: ${{ secrets.SLACK_API_TOKEN }}
jobs:
run_all_tests_cpu:
name: "Test CPU"
@@ -33,11 +32,13 @@ jobs:
env:
DATA_DIR: tests/data
run: pytest -v --cov=./lerobot --disable-warnings tests
- name: Tests end-to-end
env:
DATA_DIR: tests/data
run: make test-end-to-end
run_all_tests_single_gpu:
name: "Test GPU"
strategy:
@@ -59,6 +60,7 @@ jobs:
steps:
- name: Nvidia-smi
run: nvidia-smi
- name: Test
run: pytest -v --cov=./lerobot --cov-report=xml --disable-warnings tests
# TODO(aliberts): Link with HF Codecov account
@@ -69,14 +71,6 @@ jobs:
# verbose: true
- name: Tests end-to-end
run: make test-end-to-end
- name: Tailscale Wait
if: ${{ failure() || runner.debug == '1' }}
uses: huggingface/tailscale-action@v1
with:
waitForSSH: true
authkey: ${{ secrets.TAILSCALE_SSH_AUTHKEY }}
slackChannel: ${{ secrets.SLACK_CIFEEDBACK_CHANNEL }}
slackToken: ${{ secrets.SLACK_CIFEEDBACK_BOT_TOKEN }}
# - name: Generate Report
# if: always()

38
.github/workflows/style.yml vendored Normal file
View File

@@ -0,0 +1,38 @@
name: Style
on:
workflow_dispatch:
workflow_call:
pull_request:
branches:
- main
push:
branches:
- main
env:
PYTHON_VERSION: "3.10"
jobs:
ruff_check:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Get Ruff Version from pre-commit-config.yaml
id: get-ruff-version
run: |
RUFF_VERSION=$(awk '/repo: https:\/\/github.com\/astral-sh\/ruff-pre-commit/{flag=1;next}/rev:/{if(flag){print $2;exit}}' .pre-commit-config.yaml)
echo "RUFF_VERSION=${RUFF_VERSION}" >> $GITHUB_ENV
- name: Install Ruff
run: python -m pip install "ruff==${{ env.RUFF_VERSION }}"
- name: Run Ruff
run: ruff check .

View File

@@ -1,120 +0,0 @@
# name: Tests poetry
# on:
# pull_request:
# branches:
# - main
# push:
# branches:
# - main
# jobs:
# tests:
# runs-on: ubuntu-latest
# env:
# POETRY_VERSION: 1.8.2
# DATA_DIR: tests/data
# MUJOCO_GL: egl
# steps:
# #----------------------------------------------
# # check-out repo and set-up python
# #----------------------------------------------
# - name: Check out repository
# uses: actions/checkout@v4
# with:
# lfs: true
# - name: Set up python
# id: setup-python
# uses: actions/setup-python@v5
# with:
# python-version: '3.10'
# - name: Add SSH key for installing envs
# uses: webfactory/ssh-agent@v0.9.0
# with:
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
# #----------------------------------------------
# # install & configure poetry
# #----------------------------------------------
# - name: Load cached Poetry installation
# id: restore-poetry-cache
# uses: actions/cache/restore@v3
# with:
# path: ~/.local
# key: poetry-${{ env.POETRY_VERSION }}
# - name: Install Poetry
# if: steps.restore-poetry-cache.outputs.cache-hit != 'true'
# uses: snok/install-poetry@v1
# with:
# version: ${{ env.POETRY_VERSION }}
# virtualenvs-create: true
# installer-parallel: true
# - name: Save cached Poetry installation
# if: |
# steps.restore-poetry-cache.outputs.cache-hit != 'true' &&
# github.ref_name == 'main'
# id: save-poetry-cache
# uses: actions/cache/save@v3
# with:
# path: ~/.local
# key: poetry-${{ env.POETRY_VERSION }}
# - name: Configure Poetry
# run: poetry config virtualenvs.in-project true
# #----------------------------------------------
# # install dependencies
# #----------------------------------------------
# # TODO(aliberts): move to gpu runners
# - name: Select cpu dependencies # HACK
# run: cp -t . .github/poetry/cpu/pyproject.toml .github/poetry/cpu/poetry.lock
# - name: Load cached venv
# id: restore-dependencies-cache
# uses: actions/cache/restore@v3
# with:
# path: .venv
# key: venv-${{ steps.setup-python.outputs.python-version }}-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
# - name: Install dependencies
# if: steps.restore-dependencies-cache.outputs.cache-hit != 'true'
# run: poetry install --no-interaction --no-root --all-extras
# - name: Save cached venv
# if: |
# steps.restore-dependencies-cache.outputs.cache-hit != 'true' &&
# github.ref_name == 'main'
# id: save-dependencies-cache
# uses: actions/cache/save@v3
# with:
# path: .venv
# key: venv-${{ steps.setup-python.outputs.python-version }}-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
# - name: Install EGL
# run: sudo apt-get update && sudo apt-get install -y libegl1-mesa-dev
# #----------------------------------------------
# # install project
# #----------------------------------------------
# - name: Install project
# run: poetry install --no-interaction --all-extras
# #----------------------------------------------
# # run tests & coverage
# #----------------------------------------------
# - name: Run tests
# run: |
# source .venv/bin/activate
# pytest -v --cov=./lerobot tests
# #----------------------------------------------
# # run end-to-end tests
# #----------------------------------------------
# - name: Tests end-to-end
# run: |
# source .venv/bin/activate
# make test-end-to-end

View File

@@ -4,9 +4,19 @@ on:
pull_request:
branches:
- main
paths:
- "lerobot/**"
- "tests/**"
- "examples/**"
- ".github/**"
push:
branches:
- main
paths:
- "lerobot/**"
- "tests/**"
- "examples/**"
- ".github/**"
jobs:
tests:
@@ -21,26 +31,27 @@ jobs:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
lfs: true
- name: Install EGL
run: sudo apt-get update && sudo apt-get install -y libegl1-mesa-dev
- name: Install poetry
run: |
pipx install poetry && poetry config virtualenvs.in-project true
echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: ${{ (github.ref == 'refs/heads/main') && 'pip' || '' }}
cache-dependency-path: pyproject.toml
cache: "poetry"
- name: Install EGL
run: sudo apt-get update && sudo apt-get install -y libegl1-mesa-dev
- name: Install pip dependencies
- name: Install poetry dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[test, aloha, xarm, pusht]"
poetry install --all-extras
- name: Test with pytest
run: pytest -v --cov=./lerobot tests
run: pytest -v --cov=./lerobot --durations=0 tests
- name: Test end-to-end
run: make test-end-to-end