From 3d1dafedcc58d6fef33857bf89ce5c8b0e257028 Mon Sep 17 00:00:00 2001 From: Guillem DB Date: Fri, 30 Aug 2024 14:23:26 +0200 Subject: [PATCH] Add test job in CI --- .github/workflows/push.yml | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index be383b1..a70bd32 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -16,7 +16,7 @@ env: BOT_NAME: fragile-bot BOT_EMAIL: bot@fragile.tech DOCKER_ORG: fragiletech - PIP_CACHE: | + LOCAL_CACHE: | ~/.cache/pip ~/.local/bin ~/.local/lib/python3.*/site-packages @@ -33,7 +33,7 @@ jobs: uses: actions/setup-python@v2 with: python-version: "3.10" - - name: Enable caching and define a custom cache key prefix + - name: Setup Rye id: setup-rye uses: eifinger/setup-rye@v4 with: @@ -48,39 +48,46 @@ jobs: pytest: name: Run Pytest - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'Bump version')" strategy: matrix: - python-version: ['3.10'] + python-version: ['3.10', '3.11', '3.12'] steps: - name: actions/checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Setup Rye + id: setup-rye + uses: eifinger/setup-rye@v4 + with: + enable-cache: true + cache-prefix: ubuntu-latest-rye-test-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} - name: actions/cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: - path: ${{ env.PIP_CACHE }} - key: ubuntu-20.04-pip-test-${{ matrix.python-version }}-${{ hashFiles('requirements.txt', 'requirements-test.txt') }} - restore-keys: ubuntu-20.04-pip-test- + path: ${{ env.LOCAL_CACHE }} + key: ubuntu-latest-system-test-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} + restore-keys: ubuntu-latest-system-test - name: Install test and package dependencies run: | set -x + sudo apt-get install -y xvfb -y sudo MUJOCO_PATH=/home/runner/.mujoco/ make install-envs - pip install -r requirements-test.txt -r requirements.txt + rye pin --relaxed cpython@${{ matrix.python-version }} + rye sync --all-features ROM_PASSWORD=${{ secrets.ROM_PASSWORD }} make import-roms - pip install . - name: Test with pytest run: | set -x - make test-codecov + xvfb-run -s "-screen 0 1400x900x24" rye run test - name: Upload coverage report - if: ${{ matrix.python-version=='3.8' }} + if: ${{ matrix.python-version=='3.12' }} uses: codecov/codecov-action@v1 test-docker: