Skip to content

Commit

Permalink
Merge pull request #6 from ami-iit/feature/setup.cfg
Browse files Browse the repository at this point in the history
Update setuptools files introducing `setup.cfg`
  • Loading branch information
diegoferigo authored Oct 5, 2021
2 parents 3d8e170 + 75bcf4d commit 8cbd4d8
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 92 deletions.
69 changes: 35 additions & 34 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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
Expand All @@ -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 }}
Expand Down
15 changes: 14 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
68 changes: 68 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -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 = [email protected]
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
77 changes: 22 additions & 55 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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="[email protected]",
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),
)
2 changes: 0 additions & 2 deletions tests/pytest.ini

This file was deleted.

0 comments on commit 8cbd4d8

Please sign in to comment.