From 5161fe9a5062abd0bde2e8aca78a7676fd34659a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20G=C3=BCnther?= Date: Fri, 26 Apr 2024 14:51:25 +0200 Subject: [PATCH] CI: Add GitHub actions --- .flake8 | 9 +++++ .github/workflows/github-actions.yml | 53 ++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 .flake8 create mode 100644 .github/workflows/github-actions.yml diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..1edf3cd --- /dev/null +++ b/.flake8 @@ -0,0 +1,9 @@ +[flake8] +# The line length here has to match the black config in pyproject.toml +max-line-length = 120 +exclude = + .git, + __pycache__ +extend-ignore = + # See https://github.com/PyCQA/pycodestyle/issues/373 + E203, diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml new file mode 100644 index 0000000..bc7bc64 --- /dev/null +++ b/.github/workflows/github-actions.yml @@ -0,0 +1,53 @@ +name: Build and run ROS tests +on: + push: + pull_request: + workflow_dispatch: + inputs: + debug_enabled: + type: boolean + description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' + required: false + default: false +jobs: + build: + strategy: + matrix: + rosdistro: [humble, iron, rolling] + fail-fast: false + runs-on: ubuntu-latest + container: + image: ros:${{ matrix.rosdistro }}-ros-core + steps: + # Enable tmate debugging of manually-triggered workflows if the input option was provided + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} + with: + detached: true + - name: Install apt dependencies + run: | + apt-get update + apt-get install -y build-essential clang-format file git python3-pip python3-colcon-common-extensions python3-rosdep pre-commit + - name: Checkout repository + uses: actions/checkout@v4 + with: + path: src/rospy_message_converter + - name: Use rosdep to install remaining dependencies + run: | + rosdep init + rosdep update + rosdep install --from-paths src -i -y --rosdistro ${{ matrix.rosdistro }} + - name: Build + run: | + . /opt/ros/${{ matrix.rosdistro }}/setup.sh + colcon build --parallel-workers 1 + - name: Run tests + run: | + . install/setup.sh + colcon test --parallel-workers 1 + colcon test-result + - name: Run pre-commit hooks + run: | + cd src/rospy_message_converter + pre-commit run -a