From 91c8be76a4538193ced7cc18adfbe9a8d0363b2c Mon Sep 17 00:00:00 2001 From: rafal-gorecki Date: Wed, 25 Oct 2023 15:48:10 +0200 Subject: [PATCH] Workflow + pre commit --- .github/workflows/black.yaml | 15 ------------- .github/workflows/bump_version.yaml | 17 +++++++------- .github/workflows/industrial_ci.yaml | 27 +++++++++++++++++++++-- .github/workflows/spellcheck.yaml | 15 ------------- .pre-commit-config.yaml | 7 +++--- rosbot_gazebo/launch/simulation.launch.py | 2 +- 6 files changed, 39 insertions(+), 44 deletions(-) delete mode 100644 .github/workflows/black.yaml delete mode 100644 .github/workflows/spellcheck.yaml diff --git a/.github/workflows/black.yaml b/.github/workflows/black.yaml deleted file mode 100644 index ab5e1b3f..00000000 --- a/.github/workflows/black.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -name: Black python lint - -on: - workflow_call: - push: - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: psf/black@stable - with: - options: --line-length=99 diff --git a/.github/workflows/bump_version.yaml b/.github/workflows/bump_version.yaml index 69d5b39d..8e017111 100644 --- a/.github/workflows/bump_version.yaml +++ b/.github/workflows/bump_version.yaml @@ -1,6 +1,5 @@ --- -name: Trigger rosbot-docker to build an image and bump version - +name: Bump version on: workflow_dispatch: inputs: @@ -13,10 +12,14 @@ on: types: [closed] jobs: + industrial_ci: + name: Industrial CI + uses: ./.github/workflows/industrial_ci.yaml + get-bump: - if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true name: Get version bump - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest + needs: industrial_ci outputs: bump: ${{ env.BUMP }} steps: @@ -30,9 +33,8 @@ jobs: run: echo "BUMP=${{ github.event.inputs.name }}" >> $GITHUB_ENV catkin-release: - if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true name: Bump version - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest needs: get-bump outputs: new_version: ${{ steps.catkin-release.outputs.new_version }} @@ -49,9 +51,8 @@ jobs: git_email: action-bot@action-bot.com build-and-push-docker-image: - if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true name: Create new docker image - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest needs: catkin-release steps: - name: trigger the endpoint diff --git a/.github/workflows/industrial_ci.yaml b/.github/workflows/industrial_ci.yaml index a3701751..8d146895 100644 --- a/.github/workflows/industrial_ci.yaml +++ b/.github/workflows/industrial_ci.yaml @@ -2,10 +2,33 @@ name: Industrial CI on: workflow_call: + workflow_dispatch: push: + jobs: - industrial_ci: + black: + name: Black + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: psf/black@stable + with: + options: --line-length=99 + + spellcheck: + name: Spellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: rojopolis/spellcheck-github-actions@0.33.1 + name: Spellcheck + + ros_industrial_ci: + name: ROS Industrial CI + needs: + - black + - spellcheck strategy: fail-fast: false matrix: @@ -15,7 +38,7 @@ jobs: - uses: actions/checkout@v3 - name: Clone installation requirements shell: bash - run: python3 -m pip install -U vcstool && vcs import . < ./rosbot/rosbot_hardware.repos && vcs import . < ./rosbot/rosbot_simulation.repos + run: python3 -m pip install -U vcstool && vcs import . < ./rosbot_xl/rosbot_xl_hardware.repos && vcs import . < ./rosbot_xl/rosbot_xl_simulation.repos - uses: ros-industrial/industrial_ci@master env: ROS_DISTRO: ${{matrix.ROS_DISTRO}} diff --git a/.github/workflows/spellcheck.yaml b/.github/workflows/spellcheck.yaml deleted file mode 100644 index 36f304fe..00000000 --- a/.github/workflows/spellcheck.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -name: Spellcheck Action - -on: - workflow_call: - push: - -jobs: - build: - name: Spellcheck - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: rojopolis/spellcheck-github-actions@0.33.1 - name: Spellcheck diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d3522021..a71dc9ba 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,16 +32,17 @@ repos: files: ^.github|./\.yaml - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.10.1 hooks: - id: black - args: ["--line-length=99"] + args: ["--line-length=99", "--experimental-string-processing"] - repo: https://github.com/PyCQA/flake8 rev: 6.1.0 hooks: - id: flake8 - args: ["--ignore=E501"] # ignore too long line, black checks it + args: ["--ignore=E501,W503"] # ignore too long line and line break before binary operator, + # black checks it - repo: local hooks: diff --git a/rosbot_gazebo/launch/simulation.launch.py b/rosbot_gazebo/launch/simulation.launch.py index 47e272cc..786c21a0 100644 --- a/rosbot_gazebo/launch/simulation.launch.py +++ b/rosbot_gazebo/launch/simulation.launch.py @@ -50,7 +50,7 @@ def generate_launch_description(): declare_headless_arg = DeclareLaunchArgument( "headless", default_value="False", - description=("Run Gazebo Ignition in the headless mode"), + description="Run Gazebo Ignition in the headless mode", ) headless_cfg = PythonExpression(