display to make xvfb pyautogui work #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python Tests | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
test: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: ["3.8"] # Reduced to just 3.8 since that's your target version | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache pip packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
# Install PyTorch first | |
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu | |
pip install -r requirements.txt | |
pip install pytest pytest-cov coverage-badge mypy flake8 black isort pre-commit | |
# Install pybullet for physics simulation tests | |
pip install pybullet | |
# Create symlink to ensure pytest is in PATH | |
sudo ln -s $(which pytest) /usr/local/bin/pytest | |
- name: Run pre-commit | |
run: | | |
pre-commit install | |
pre-commit run --all-files | |
# - name: Type checking with mypy | |
# run: mypy . | |
# - name: Lint with flake8 | |
# run: flake8 . --count --max-line-length=120 --statistics | |
# - name: Check formatting with black | |
# run: black --check . --line-length=120 | |
# - name: Check import sorting with isort | |
# run: isort --check-only --diff . | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y xvfb libgtk-3-dev libx11-xcb1 libxss1 libgconf-2-4 libnss3 libasound2 | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pytest pyautogui | |
- name: Run integration tests with virtual display | |
uses: GabrielBB/xvfb-action@v1 | |
with: | |
run: pytest -m integration --cov=./ --cov-report=xml | |
- name: Run tests with coverage | |
run: | | |
pytest tests/unit -v --cov=./ --cov-report=xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
flags: unittests | |
name: codecov-ainex | |
fail_ci_if_error: true # Enable this to catch upload issues | |
verbose: true # Add verbose output for debugging |