[MISC] Use pre-commit, bump min py version -> 3.8 #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "*" | |
jobs: | |
install_with_pip3: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.8" | |
- name: Install with pip3 | |
run: | | |
pip3 install . | |
pip3 show slamcore_utils | |
- name: Install with pip3 + extras | |
run: | | |
pip3 install .[ros2] | |
pip3 show slamcore_utils | |
unittests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- os: "ubuntu-22.04" | |
python-version: "3.10.4" | |
steps: | |
- name: Set Env Variables | |
run: | | |
echo "APT_PACKAGES=ros-humble-ros2bag ros-humble-rosbag2 ros-humble-rosbag2-compression ros-humble-rosbag2-compression-zstd ros-humble-rosbag2-cpp ros-humble-rosbag2-interfaces ros-humble-rosbag2-py ros-humble-rosbag2-storage ros-humble-rosbag2-storage-default-plugins ros-humble-rosbag2-storage-mcap ros-humble-rosbag2-transport ros-humble-gps-msgs" >> "$GITHUB_ENV" | |
- uses: actions/checkout@v2 | |
- name: Setup ROS | |
uses: ros-tooling/setup-ros@v0.6 | |
with: | |
use-ros2-testing: false | |
required-ros-distributions: humble | |
- name: Install extras | |
run: "sudo apt-get update && sudo apt-get install $APT_PACKAGES" | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup Python Poetry | |
uses: abatilo/actions-poetry@v2.1.3 | |
with: | |
poetry-version: "1.6.1" | |
- name: Install prerequisites | |
run: "poetry version && poetry install --extras ros2" | |
- name: Run tests | |
run: "source /opt/ros/humble/setup.bash && poetry run pytest" | |
style_and_linters: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup ROS | |
uses: ros-tooling/setup-ros@v0.6 | |
with: | |
use-ros2-testing: false | |
required-ros-distributions: humble | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.8" | |
- name: Setup Python Poetry | |
uses: abatilo/actions-poetry@v2.1.3 | |
with: | |
poetry-version: "1.6.1" | |
- name: Install prerequisites | |
run: poetry install --extras ros2 | |
- name: Run style checkers and linters | |
run: poetry run pre-commit run --all-files | |
publish_package: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Publish package to pypi | |
uses: JRubics/poetry-publish@v1.16 | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
with: | |
pypi_token: ${{ secrets.PYPI_API_TOKEN }} | |
plugins: "poetry-dynamic-versioning[plugin]" |