From 902502f6db45addeaa670c06cb8f06caaab3b272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Gallou=C3=A9dec?= <45557362+qgallouedec@users.noreply.github.com> Date: Mon, 10 Jun 2024 10:56:52 +0200 Subject: [PATCH 1/8] fix ci macos --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f4177f5e..fdb71c91 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,8 +7,12 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-latest, macos-13, windows-latest] python-version: ['3.7', '3.8', '3.9', '3.10'] + exclude: + # Exclude the combination of macOS-latest and Python 3.7 as arm64 doesn't support Python 3.7 + - os: macos-latest + python-version: '3.7' steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} From 0d17e18cb4e51207e95de4aae70c17dcc51ed84d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Gallou=C3=A9dec?= <45557362+qgallouedec@users.noreply.github.com> Date: Mon, 10 Jun 2024 11:02:38 +0200 Subject: [PATCH 2/8] is_success consistency --- panda_gym/envs/tasks/flip.py | 2 +- panda_gym/envs/tasks/pick_and_place.py | 2 +- panda_gym/envs/tasks/push.py | 2 +- panda_gym/envs/tasks/reach.py | 2 +- panda_gym/envs/tasks/slide.py | 2 +- panda_gym/envs/tasks/stack.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/panda_gym/envs/tasks/flip.py b/panda_gym/envs/tasks/flip.py index 1df64ceb..70723815 100644 --- a/panda_gym/envs/tasks/flip.py +++ b/panda_gym/envs/tasks/flip.py @@ -78,7 +78,7 @@ def _sample_object(self) -> Tuple[np.ndarray, np.ndarray]: object_rotation = np.zeros(3) return object_position, object_rotation - def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray) -> np.ndarray: + def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: Dict[str, Any] = {}) -> np.ndarray: d = angle_distance(achieved_goal, desired_goal) return np.array(d < self.distance_threshold, dtype=bool) diff --git a/panda_gym/envs/tasks/pick_and_place.py b/panda_gym/envs/tasks/pick_and_place.py index 47ef2c31..4ac55f1c 100644 --- a/panda_gym/envs/tasks/pick_and_place.py +++ b/panda_gym/envs/tasks/pick_and_place.py @@ -83,7 +83,7 @@ def _sample_object(self) -> np.ndarray: object_position += noise return object_position - def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray) -> np.ndarray: + def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: Dict[str, Any] = {}) -> np.ndarray: d = distance(achieved_goal, desired_goal) return np.array(d < self.distance_threshold, dtype=bool) diff --git a/panda_gym/envs/tasks/push.py b/panda_gym/envs/tasks/push.py index 364fd9d2..e3b53af5 100644 --- a/panda_gym/envs/tasks/push.py +++ b/panda_gym/envs/tasks/push.py @@ -85,7 +85,7 @@ def _sample_object(self) -> np.ndarray: object_position += noise return object_position - def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray) -> np.ndarray: + def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: Dict[str, Any] = {}) -> np.ndarray: d = distance(achieved_goal, desired_goal) return np.array(d < self.distance_threshold, dtype=bool) diff --git a/panda_gym/envs/tasks/reach.py b/panda_gym/envs/tasks/reach.py index 9949dcf2..abca7d47 100644 --- a/panda_gym/envs/tasks/reach.py +++ b/panda_gym/envs/tasks/reach.py @@ -52,7 +52,7 @@ def _sample_goal(self) -> np.ndarray: goal = self.np_random.uniform(self.goal_range_low, self.goal_range_high) return goal - def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray) -> np.ndarray: + def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: Dict[str, Any] = {}) -> np.ndarray: d = distance(achieved_goal, desired_goal) return np.array(d < self.distance_threshold, dtype=bool) diff --git a/panda_gym/envs/tasks/slide.py b/panda_gym/envs/tasks/slide.py index 04911360..047fb215 100644 --- a/panda_gym/envs/tasks/slide.py +++ b/panda_gym/envs/tasks/slide.py @@ -89,7 +89,7 @@ def _sample_object(self) -> np.ndarray: object_position += noise return object_position - def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray) -> np.ndarray: + def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: Dict[str, Any] = {}) -> np.ndarray: d = distance(achieved_goal, desired_goal) return np.array(d < self.distance_threshold, dtype=bool) diff --git a/panda_gym/envs/tasks/stack.py b/panda_gym/envs/tasks/stack.py index cde63cc1..919adabc 100644 --- a/panda_gym/envs/tasks/stack.py +++ b/panda_gym/envs/tasks/stack.py @@ -117,7 +117,7 @@ def _sample_objects(self) -> Tuple[np.ndarray, np.ndarray]: # if distance(object1_position, object2_position) > 0.1: return object1_position, object2_position - def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray) -> np.ndarray: + def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: Dict[str, Any] = {}) -> np.ndarray: # must be vectorized !! d = distance(achieved_goal, desired_goal) return np.array((d < self.distance_threshold), dtype=bool) From ea82d34c9da41a6de70f79223c989eedfff3d775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Gallou=C3=A9dec?= <45557362+qgallouedec@users.noreply.github.com> Date: Mon, 10 Jun 2024 11:12:05 +0200 Subject: [PATCH 3/8] signature for compute_reward --- panda_gym/envs/tasks/flip.py | 2 +- panda_gym/envs/tasks/pick_and_place.py | 2 +- panda_gym/envs/tasks/push.py | 2 +- panda_gym/envs/tasks/reach.py | 2 +- panda_gym/envs/tasks/slide.py | 2 +- panda_gym/envs/tasks/stack.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/panda_gym/envs/tasks/flip.py b/panda_gym/envs/tasks/flip.py index 70723815..6a549332 100644 --- a/panda_gym/envs/tasks/flip.py +++ b/panda_gym/envs/tasks/flip.py @@ -82,7 +82,7 @@ def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: d = angle_distance(achieved_goal, desired_goal) return np.array(d < self.distance_threshold, dtype=bool) - def compute_reward(self, achieved_goal, desired_goal, info: Dict[str, Any]) -> np.ndarray: + def compute_reward(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: Dict[str, Any] = {}) -> np.ndarray: d = angle_distance(achieved_goal, desired_goal) if self.reward_type == "sparse": return -np.array(d > self.distance_threshold, dtype=np.float32) diff --git a/panda_gym/envs/tasks/pick_and_place.py b/panda_gym/envs/tasks/pick_and_place.py index 4ac55f1c..610505c3 100644 --- a/panda_gym/envs/tasks/pick_and_place.py +++ b/panda_gym/envs/tasks/pick_and_place.py @@ -87,7 +87,7 @@ def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: d = distance(achieved_goal, desired_goal) return np.array(d < self.distance_threshold, dtype=bool) - def compute_reward(self, achieved_goal, desired_goal, info: Dict[str, Any]) -> np.ndarray: + def compute_reward(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: Dict[str, Any] = {}) -> np.ndarray: d = distance(achieved_goal, desired_goal) if self.reward_type == "sparse": return -np.array(d > self.distance_threshold, dtype=np.float32) diff --git a/panda_gym/envs/tasks/push.py b/panda_gym/envs/tasks/push.py index e3b53af5..d32322a4 100644 --- a/panda_gym/envs/tasks/push.py +++ b/panda_gym/envs/tasks/push.py @@ -89,7 +89,7 @@ def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: d = distance(achieved_goal, desired_goal) return np.array(d < self.distance_threshold, dtype=bool) - def compute_reward(self, achieved_goal, desired_goal, info: Dict[str, Any]) -> np.ndarray: + def compute_reward(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: Dict[str, Any] = {}) -> np.ndarray: d = distance(achieved_goal, desired_goal) if self.reward_type == "sparse": return -np.array(d > self.distance_threshold, dtype=np.float32) diff --git a/panda_gym/envs/tasks/reach.py b/panda_gym/envs/tasks/reach.py index abca7d47..3a3cdd15 100644 --- a/panda_gym/envs/tasks/reach.py +++ b/panda_gym/envs/tasks/reach.py @@ -56,7 +56,7 @@ def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: d = distance(achieved_goal, desired_goal) return np.array(d < self.distance_threshold, dtype=bool) - def compute_reward(self, achieved_goal, desired_goal, info: Dict[str, Any]) -> np.ndarray: + def compute_reward(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: Dict[str, Any] = {}) -> np.ndarray: d = distance(achieved_goal, desired_goal) if self.reward_type == "sparse": return -np.array(d > self.distance_threshold, dtype=np.float32) diff --git a/panda_gym/envs/tasks/slide.py b/panda_gym/envs/tasks/slide.py index 047fb215..3c40f5bb 100644 --- a/panda_gym/envs/tasks/slide.py +++ b/panda_gym/envs/tasks/slide.py @@ -93,7 +93,7 @@ def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: d = distance(achieved_goal, desired_goal) return np.array(d < self.distance_threshold, dtype=bool) - def compute_reward(self, achieved_goal, desired_goal, info: Dict[str, Any]) -> np.ndarray: + def compute_reward(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: Dict[str, Any] = {}) -> np.ndarray: d = distance(achieved_goal, desired_goal) if self.reward_type == "sparse": return -np.array(d > self.distance_threshold, dtype=np.float32) diff --git a/panda_gym/envs/tasks/stack.py b/panda_gym/envs/tasks/stack.py index 919adabc..85510766 100644 --- a/panda_gym/envs/tasks/stack.py +++ b/panda_gym/envs/tasks/stack.py @@ -122,7 +122,7 @@ def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: d = distance(achieved_goal, desired_goal) return np.array((d < self.distance_threshold), dtype=bool) - def compute_reward(self, achieved_goal, desired_goal, info: Dict[str, Any]) -> np.ndarray: + def compute_reward(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: Dict[str, Any] = {}) -> np.ndarray: d = distance(achieved_goal, desired_goal) if self.reward_type == "sparse": return -np.array((d > self.distance_threshold), dtype=np.float32) From 3a6cf6a81aa99fcb18eef43adb413278447682ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Gallou=C3=A9dec?= <45557362+qgallouedec@users.noreply.github.com> Date: Mon, 10 Jun 2024 11:41:01 +0200 Subject: [PATCH 4/8] update actions versions --- .github/workflows/build.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fdb71c91..2b1023e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,9 +14,9 @@ jobs: - os: macos-latest python-version: '3.7' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -38,13 +38,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Download coverage reports - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: coverage-report - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: directory: ./coverage/reports/ fail_ci_if_error: true @@ -54,9 +54,9 @@ jobs: codestyle_type_and_doc: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python 3.8 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.8 - name: Install dependencies From 1e8773686c1f1cd3a628221b0184bc2c1945967e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Gallou=C3=A9dec?= <45557362+qgallouedec@users.noreply.github.com> Date: Mon, 10 Jun 2024 11:45:38 +0200 Subject: [PATCH 5/8] try another ci --- .github/workflows/build.yml | 62 ++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2b1023e2..2e10a637 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,62 +14,66 @@ jobs: - os: macos-latest python-version: '3.7' steps: + # Check out the repository code - uses: actions/checkout@v4 + + # Set up the specified Python version - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + + # Install dependencies - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e . pip install pytest-cov + + # Run tests with pytest and generate coverage report - name: Test with pytest run: | pytest --cov=./ --cov-report=xml + + # Upload the coverage report as an artifact - name: Save coverage report uses: actions/upload-artifact@v2 with: name: coverage-report path: ./coverage.xml - - upload-coverage: - needs: test - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Download coverage reports - uses: actions/download-artifact@v4 - with: - name: coverage-report - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - with: - directory: ./coverage/reports/ - fail_ci_if_error: true - files: ./coverage.xml - name: codecov-umbrella - verbose: true - codestyle_type_and_doc: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.8 - uses: actions/setup-python@v5 - with: - python-version: 3.8 - - name: Install dependencies + + # Additional steps only for ubuntu-latest and Python 3.10 + # Install development dependencies + - name: Install dev dependencies + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' run: | - python -m pip install --upgrade pip pip install -e .[develop] + + # Run Pytype for type checking - name: Pytype + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' run: | pytype panda_gym + + # Check code style with black and isort - name: Check codestyle + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' run: | black -l 127 --check panda_gym test isort -l 127 --profile black --check panda_gym test + + # Build documentation - name: Make docs + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' run: | make html + + # Upload coverage to Codecov + - name: Upload coverage to Codecov + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' + uses: codecov/codecov-action@v4 + with: + files: ./coverage.xml + fail_ci_if_error: true + name: codecov-umbrella + verbose: true From cd505a14f66fb32c9d4b0dbee8a6bbc514b6af78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Gallou=C3=A9dec?= <45557362+qgallouedec@users.noreply.github.com> Date: Mon, 10 Jun 2024 11:48:34 +0200 Subject: [PATCH 6/8] secret token --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2e10a637..0698e6b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -77,3 +77,4 @@ jobs: fail_ci_if_error: true name: codecov-umbrella verbose: true + token: ${{ secrets.CODECOV_TOKEN }} # required From f87b40bc603df0f5582093a6b8bea5b3caac9d17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Gallou=C3=A9dec?= <45557362+qgallouedec@users.noreply.github.com> Date: Mon, 10 Jun 2024 11:52:47 +0200 Subject: [PATCH 7/8] build only pr --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0698e6b4..70e849e8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,6 @@ name: build -on: [push, pull_request] +on: [pull_request] jobs: test: @@ -37,7 +37,7 @@ jobs: # Upload the coverage report as an artifact - name: Save coverage report - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: coverage-report path: ./coverage.xml From a29561e53355d96060e011b36101f3d1e8eee598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Gallou=C3=A9dec?= <45557362+qgallouedec@users.noreply.github.com> Date: Mon, 10 Jun 2024 11:56:44 +0200 Subject: [PATCH 8/8] upload only py3.10 --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 70e849e8..0b45741c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,14 +35,15 @@ jobs: run: | pytest --cov=./ --cov-report=xml + # Additional steps only for ubuntu-latest and Python 3.10 # Upload the coverage report as an artifact - name: Save coverage report + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' uses: actions/upload-artifact@v4 with: name: coverage-report path: ./coverage.xml - - # Additional steps only for ubuntu-latest and Python 3.10 + # Install development dependencies - name: Install dev dependencies if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'