diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index afc8684..74a6f56 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -2,25 +2,18 @@ name: CI/CD on: push: - branches: - - '**' - tags-ignore: - - '**' + branches: ['**'] + tags-ignore: ['**'] pull_request: + workflow_dispatch: release: - types: - - published + types: [published] jobs: build_sdist: name: Build source distribution - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - python-version: - - 3.8 + runs-on: ubuntu-latest steps: @@ -30,35 +23,33 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-version }} + python-version: 3.8 - name: Install sdist dependencies - run: pip install wheel setuptools_scm cmake_build_extension + run: pip install build - name: Create sdist - run: python setup.py sdist + run: python -m build --sdist . - uses: actions/upload-artifact@v2 with: path: dist/*.tar.gz + name: dist test_sdist: name: Test source distribution - needs: [ build_sdist ] - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: fail-fast: false matrix: python-version: - 3.8 + - 3.9 steps: - uses: actions/checkout@master - - uses: actions/download-artifact@v2 - with: - name: artifact - path: dist + - run: git fetch --prune --unshallow - name: Set up Python uses: actions/setup-python@v2 @@ -70,43 +61,53 @@ jobs: wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add - sudo apt-add-repository "deb http://packages.osrfoundation.org/gazebo/ubuntu-$CHANNEL `lsb_release -cs` main" sudo apt-get update - sudo apt-get install ignition-$IGNITION_DISTRIBUTION libprotobuf17 + sudo apt-get install ignition-$IGNITION_DISTRIBUTION + pip install wheel env: CHANNEL: stable - IGNITION_DISTRIBUTION: dome + IGNITION_DISTRIBUTION: fortress - - name: Install sdist - run: pip -v install dist/*.tar.gz + - name: Install Python package + run: pip install .[all] - name: Run tests - run: pip install pytest && pytest tests + run: pytest + env: + IGN_GAZEBO_PHYSICS_ENGINE_PATH: /usr/lib/x86_64-linux-gnu - name: Valgrind if: failure() run: | sudo apt install valgrind pip install colour-valgrind - colour-valgrind pytest tests + colour-valgrind pytest . + env: + IGN_GAZEBO_PHYSICS_ENGINE_PATH: /usr/lib/x86_64-linux-gnu upload_pypi: name: Publish to PyPI - needs: [ test_sdist ] - runs-on: ubuntu-20.04 + needs: + - build_sdist + - test_sdist + runs-on: ubuntu-latest # Master branch produces pre-releases. # Tagged versions produce stable releases linked to GitHub releases. - if: | - github.repository == 'dic-iit/gazebo-scenario-plugins' && - ((github.event_name == 'release' && github.event.action == 'published') || - (github.event_name == 'push' && github.ref == 'refs/heads/master')) steps: - uses: actions/download-artifact@v2 with: - name: artifact + name: dist path: dist + - name: Inspect dist folder + run: ls -lah dist/ + - name: Publish to PyPI + if: | + github.repository == 'ami-iit/gazebo-scenario-plugins' && + ((github.event_name == 'release' && github.event.action == 'published') || + (github.event_name == 'push' && github.ref == 'refs/heads/master')) uses: pypa/gh-action-pypi-publish@master with: password: ${{ secrets.pypi_password }} diff --git a/pyproject.toml b/pyproject.toml index a2971cc..70d8b3c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,16 @@ +# Copyright (C) 2021 Istituto Italiano di Tecnologia (IIT). All rights reserved. +# This software may be modified and distributed under the terms of the +# GNU Lesser General Public License v2.1 or any later version. + [build-system] -requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4", "ninja", "gym-ignition", "cmake>=3.18.2", "cmake-build-extension"] build-backend = "setuptools.build_meta" +requires = [ + "wheel", + "setuptools>=45", + "setuptools_scm[toml]>=6.0", + "cmake-build-extension", + "scenario", +] + +[tool.setuptools_scm] +local_scheme = "dirty-tag" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..3a582e5 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,68 @@ +# Copyright (C) 2021 Istituto Italiano di Tecnologia (IIT). All rights reserved. +# This software may be modified and distributed under the terms of the +# GNU Lesser General Public License v2.1 or any later version. + +[metadata] +name = gazebo_scenario_plugins +description = Plugins for the Ignition Gazebo simulator implemented with ScenarIO. +long_description = file: README.md +long_description_content_type = text/markdown +author = Diego Ferigo +author_email = dgferigo@gmail.com +license = LGPL +license_file = LICENSE +platforms = linux +url = https://github.com/ami-iit/gazebo-scenario-plugins + +project_urls = + Changelog = https://github.com/ami-iit/gazebo-scenario-plugins/releases + Tracker = https://github.com/ami-iit/gazebo-scenario-plugins/issues + Source = https://github.com/ami-iit/gazebo-scenario-plugins + +keywords = + gazebo + ignition + simulation + robotics + plugin + +classifiers = + Development Status :: 4 - Beta + Operating System :: POSIX :: Linux + Topic :: Games/Entertainment :: Simulation + Topic :: Scientific/Engineering :: Physics + Framework :: Robot Framework + Intended Audience :: Developers + Intended Audience :: Science/Research + Programming Language :: C++ + Programming Language :: Python :: 3 + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: Implementation :: CPython + License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+) + +[options] +zip_safe = False +packages = find: +package_dir = + =python +python_requires = >=3.8 + +[options.packages.find] +where = python + +[options.extras_require] +test = + pytest + pytest-icdiff + numpy + gym + gym_ignition>=1.3.0 + gym_ignition_models +all = + %(test)s + +[tool:pytest] +addopts = -rsxX -v +testpaths = tests diff --git a/setup.py b/setup.py index b44865e..6677de7 100644 --- a/setup.py +++ b/setup.py @@ -1,61 +1,28 @@ +# Copyright (C) 2020 Istituto Italiano di Tecnologia (IIT). All rights reserved. +# This software may be modified and distributed under the terms of the +# GNU Lesser General Public License v2.1 or any later version. + from pathlib import Path -from setuptools import setup, find_packages -from cmake_build_extension import BuildExtension, CMakeExtension -# Read the contents of the README file -with open(Path(__file__).parent.absolute() / "README.md", encoding="utf-8") as f: - long_description = f.read() +import cmake_build_extension +import setuptools -setup( - name="gazebo-scenario-plugins", - author="Diego Ferigo", - author_email="diego.ferigo@iit.it", - description="Plugins for the Ignition Gazebo simulator implemented with ScenarI/O", - long_description=long_description, - long_description_content_type='text/markdown', - url="https://github.com/dic-iit/gazebo-scenario-plugins", - keywords="gazebo ignition simulation robotics plugin", - license="LGPL", - platforms=["linux"], - classifiers=[ - "Development Status :: 4 - Beta", - "Operating System :: POSIX :: Linux", - "Topic :: Games/Entertainment :: Simulation", - "Framework :: Robot Framework", - "Intended Audience :: Developers", - "Intended Audience :: Science/Research", - "Programming Language :: C++", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3 :: Only", - "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)", - ], - use_scm_version=dict(local_scheme="dirty-tag"), - python_requires='>=3.8', - install_requires=[ - "gym-ignition", - ], - setup_requires=[ - "cmake>=3.18.2", - "setuptools_scm", - "ninja", - "gym-ignition", - "cmake-build-extension", - ], - packages=find_packages("python"), - package_dir={'': "python"}, +setuptools.setup( ext_modules=[ - CMakeExtension(name="actuation_delay", - source_dir=str(Path(".") / "plugins" / "actuation_delay"), - install_prefix="gazebo_scenario_plugins", - cmake_depends_on=["scenario"], - disable_editable=True), - CMakeExtension(name="low_pass_target", - source_dir=str(Path(".") / "plugins" / "low_pass_target"), - install_prefix="gazebo_scenario_plugins", - cmake_depends_on=["scenario"], - disable_editable=True), + cmake_build_extension.CMakeExtension( + name="actuation_delay", + source_dir=str(Path(".") / "plugins" / "actuation_delay"), + install_prefix="gazebo_scenario_plugins", + cmake_depends_on=["scenario"], + disable_editable=True, + ), + cmake_build_extension.CMakeExtension( + name="low_pass_target", + source_dir=str(Path(".") / "plugins" / "low_pass_target"), + install_prefix="gazebo_scenario_plugins", + cmake_depends_on=["scenario"], + disable_editable=True, + ), ], - cmdclass=dict(build_ext=BuildExtension), - zip_safe=False, + cmdclass=dict(build_ext=cmake_build_extension.BuildExtension), ) diff --git a/tests/pytest.ini b/tests/pytest.ini deleted file mode 100644 index 26d107b..0000000 --- a/tests/pytest.ini +++ /dev/null @@ -1,2 +0,0 @@ -[pytest] -addopts = -rsxX -v