Skip to content

Commit b725d86

Browse files
authored
Merge pull request #2 from legalaspro/fix-readme-badge-placeholders
feat: Add CI, code coverage, and Python version badges
2 parents 6d8c2d2 + c7ca589 commit b725d86

File tree

15 files changed

+112
-3
lines changed

15 files changed

+112
-3
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Python CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-version: ["3.11"] # As specified in README
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Python ${{ matrix.python-version }}
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
20+
- name: Cache pip dependencies
21+
uses: actions/cache@v3
22+
with:
23+
path: ~/.cache/pip
24+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/environment.yaml') }}
25+
restore-keys: |
26+
${{ runner.os }}-pip-
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install -r requirements.txt
32+
# Install the main project in development mode
33+
pip install -e .
34+
# The following is needed because of the editable install for the python/ sub-package
35+
pip install -e ./python
36+
37+
- name: Test with pytest
38+
run: |
39+
pytest
40+
41+
- name: Upload coverage reports to Codecov
42+
uses: codecov/codecov-action@v5
43+
with:
44+
token: ${{ secrets.CODECOV_TOKEN }} # User will need to set this up in GitHub secrets
45+
files: coverage.xml
46+
fail_ci_if_error: false
47+
48+
- name: Upload coverage.xml as artifact
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: coverage-report
52+
path: coverage.xml

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Unity Multi-Agent Reinforcement Learning
22

3+
[![Python Version](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
4+
[![CI Tests](https://github.com/legalaspro/unity_multiagent_rl/actions/workflows/ci.yml/badge.svg)](https://github.com/legalaspro/unity_multiagent_rl/actions/workflows/ci.yml)
5+
[![coverage status](https://codecov.io/gh/legalaspro/unity_multiagent_rl/branch/main/graph/badge.svg)](https://app.codecov.io/gh/legalaspro/unity_multiagent_rl)
6+
37
A multi-agent reinforcement learning framework for Unity environments. Provides implementations for training and evaluating MARL algorithms on collaborative and competitive tasks.
48

59
## 🎯 Project Overview

environment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ dependencies:
1111
- pyyaml>=6.0
1212
- grpcio>=1.62.0
1313
- python-dotenv>=1.0.0
14+
- pytest>=7.0.0
15+
- pytest-cov>=4.1.0
1416
- pip:
1517
- torch==2.2.2
1618
- tensorboard>=2.12.0

networks/__init__.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""
2+
Neural network modules for multi-agent reinforcement learning.
3+
4+
This package contains actor and critic networks, as well as utility modules
5+
for building neural network architectures.
6+
"""
7+
8+
from . import actors
9+
from . import critics
10+
from . import modules
11+
from . import utlis
12+
13+
__all__ = [
14+
'actors',
15+
'critics',
16+
'modules',
17+
'utlis'
18+
]

pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
[pytest]
2+
addopts = --cov=algos --cov=buffers --cov=envs --cov=evals --cov=networks --cov=runners --cov=utils --cov-report=xml:coverage.xml --cov-branch
23
filterwarnings =
34
ignore:Call to deprecated create function.*:DeprecationWarning:python.communicator_objects.*
45
ignore::DeprecationWarning:python.communicator_objects.*
56
ignore::DeprecationWarning
7+
norecursedirs = python .git .pytest_cache

python/tests/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
from unityagents import *
2-
from unitytrainers import *
1+
# Import only what's needed for tests to avoid TensorFlow dependency issues
2+
# The unitytrainers module imports TensorFlow which is not available in CI
3+
try:
4+
from unityagents import *
5+
except ImportError:
6+
pass
7+
8+
# Don't import unitytrainers to avoid TensorFlow dependency
9+
# from unitytrainers import *

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ python-dotenv>=1.0.0
1717

1818
# Testing
1919
pytest>=7.0.0
20-
pytest-mock
20+
pytest-mock
21+
pytest-cov>=2.5

setup.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from setuptools import setup, find_packages
2+
3+
setup(
4+
name="unity_multiagent_rl",
5+
version="0.1.0",
6+
description="Multi-Agent Reinforcement Learning for Unity Environments",
7+
author="Dmitri Manajev",
8+
author_email="[email protected]",
9+
url="https://github.com/legalspro/unity_multiagent_rl",
10+
packages=find_packages(exclude=["python", "python.*"]),
11+
install_requires=[
12+
"torch>=2.0.0",
13+
"numpy>=1.24.0",
14+
"gymnasium>=1.0.0",
15+
],
16+
)

tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Tests package

tests/algos/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Algorithm tests package

0 commit comments

Comments
 (0)