Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Introduce pyproject.toml and update some dependencies #1

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/run-example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Run Example

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
run-example:
name: Test / Run Example
strategy:
matrix:
os:
- "ubuntu-22.04"
- "ubuntu-latest"

runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version

- name: Install Poetry
run: |
pipx install poetry==1.8.2

- name: Install Dependencies
run: |
sudo rm -f /etc/apt/sources.list.d/archive_uri-*
sudo apt-get update
sudo apt-get install -y xorg-dev libglu1-mesa-dev

- name: Build evogym
run: |
echo "Python Version: $(python --version)"
echo "Poesy Version: $(poetry --version)"
poetry install --no-root
poetry build && poetry run python setup.py install

- name: Run Example
run: |
cd examples
poetry run python gym_test_without_render.py
64 changes: 34 additions & 30 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,50 @@
name: Testing

on: [push, pull_request]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
name: Test / Unit Test
strategy:
matrix:
os:
- "ubuntu-22.04"
- "ubuntu-latest"
python:
- "3.7"
- "3.8"
- "3.9"
runs-on: ubuntu-22.04

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python ${{ matrix.python }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Update deb repository
run: sudo apt-get update
- name: Install deb dependencies
run: sudo apt-get install -y xorg-dev libglu1-mesa-dev libglew-dev xvfb
- name: Install python dependencies
run: pip install -r requirements.txt
- name: Cache python wheel packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: wheel-cache-${{ hashFiles('requirements.txt') }}
- name: Install evolution gym
run: pip install -e .
python-version-file: .python-version

- name: Install Poetry
run: |
pipx install poetry==1.8.2

- name: Install Dependencies
run: |
sudo rm -f /etc/apt/sources.list.d/archive_uri-*
sudo apt-get update
sudo apt-get install -y xorg-dev libglu1-mesa-dev xvfb

- name: Build evogym
run: |
echo "Python Version: $(python --version)"
echo "Poesy Version: $(poetry --version)"
poetry install --no-root
poetry build && poetry run python setup.py install

- name: Run test
run: xvfb-run python -m unittest tests/test_render.py
run: xvfb-run poetry run python -m unittest tests/test_render.py
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ old/
*.sln
*.egg-info
dist/
venv/
build/
__pycache__/
examples/saved_data
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.8.18
26 changes: 0 additions & 26 deletions environment.yml

This file was deleted.

22 changes: 22 additions & 0 deletions examples/gym_test_without_render.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import gym
import evogym.envs
import time
from evogym import sample_robot


if __name__ == '__main__':

body, connections = sample_robot((5,5))
env = gym.make('Walker-v0', body=body)
env.reset()
start = time.time()

while True:
action = env.action_space.sample()-1
ob, reward, done, info = env.step(action)
now = time.time()

if done or now - start > 10:
break

env.close()
Loading
Loading