Speed up CI, add more checks (#115)

- Split pytest and end-to-end tests into separate jobs
- Add poetry check to ensure pyproject.toml and poetry.lock are in sync
- Add ruff format --diff to ensure style formatting is applied (fails if ruff would reformat anything)
This commit is contained in:
Simon Alibert
2024-04-29 23:05:55 +02:00
committed by GitHub
parent 1ec5f77f7c
commit 2765877f28
9 changed files with 88 additions and 21 deletions

View File

@@ -14,7 +14,7 @@ env:
jobs:
latest-cpu:
name: "Build CPU"
name: CPU
runs-on: ubuntu-latest
steps:
- name: Cleanup disk
@@ -109,7 +109,7 @@ jobs:
# SLACK_BOT_TOKEN: ${{ secrets.SLACK_CIFEEDBACK_BOT_TOKEN }}
latest-cuda:
name: "Build GPU"
name: GPU
runs-on: ubuntu-latest
steps:
- name: Cleanup disk

View File

@@ -13,7 +13,7 @@ env:
jobs:
run_all_tests_cpu:
name: "Test CPU"
name: CPU
strategy:
fail-fast: false
runs-on: ubuntu-latest
@@ -40,7 +40,7 @@ jobs:
run_all_tests_single_gpu:
name: "Test GPU"
name: GPU
strategy:
fail-fast: false
runs-on: [single-gpu, nvidia-gpu, t4, ci]

View File

@@ -1,4 +1,4 @@
name: Style
name: Quality
on:
workflow_dispatch:
@@ -14,7 +14,8 @@ env:
PYTHON_VERSION: "3.10"
jobs:
ruff_check:
style:
name: Style
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
@@ -34,5 +35,22 @@ jobs:
- name: Install Ruff
run: python -m pip install "ruff==${{ env.RUFF_VERSION }}"
- name: Run Ruff
run: ruff check .
- name: Ruff check
run: ruff check
- name: Ruff format
run: ruff format --diff
poetry_check:
name: Poetry check
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- name: Poetry check
run: poetry check

View File

@@ -1,6 +1,6 @@
# Inspired by
# https://github.com/huggingface/peft/blob/main/.github/workflows/test-docker-build.yml
name: Test Docker builds (PR)
name: Test Dockerfiles
on:
pull_request:
@@ -15,7 +15,7 @@ env:
jobs:
get_changed_files:
name: "Get all modified Dockerfiles"
name: Detect modified Dockerfiles
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
@@ -40,7 +40,7 @@ jobs:
build_modified_dockerfiles:
name: "Build all modified Docker images"
name: Build modified Docker images
needs: get_changed_files
runs-on: ubuntu-latest
if: ${{ needs.get_changed_files.outputs.matrix }} != ''

View File

@@ -21,7 +21,8 @@ on:
- "poetry.lock"
jobs:
tests:
pytest:
name: Pytest
runs-on: ubuntu-latest
env:
DATA_DIR: tests/data
@@ -60,6 +61,39 @@ jobs:
-W ignore::UserWarning:gymnasium.utils.env_checker:247 \
&& rm -rf tests/outputs outputs
end-to-end:
name: End-to-end
runs-on: ubuntu-latest
env:
DATA_DIR: tests/data
MUJOCO_GL: egl
steps:
- name: Add SSH key for installing envs
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: actions/checkout@v4
- 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: "poetry"
- name: Install poetry dependencies
run: |
poetry install --all-extras
- name: Test end-to-end
run: |
make test-end-to-end \