From ff36c12dc454a318473dfc30351ec17241a6bcfb Mon Sep 17 00:00:00 2001 From: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com> Date: Mon, 27 Sep 2021 13:03:59 +0900 Subject: [PATCH 1/6] Judge merge base in sync rc (#422) Signed-off-by: wep21 --- .github/workflows/sync-rc-develop.yml | 90 --------------------------- .github/workflows/sync-rc.yml | 38 ++++++++--- 2 files changed, 30 insertions(+), 98 deletions(-) delete mode 100644 .github/workflows/sync-rc-develop.yml diff --git a/.github/workflows/sync-rc-develop.yml b/.github/workflows/sync-rc-develop.yml deleted file mode 100644 index 7d63b51760e29..0000000000000 --- a/.github/workflows/sync-rc-develop.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: sync rc develop - -on: - pull_request: - branches: - - "rc/*" - types: - - closed - workflow_dispatch: - inputs: - rc_branch: - description: "Target RC branch(e.g. rc/v1.0.0)" - required: true - -env: - BASE_BRANCH: develop - -jobs: - sync-rc: - runs-on: ubuntu-20.04 - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - ref: ${{ env.BASE_BRANCH }} - fetch-depth: 0 - - - name: Generate token - uses: tibdex/github-app-token@v1 - id: generate-token - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.APP_PRIVATE_KEY }} - - - name: Set SYNC_TARGET_BRANCH for pull_request event - if: github.event_name == 'pull_request' - run: | - echo "SYNC_TARGET_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV - - name: Set SYNC_TARGET_BRANCH for workflow_dispatch event - if: github.event_name == 'workflow_dispatch' - run: | - echo "SYNC_TARGET_BRANCH=${{ github.event.inputs.rc_branch }}" >> $GITHUB_ENV - - name: Set SYNC_BRANCH - run: | - echo ${SYNC_TARGET_BRANCH} | grep -e "^rc/v.*" - echo "SYNC_BRANCH=sync-rc/${SYNC_TARGET_BRANCH#refs/heads/}" >> $GITHUB_ENV - # To keep the base branch in "create-pull-request", checkout with "BASE_BRANCH" and reset to "SYNC_TARGET_BRANCH" - - name: Reset to sync target branch - run: | - git reset --hard origin/${{ env.SYNC_TARGET_BRANCH }} - - name: Set git config - run: | - git config --local user.email "actions@example.com" - git config --local user.name "Github Actions" - - name: Rebase on the base branch - run: | - for commit in $(git rev-list --left-only origin/${{ env.BASE_BRANCH }}...HEAD | tac); do - git rebase $commit || git rebase --abort - done - - name: Create PR - id: create_pr - uses: peter-evans/create-pull-request@v3 - with: - token: ${{ steps.generate-token.outputs.token }} - commit-message: sync rc develop - committer: GitHub - author: GitHub - signoff: false - base: ${{ env.BASE_BRANCH }} - branch: ${{ env.SYNC_BRANCH }} - delete-branch: true - title: sync rc develop - body: | - sync rc develop - labels: | - sync-rc-develop - draft: false - - - name: Check outputs - run: | - echo "Pull Request Number - ${{ steps.create_pr.outputs.pull-request-number }}" - echo "Pull Request URL - ${{ steps.create_pr.outputs.pull-request-url }}" - - name: Enable Auto-merge - if: steps.create_pr.outputs.pull-request-operation == 'created' - uses: peter-evans/enable-pull-request-automerge@v1 - with: - token: ${{ steps.generate-token.outputs.token }} - pull-request-number: ${{ steps.create_pr.outputs.pull-request-number }} - merge-method: squash diff --git a/.github/workflows/sync-rc.yml b/.github/workflows/sync-rc.yml index f3a6a35084e69..a45496720dfb2 100644 --- a/.github/workflows/sync-rc.yml +++ b/.github/workflows/sync-rc.yml @@ -12,9 +12,6 @@ on: description: "Target RC branch(e.g. rc/v1.0.0)" required: true -env: - BASE_BRANCH: main - jobs: sync-rc: runs-on: ubuntu-20.04 @@ -23,7 +20,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 with: - ref: ${{ env.BASE_BRANCH }} fetch-depth: 0 - name: Generate token @@ -48,6 +44,31 @@ jobs: echo ${SYNC_TARGET_BRANCH} | grep -e "^rc/v.*" echo "SYNC_BRANCH=sync-rc/${SYNC_TARGET_BRANCH#refs/heads/}" >> $GITHUB_ENV + - name: Judge BASE_BRANCH + run: | + function is_main_base() { + target_branch="$1" + + main_base=$(git merge-base "${target_branch}" origin/main) + develop_base=$(git merge-base "${target_branch}" origin/develop) + + return $(test "${main_base}" = "${develop_base}") + } + + if is_main_base "origin/${{ env.SYNC_TARGET_BRANCH }}"; then + base_branch=main + else + base_branch=develop + fi + + echo "BASE_BRANCH=${base_branch}" >> $GITHUB_ENV + + - name: Checkout repository + uses: actions/checkout@v2 + with: + ref: ${{ env.BASE_BRANCH }} + fetch-depth: 0 + # To keep the base branch in "create-pull-request", checkout with "BASE_BRANCH" and reset to "SYNC_TARGET_BRANCH" - name: Reset to sync target branch run: | @@ -60,8 +81,9 @@ jobs: - name: Rebase on the base branch run: | - for commit in $(git rev-list --left-only origin/${{ env.BASE_BRANCH }}...HEAD | tac); do - git rebase $commit || git rebase --abort + for commit in $(git rev-list --left-only "origin/${{ env.BASE_BRANCH }}"...HEAD | tac); do + merge_base=$(git merge-base HEAD "origin/${{ env.BASE_BRANCH }}") + git rebase --onto "$commit" "$merge_base" "${{ env.BASE_BRANCH }}" || git rebase --abort done - name: Create PR @@ -76,9 +98,9 @@ jobs: base: ${{ env.BASE_BRANCH }} branch: ${{ env.SYNC_BRANCH }} delete-branch: true - title: sync rc + title: sync rc ${{ env.SYNC_TARGET_BRANCH }} body: | - sync rc + sync rc ${{ env.SYNC_TARGET_BRANCH }} labels: | sync-rc draft: false From 1ccc97034f84f67d8ff000a308b58ffa9be58091 Mon Sep 17 00:00:00 2001 From: Hiroki OTA Date: Mon, 27 Sep 2021 16:06:58 +0900 Subject: [PATCH 2/6] modify util.launch in localization_launch #396 --- ...op_box_filter_measurement_range.param.yaml | 11 ++ .../random_downsample_filter.param.yaml | 3 + .../config/voxel_grid_filter.param.yaml | 5 + .../launch/util/util.launch.py | 106 ++++++++++++++---- .../launch/util/util.launch.xml | 3 - 5 files changed, 104 insertions(+), 24 deletions(-) create mode 100644 localization_launch/config/crop_box_filter_measurement_range.param.yaml create mode 100644 localization_launch/config/random_downsample_filter.param.yaml create mode 100644 localization_launch/config/voxel_grid_filter.param.yaml diff --git a/localization_launch/config/crop_box_filter_measurement_range.param.yaml b/localization_launch/config/crop_box_filter_measurement_range.param.yaml new file mode 100644 index 0000000000000..ad5542315410e --- /dev/null +++ b/localization_launch/config/crop_box_filter_measurement_range.param.yaml @@ -0,0 +1,11 @@ +/**: + ros__parameters: + input_frame: "base_link" + output_frame: "base_link" + min_x: -60.0 + max_x: 60.0 + min_y: -60.0 + max_y: 60.0 + min_z: -30.0 + max_z: 50.0 + negative: False diff --git a/localization_launch/config/random_downsample_filter.param.yaml b/localization_launch/config/random_downsample_filter.param.yaml new file mode 100644 index 0000000000000..53be849e0af22 --- /dev/null +++ b/localization_launch/config/random_downsample_filter.param.yaml @@ -0,0 +1,3 @@ +/**: + ros__parameters: + sample_num: 1500 diff --git a/localization_launch/config/voxel_grid_filter.param.yaml b/localization_launch/config/voxel_grid_filter.param.yaml new file mode 100644 index 0000000000000..51a7ee9d89b6b --- /dev/null +++ b/localization_launch/config/voxel_grid_filter.param.yaml @@ -0,0 +1,5 @@ +/**: + ros__parameters: + voxel_size_x: 3.0 + voxel_size_y: 3.0 + voxel_size_z: 3.0 diff --git a/localization_launch/launch/util/util.launch.py b/localization_launch/launch/util/util.launch.py index bde66951be185..055eca0450c1a 100644 --- a/localization_launch/launch/util/util.launch.py +++ b/localization_launch/launch/util/util.launch.py @@ -13,13 +13,22 @@ # limitations under the License. import launch +from launch.actions import DeclareLaunchArgument +from launch.actions import OpaqueFunction from launch.conditions import LaunchConfigurationNotEquals from launch.substitutions import LaunchConfiguration from launch_ros.actions import LoadComposableNodes from launch_ros.descriptions import ComposableNode +from launch_ros.substitutions import FindPackageShare +import yaml -def generate_launch_description(): +def launch_setup(context, *args, **kwargs): + # https://github.com/ros2/launch_ros/issues/156 + def load_composable_node_param(param_path): + with open(LaunchConfiguration(param_path).perform(context), 'r') as f: + return yaml.safe_load(f)['/**']['ros__parameters'] + crop_box_component = ComposableNode( package='pointcloud_preprocessor', plugin='pointcloud_preprocessor::CropBoxFilterComponent', @@ -29,17 +38,9 @@ def generate_launch_description(): ('output', LaunchConfiguration('output_measurement_range_sensor_points_topic')), ], - parameters=[{ - 'input_frame': LaunchConfiguration('base_frame'), - 'output_frame': LaunchConfiguration('base_frame'), - 'min_x': -60.0, - 'max_x': 60.0, - 'min_y': -60.0, - 'max_y': 60.0, - 'min_z': -30.0, - 'max_z': 50.0, - 'negative': False, - }], + parameters=[ + load_composable_node_param('crop_box_filter_measurement_range_param_path'), + ], extra_arguments=[{ 'use_intra_process_comms': LaunchConfiguration('use_intra_process') }], @@ -54,11 +55,7 @@ def generate_launch_description(): ('output', LaunchConfiguration('output_voxel_grid_downsample_sensor_points_topic')), ], - parameters=[{ - 'voxel_size_x': 3.0, - 'voxel_size_y': 3.0, - 'voxel_size_z': 3.0, - }], + parameters=[load_composable_node_param('voxel_grid_downsample_filter_param_path')], extra_arguments=[{ 'use_intra_process_comms': LaunchConfiguration('use_intra_process') }], @@ -73,9 +70,9 @@ def generate_launch_description(): ('output', LaunchConfiguration('output_downsample_sensor_points_topic')), ], - parameters=[{ - 'sample_num': 1500, - }], + parameters=[ + load_composable_node_param('random_downsample_filter_param_path') + ], extra_arguments=[{ 'use_intra_process_comms': LaunchConfiguration('use_intra_process') }], @@ -90,4 +87,71 @@ def generate_launch_description(): composable_node_descriptions=composable_nodes, target_container=LaunchConfiguration('container'), ) - return launch.LaunchDescription([load_composable_nodes]) + + return [load_composable_nodes] + + +def generate_launch_description(): + launch_arguments = [] + + def add_launch_arg(name: str, default_value=None, description=None): + arg = DeclareLaunchArgument(name, default_value=default_value, description=description) + launch_arguments.append(arg) + + add_launch_arg( + 'crop_box_filter_measurement_range_param_path', + [ + FindPackageShare('localization_launch'), + '/config/crop_box_filter_measurement_range.param.yaml' + ], + 'path to the parameter file of crop_box_filter_measurement_range' + ) + add_launch_arg( + 'voxel_grid_downsample_filter_param_path', + [ + FindPackageShare('localization_launch'), + '/config/voxel_grid_filter.param.yaml' + ], + 'path to the parameter file of voxel_grid_downsample_filter' + ) + add_launch_arg( + 'random_downsample_filter_param_path', + [ + FindPackageShare('localization_launch'), + '/config/random_downsample_filter.param.yaml' + ], + 'path to the parameter file of random_downsample_filter' + ) + add_launch_arg('use_intra_process', 'true', 'use ROS2 component container communication') + add_launch_arg( + 'container', + '/sensing/lidar/top/pointcloud_preprocessor/velodyne_node_container', + 'container name' + ) + add_launch_arg( + 'input_sensor_points_topic', + '/sensing/lidar/top/rectified/pointcloud', + 'input topic name for raw pointcloud' + ) + add_launch_arg( + 'output_measurement_range_sensor_points_topic', + 'measurement_range/pointcloud', + 'output topic name for crop box filter' + ) + add_launch_arg( + 'output_voxel_grid_downsample_sensor_points_topic', + 'voxel_grid_downsample/pointcloud', + 'output topic name for voxel grid downsample filter' + ) + add_launch_arg( + 'output_downsample_sensor_points_topic', + 'downsample/pointcloud', + 'output topic name for downsample filter. this is final output' + ) + + return launch.LaunchDescription( + launch_arguments + + [ + OpaqueFunction(function=launch_setup) + ] + ) diff --git a/localization_launch/launch/util/util.launch.xml b/localization_launch/launch/util/util.launch.xml index 5ea9bfce95b05..6d2cc29549aa6 100644 --- a/localization_launch/launch/util/util.launch.xml +++ b/localization_launch/launch/util/util.launch.xml @@ -7,9 +7,6 @@ - - - From efe60c66cb1c64785b7ea78118b926f7c7a3487d Mon Sep 17 00:00:00 2001 From: Keisuke Shima <19993104+KeisukeShima@users.noreply.github.com> Date: Tue, 28 Sep 2021 09:28:02 +0900 Subject: [PATCH 3/6] add update-pre-commit job (#423) --- .github/workflows/update-pre-commit.yml | 42 +++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/update-pre-commit.yml diff --git a/.github/workflows/update-pre-commit.yml b/.github/workflows/update-pre-commit.yml new file mode 100644 index 0000000000000..f18fd623862c4 --- /dev/null +++ b/.github/workflows/update-pre-commit.yml @@ -0,0 +1,42 @@ +name: Update pre-commit + +on: + schedule: + - cron: "0 19 * * *" # run at 4 AM JST + workflow_dispatch: + +jobs: + update-pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Generate token + uses: tibdex/github-app-token@v1 + id: generate-token + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_PRIVATE_KEY }} + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install pre-commit + run: pip install pre-commit + + - name: Run pre-commit autoupdate + run: pre-commit autoupdate + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ steps.generate-token.outputs.token }} + base: main + branch: update/pre-commit-autoupdate + title: Auto-update pre-commit hooks + commit-message: Auto-update pre-commit hooks + body: | + Update versions of tools in pre-commit configs to latest version + labels: dependencies From 7a84b68e0cbbb13be3852f25b5cf4c7044018b8b Mon Sep 17 00:00:00 2001 From: Keisuke Shima <19993104+KeisukeShima@users.noreply.github.com> Date: Tue, 28 Sep 2021 12:20:25 +0900 Subject: [PATCH 4/6] update pre-commit-hooks-ros to v0.2.0 (#425) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5b8232fe21cc2..c46b1b0ff9f59 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -45,9 +45,9 @@ repos: - id: prettier - repo: https://github.com/tier4/pre-commit-hooks-ros - rev: v0.1.2 + rev: v0.2.0 hooks: - - id: prettier-xml + - id: prettier-package-xml - id: sort-package-xml - repo: https://github.com/gruntwork-io/pre-commit From fb68263926381e33593fc9b794fcd6134a5a768a Mon Sep 17 00:00:00 2001 From: "autoware-iv-sync-ci[bot]" <87871706+autoware-iv-sync-ci[bot]@users.noreply.github.com> Date: Tue, 28 Sep 2021 12:26:19 +0900 Subject: [PATCH 5/6] Auto-update pre-commit hooks (#426) Co-authored-by: KeisukeShima --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c46b1b0ff9f59..3902e171df47d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,13 +34,13 @@ repos: args: [--markdown-linebreak-ext=md] - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.27.1 + rev: v0.28.1 hooks: - id: markdownlint args: ["-c", ".markdownlint.yaml", "--fix"] - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.3.2 + rev: v2.4.1 hooks: - id: prettier @@ -51,7 +51,7 @@ repos: - id: sort-package-xml - repo: https://github.com/gruntwork-io/pre-commit - rev: v0.1.12 + rev: v0.1.15 hooks: - id: shellcheck From b9fcdb4c0aa3df40485d79c6879cf04b5bb6526f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Sep 2021 22:22:24 +0900 Subject: [PATCH 6/6] Bump streetsidesoftware/cspell-action from 1.3.1 to 1.3.2 (#427) Bumps [streetsidesoftware/cspell-action](https://github.com/streetsidesoftware/cspell-action) from 1.3.1 to 1.3.2. - [Release notes](https://github.com/streetsidesoftware/cspell-action/releases) - [Changelog](https://github.com/streetsidesoftware/cspell-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/streetsidesoftware/cspell-action/compare/v1.3.1...v1.3.2) --- updated-dependencies: - dependency-name: streetsidesoftware/cspell-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/spell_check_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spell_check_pr.yml b/.github/workflows/spell_check_pr.yml index 93bf74ac4cf9b..bffc9ff7bf343 100644 --- a/.github/workflows/spell_check_pr.yml +++ b/.github/workflows/spell_check_pr.yml @@ -16,6 +16,6 @@ jobs: --output .github/workflows/.cspell.json \ https://raw.githubusercontent.com/tier4/autoware-spell-check-dict/main/cspell/.cspell.json - - uses: streetsidesoftware/cspell-action@v1.3.1 + - uses: streetsidesoftware/cspell-action@v1.3.2 with: config: ".github/workflows/.cspell.json"