Skip to content

Commit

Permalink
[CI] Run main tests with torchrl nightly and have a separate CI for t…
Browse files Browse the repository at this point in the history
…esting torchrl stable (#53)

* Amend

* Amend

* Amend

* Amend

* Amend

* Amend

* Amend

* Amend

* CI
  • Loading branch information
matteobettini authored Feb 1, 2024
1 parent 4db0745 commit ca33835
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 10 deletions.
7 changes: 2 additions & 5 deletions .github/unittest/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

python -m pip install --pre torch --extra-index-url https://download.pytorch.org/whl/nightly/cpu --force-reinstall

cd ..
python -m pip install git+https://github.com/pytorch-labs/tensordict.git
git clone https://github.com/pytorch/rl.git
cd rl
python setup.py develop
pip install torchrl

cd ../BenchMARL
pip install -e .
16 changes: 16 additions & 0 deletions .github/unittest/install_dependencies_nightly.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@


python -m pip install --upgrade pip
python -m pip install flake8 pytest pytest-cov hydra-core tqdm torch_geometric

if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

python -m pip install --pre torch --extra-index-url https://download.pytorch.org/whl/nightly/cpu --force-reinstall

cd ..
python -m pip install git+https://github.com/pytorch-labs/tensordict.git
git clone https://github.com/pytorch/rl.git
cd rl
python setup.py develop
cd ../BenchMARL
pip install -e .
2 changes: 1 addition & 1 deletion .github/unittest/install_vmas.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

python -m pip install git+https://github.com/proroklab/VectorizedMultiAgentSimulator.git
python -m pip install vmas
sudo apt-get update
sudo apt-get install python3-opengl xvfb
2 changes: 1 addition & 1 deletion .github/workflows/pettingzoo_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
bash .github/unittest/install_dependencies.sh
bash .github/unittest/install_dependencies_nightly.sh
- name: Install pettingzoo
run: |
bash .github/unittest/install_pettingzoo.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/smacv2_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
bash .github/unittest/install_dependencies.sh
bash .github/unittest/install_dependencies_nightly.sh
- name: Install smacv2
run: |
bash .github/unittest/install_smacv2.sh
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/torchrl_stable_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see:
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions


name: torchrl_stable_tests

on:
push:
branches: [ $default-branch , "main" ]
pull_request:
branches: [ $default-branch , "main" ]

permissions:
contents: read

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
bash .github/unittest/install_dependencies.sh
- name: Install vmas
run: |
bash .github/unittest/install_vmas.sh
- name: Install pettingzoo
run: |
bash .github/unittest/install_pettingzoo.sh
- if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'smacv2') }}
name: Install smacv2
run: |
bash .github/unittest/install_smacv2.sh
- name: Unit tests
run: |
root_dir="$(git rev-parse --show-toplevel)"
export SC2PATH="${root_dir}/StarCraftII"
echo 'SC2PATH is set to ' "$SC2PATH"
xvfb-run -s "-screen 0 1024x768x24" pytest test/ --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
bash .github/unittest/install_dependencies.sh
bash .github/unittest/install_dependencies_nightly.sh
- name: Test with pytest
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vmas_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
bash .github/unittest/install_dependencies.sh
bash .github/unittest/install_dependencies_nightly.sh
- name: Install vmas
run: |
bash .github/unittest/install_vmas.sh
Expand Down

0 comments on commit ca33835

Please sign in to comment.