From ab2c481105050181242930078080cfed93977a49 Mon Sep 17 00:00:00 2001 From: Matteo Bettini Date: Fri, 19 Jan 2024 11:47:55 +0000 Subject: [PATCH 1/9] Amend --- .github/unittest/install_dependencies.sh | 7 +-- .../unittest/install_dependencies_nightly.sh | 16 +++++ .github/workflows/torchrl_nightly.yml | 63 +++++++++++++++++++ 3 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 .github/unittest/install_dependencies_nightly.sh create mode 100644 .github/workflows/torchrl_nightly.yml diff --git a/.github/unittest/install_dependencies.sh b/.github/unittest/install_dependencies.sh index e20187a3..0144dfd9 100644 --- a/.github/unittest/install_dependencies.sh +++ b/.github/unittest/install_dependencies.sh @@ -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 . diff --git a/.github/unittest/install_dependencies_nightly.sh b/.github/unittest/install_dependencies_nightly.sh new file mode 100644 index 00000000..e20187a3 --- /dev/null +++ b/.github/unittest/install_dependencies_nightly.sh @@ -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 . diff --git a/.github/workflows/torchrl_nightly.yml b/.github/workflows/torchrl_nightly.yml new file mode 100644 index 00000000..8677865c --- /dev/null +++ b/.github/workflows/torchrl_nightly.yml @@ -0,0 +1,63 @@ +# 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: vmas_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_nightly.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: | + pytest test/ --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html + + - name: Vmas tests + run: | + xvfb-run -s "-screen 0 1024x768x24" pytest test/test_vmas.py --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html + + - name: PettingZoo tests + run: | + xvfb-run -s "-screen 0 1024x768x24" pytest test/test_pettingzoo.py --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html + + - if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'smacv2') }} + name: Test with pytest + run: | + root_dir="$(git rev-parse --show-toplevel)" + export SC2PATH="${root_dir}/StarCraftII" + echo 'SC2PATH is set to ' "$SC2PATH" + + pytest test/test_smacv2.py --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html From 5287aa7ef49f419eecf5f5159e2eaad64a7c2e50 Mon Sep 17 00:00:00 2001 From: Matteo Bettini Date: Fri, 19 Jan 2024 11:50:10 +0000 Subject: [PATCH 2/9] Amend --- .github/unittest/install_vmas.sh | 2 +- .github/workflows/torchrl_nightly.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/unittest/install_vmas.sh b/.github/unittest/install_vmas.sh index 2789fcf6..86c7ebf4 100644 --- a/.github/unittest/install_vmas.sh +++ b/.github/unittest/install_vmas.sh @@ -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 diff --git a/.github/workflows/torchrl_nightly.yml b/.github/workflows/torchrl_nightly.yml index 8677865c..c260e6d7 100644 --- a/.github/workflows/torchrl_nightly.yml +++ b/.github/workflows/torchrl_nightly.yml @@ -54,7 +54,7 @@ jobs: xvfb-run -s "-screen 0 1024x768x24" pytest test/test_pettingzoo.py --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html - if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'smacv2') }} - name: Test with pytest + name: SMACv2 tests run: | root_dir="$(git rev-parse --show-toplevel)" export SC2PATH="${root_dir}/StarCraftII" From 8763d874ff802b927c3586f808c3b7235e12ad32 Mon Sep 17 00:00:00 2001 From: Matteo Bettini Date: Fri, 19 Jan 2024 11:53:01 +0000 Subject: [PATCH 3/9] Amend --- .../{torchrl_nightly.yml => torchrl_nightly_tests.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{torchrl_nightly.yml => torchrl_nightly_tests.yml} (98%) diff --git a/.github/workflows/torchrl_nightly.yml b/.github/workflows/torchrl_nightly_tests.yml similarity index 98% rename from .github/workflows/torchrl_nightly.yml rename to .github/workflows/torchrl_nightly_tests.yml index c260e6d7..f7e3320b 100644 --- a/.github/workflows/torchrl_nightly.yml +++ b/.github/workflows/torchrl_nightly_tests.yml @@ -3,7 +3,7 @@ # https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: vmas_tests +name: torchrl_nightly_tests on: push: From 889b1bc53741b9a79e88e7b120e78c7884729ed4 Mon Sep 17 00:00:00 2001 From: Matteo Bettini Date: Fri, 19 Jan 2024 12:06:58 +0000 Subject: [PATCH 4/9] Amend --- .github/workflows/pettingzoo_tests.yml | 2 +- .github/workflows/smacv2_tests.yml | 2 +- ...chrl_nightly_tests.yml => torchrl_stable_tests.yml} | 10 +++++----- .github/workflows/unit_tests.yml | 2 +- .github/workflows/vmas_tests.yml | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) rename .github/workflows/{torchrl_nightly_tests.yml => torchrl_stable_tests.yml} (79%) diff --git a/.github/workflows/pettingzoo_tests.yml b/.github/workflows/pettingzoo_tests.yml index bcb900e3..3fbd0125 100644 --- a/.github/workflows/pettingzoo_tests.yml +++ b/.github/workflows/pettingzoo_tests.yml @@ -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 diff --git a/.github/workflows/smacv2_tests.yml b/.github/workflows/smacv2_tests.yml index 7fed4f0a..20761a69 100644 --- a/.github/workflows/smacv2_tests.yml +++ b/.github/workflows/smacv2_tests.yml @@ -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 diff --git a/.github/workflows/torchrl_nightly_tests.yml b/.github/workflows/torchrl_stable_tests.yml similarity index 79% rename from .github/workflows/torchrl_nightly_tests.yml rename to .github/workflows/torchrl_stable_tests.yml index f7e3320b..af903f6f 100644 --- a/.github/workflows/torchrl_nightly_tests.yml +++ b/.github/workflows/torchrl_stable_tests.yml @@ -3,7 +3,7 @@ # https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: torchrl_nightly_tests +name: torchrl_stable_tests on: push: @@ -29,7 +29,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - bash .github/unittest/install_dependencies_nightly.sh + bash .github/unittest/install_dependencies.sh - name: Install vmas run: | bash .github/unittest/install_vmas.sh @@ -47,11 +47,11 @@ jobs: - name: Vmas tests run: | - xvfb-run -s "-screen 0 1024x768x24" pytest test/test_vmas.py --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html + xvfb-run -s "-screen 0 1024x768x24" pytest test/test_vmas.py -k 'not gnn' --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html - name: PettingZoo tests run: | - xvfb-run -s "-screen 0 1024x768x24" pytest test/test_pettingzoo.py --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html + xvfb-run -s "-screen 0 1024x768x24" pytest test/test_pettingzoo.py -k 'not gnn' --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html - if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'smacv2') }} name: SMACv2 tests @@ -60,4 +60,4 @@ jobs: export SC2PATH="${root_dir}/StarCraftII" echo 'SC2PATH is set to ' "$SC2PATH" - pytest test/test_smacv2.py --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html + pytest test/test_smacv2.py -k 'not gnn' --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 017842b0..a1736419 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -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: | diff --git a/.github/workflows/vmas_tests.yml b/.github/workflows/vmas_tests.yml index 9772acae..c42e8bd7 100644 --- a/.github/workflows/vmas_tests.yml +++ b/.github/workflows/vmas_tests.yml @@ -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 From 95f5eba2ad64a32ca2c0bb461b5cd21d0429a753 Mon Sep 17 00:00:00 2001 From: Matteo Bettini Date: Fri, 19 Jan 2024 12:20:08 +0000 Subject: [PATCH 5/9] Amend --- .github/workflows/torchrl_stable_tests.yml | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/.github/workflows/torchrl_stable_tests.yml b/.github/workflows/torchrl_stable_tests.yml index af903f6f..fad3e079 100644 --- a/.github/workflows/torchrl_stable_tests.yml +++ b/.github/workflows/torchrl_stable_tests.yml @@ -42,22 +42,9 @@ jobs: bash .github/unittest/install_smacv2.sh - name: Unit tests - run: | - pytest test/ --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html - - - name: Vmas tests - run: | - xvfb-run -s "-screen 0 1024x768x24" pytest test/test_vmas.py -k 'not gnn' --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html - - - name: PettingZoo tests - run: | - xvfb-run -s "-screen 0 1024x768x24" pytest test/test_pettingzoo.py -k 'not gnn' --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html - - - if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'smacv2') }} - name: SMACv2 tests run: | root_dir="$(git rev-parse --show-toplevel)" export SC2PATH="${root_dir}/StarCraftII" echo 'SC2PATH is set to ' "$SC2PATH" - pytest test/test_smacv2.py -k 'not gnn' --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html + xvfb-run -s "-screen 0 1024x768x24 pytest test/ --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html From acaeefb7faff18aaf714ca4414443d7445ff54c5 Mon Sep 17 00:00:00 2001 From: Matteo Bettini Date: Fri, 19 Jan 2024 12:21:09 +0000 Subject: [PATCH 6/9] Amend --- .github/workflows/torchrl_stable_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/torchrl_stable_tests.yml b/.github/workflows/torchrl_stable_tests.yml index fad3e079..8af14d12 100644 --- a/.github/workflows/torchrl_stable_tests.yml +++ b/.github/workflows/torchrl_stable_tests.yml @@ -47,4 +47,4 @@ jobs: 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 + xvfb-run -s "-screen 0 1024x768x24 pytest test/ -k 'not gnn' --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html From 42332130194ffc6fd43e674ed9edbafbe933f0dc Mon Sep 17 00:00:00 2001 From: Matteo Bettini Date: Fri, 19 Jan 2024 12:21:42 +0000 Subject: [PATCH 7/9] Amend --- .github/workflows/torchrl_stable_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/torchrl_stable_tests.yml b/.github/workflows/torchrl_stable_tests.yml index 8af14d12..27e7eb41 100644 --- a/.github/workflows/torchrl_stable_tests.yml +++ b/.github/workflows/torchrl_stable_tests.yml @@ -47,4 +47,4 @@ jobs: export SC2PATH="${root_dir}/StarCraftII" echo 'SC2PATH is set to ' "$SC2PATH" - xvfb-run -s "-screen 0 1024x768x24 pytest test/ -k 'not gnn' --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html + xvfb-run -s "-screen 0 1024x768x24" pytest test/ -k 'not gnn' --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html From ff57eef640c95af27234b12c0cf67f15587cb617 Mon Sep 17 00:00:00 2001 From: Matteo Bettini Date: Fri, 19 Jan 2024 15:34:17 +0000 Subject: [PATCH 8/9] Amend --- .github/workflows/torchrl_stable_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/torchrl_stable_tests.yml b/.github/workflows/torchrl_stable_tests.yml index 27e7eb41..3604b031 100644 --- a/.github/workflows/torchrl_stable_tests.yml +++ b/.github/workflows/torchrl_stable_tests.yml @@ -47,4 +47,4 @@ jobs: export SC2PATH="${root_dir}/StarCraftII" echo 'SC2PATH is set to ' "$SC2PATH" - xvfb-run -s "-screen 0 1024x768x24" pytest test/ -k 'not gnn' --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html + xvfb-run -s "-screen 0 1024x768x24" pytest test/ --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html From cf7551c0dde8747e341775e16dd55d922c6d097b Mon Sep 17 00:00:00 2001 From: Matteo Bettini Date: Thu, 1 Feb 2024 14:46:35 +0000 Subject: [PATCH 9/9] CI