From 38929bfad6ccd93be9e96eefb3a7dad23cf424e9 Mon Sep 17 00:00:00 2001 From: "autoware-iv-sync-ci[bot]" <87871706+autoware-iv-sync-ci[bot]@users.noreply.github.com> Date: Fri, 17 Sep 2021 14:38:01 +0900 Subject: [PATCH] sync upstream (#24) * Improve build-pr CI (#405) Signed-off-by: Kenji Miyake * Add sync-public.yaml (#404) * Add sync-public.yaml Signed-off-by: Kenji Miyake * Add sync-public-develop.yaml Signed-off-by: Kenji Miyake * Fix pre-commit (#407) * Fix pre-commit errors Signed-off-by: Kenji Miyake * Fix package.xml Signed-off-by: Kenji Miyake * Add pre-commit (#406) * Add pre-commit Signed-off-by: Kenji Miyake * Add sort-package-xml Signed-off-by: Kenji Miyake * Update system.launch.xml (#411) * Handle empty output in get_modified_package.sh (#412) Signed-off-by: Kenji Miyake Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> Co-authored-by: Taichi Higashide Co-authored-by: Hiroki OTA --- .github/get_modified_package.sh | 76 ++++++++++++++++++++++ .github/workflows/build_and_test_pr.yml | 5 +- .github/workflows/get_modified_package.sh | 62 ------------------ .github/workflows/pre-commit.yaml | 21 ++++++ .github/workflows/sync-public-develop.yaml | 40 ++++++++++++ .github/workflows/sync-public.yaml | 40 ++++++++++++ .markdownlint.yaml | 6 ++ .pre-commit-config.yaml | 58 +++++++++++++++++ .prettierrc.yaml | 2 + autoware_api_launch/package.xml | 2 +- autoware_launch/package.xml | 17 ++--- control_launch/package.xml | 4 +- integration_launch/package.xml | 13 ++-- localization_launch/package.xml | 4 +- perception_launch/README.md | 1 - perception_launch/package.xml | 11 ++-- planning_launch/launch/planning.launch.xml | 2 +- system_launch/launch/system.launch.xml | 3 +- system_launch/package.xml | 4 +- vehicle_launch/README.md | 8 +-- vehicle_launch/package.xml | 2 +- 21 files changed, 273 insertions(+), 108 deletions(-) create mode 100755 .github/get_modified_package.sh delete mode 100755 .github/workflows/get_modified_package.sh create mode 100644 .github/workflows/pre-commit.yaml create mode 100644 .github/workflows/sync-public-develop.yaml create mode 100644 .github/workflows/sync-public.yaml create mode 100644 .markdownlint.yaml create mode 100644 .pre-commit-config.yaml create mode 100644 .prettierrc.yaml diff --git a/.github/get_modified_package.sh b/.github/get_modified_package.sh new file mode 100755 index 000000000..cc99e534a --- /dev/null +++ b/.github/get_modified_package.sh @@ -0,0 +1,76 @@ +#!/bin/bash +# Search for packages that have been modified from the main branch. +# Usage: get_modified_package.sh + +set -e + +SCRIPT_DIR=$(readlink -f "$(dirname "$0")") +ROOT_DIR=$(readlink -f "$SCRIPT_DIR"/../) + +# Parse arguments +args=() +while [ "${1:-}" != "" ]; do + case "$1" in + *) + args+=("$1") + ;; + esac + shift +done + +base_branch="${args[0]}" + +# Check args +if [ "$base_branch" = "" ]; then + echo -e "\e[31mPlease input a valid base_branch as the 1st argument.\e[m" + exit 1 +fi + +function find_package_dir() { + [ "$1" == "" ] && return 1 + + target_dir=$(dirname "$1") + while true ; do + parent_dir=$(dirname "$target_dir") + + # Exit if no parent found + if [ "$parent_dir" = "$target_dir" ] ; then + return 0 + fi + + # Output package name if package.xml found + if [ -f "$target_dir/package.xml" ] ; then + if [ ! -f "$target_dir/COLCON_IGNORE" ] ; then + echo "$target_dir" + return 0 + fi + fi + + # Move to parent dir + target_dir=$parent_dir + done + + return 1 +} + +# Find modified files from base branch +modified_files=$(git diff --name-only "$base_branch"...HEAD) + +# Find modified packages +modified_package_dirs=() +for modified_file in $modified_files; do + modified_package_dir=$(find_package_dir "$ROOT_DIR/$modified_file") + + if [ "$modified_package_dir" != "" ] ; then + modified_package_dirs+=("$modified_package_dir") + fi +done + +# Get package names from paths +if [ "${#modified_package_dirs[@]}" != "0" ] ; then + modified_packages=$(colcon list --names-only --paths "${modified_package_dirs[@]}") +fi + +# Output +# shellcheck disable=SC2086 +echo ::set-output name=package_list::$modified_packages diff --git a/.github/workflows/build_and_test_pr.yml b/.github/workflows/build_and_test_pr.yml index 4998bcf9e..144bff161 100644 --- a/.github/workflows/build_and_test_pr.yml +++ b/.github/workflows/build_and_test_pr.yml @@ -2,7 +2,6 @@ name: Build and test for PR on: pull_request: - workflow_dispatch: jobs: build-and-test-pr: @@ -24,10 +23,10 @@ jobs: apt-get -y update apt-get -y install python3-pip - - name: Search modified package + - name: Search modified packages id: list_packages run: | - ${GITHUB_WORKSPACE}/.github/workflows/get_modified_package.sh + ${GITHUB_WORKSPACE}/.github/get_modified_package.sh origin/${{ github.base_ref }} - name: Show target packages run: | diff --git a/.github/workflows/get_modified_package.sh b/.github/workflows/get_modified_package.sh deleted file mode 100755 index 696d112d3..000000000 --- a/.github/workflows/get_modified_package.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash -# Search for packages that have been modified from the main branch. - -set -e - -SCRIPT_DIR=$(cd $(dirname $0); pwd) -ROOT_DIR=$(readlink -f $SCRIPT_DIR/../../) - -function get_package_name_from_xml() { - [ "$1" == "" ] && return 1 - - # Get tag in package.xml - sed -rz "s|.*\s*([a-zA-Z_0-9]+)\s*.*|\1|" < "$1" - - return 0 -} - -function find_package_from_file() { - [ "$1" == "" ] && return 1 - - target_dir=$(dirname $1) - while true ; do - parent_dir=$(dirname "$target_dir") - - # Exit if no parent found - if [ "$parent_dir" = "$target_dir" ] ; then - return 0 - fi - - # Output package name if package.xml found - if [ -f "$target_dir/package.xml" ] ; then - get_package_name_from_xml "$target_dir"/package.xml - return 0 - fi - - # Move to parent dir - target_dir=$parent_dir - done - - return 1 -} - -# Find modified files after merging origin/main -merge_base=$(git merge-base HEAD origin/main) -modified_files=$(git diff --name-only "$merge_base") - -# Find modified packages -for modified_file in $modified_files; do - modified_package=$(find_package_from_file "$ROOT_DIR/$modified_file") - - if [ "$modified_package" != "" ] ; then - modified_packages="$modified_packages $modified_package" - fi -done - -# Remove duplicates -# shellcheck disable=SC2086 -unique_modified_packages=$(printf "%s\n" $modified_packages | sort | uniq) - -# Output -# shellcheck disable=SC2086 -echo ::set-output name=package_list::$unique_modified_packages diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml new file mode 100644 index 000000000..22e56ca2b --- /dev/null +++ b/.github/workflows/pre-commit.yaml @@ -0,0 +1,21 @@ +name: pre-commit + +on: + pull_request: + workflow_dispatch: + +jobs: + pre-commit: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup Python + uses: actions/setup-python@v2 + + - name: Run pre-commit + uses: pre-commit/action@v2.0.3 diff --git a/.github/workflows/sync-public-develop.yaml b/.github/workflows/sync-public-develop.yaml new file mode 100644 index 000000000..874b81344 --- /dev/null +++ b/.github/workflows/sync-public-develop.yaml @@ -0,0 +1,40 @@ +name: sync public + +on: + schedule: + - cron: "0 19 * * *" # run at 4 AM JST + workflow_dispatch: + +env: + BASE_BRANCH: develop + SYNC_TARGET_BRANCH: develop + SYNC_TARGET_REPOSITORY: https://github.com/tier4/AutowareArchitectureProposal_launcher.git + +jobs: + sync-public: + 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.PROPOSAL_SYNC_APP_ID }} + private_key: ${{ secrets.PROPOSAL_SYNC_APP_PRIVATE_KEY }} + + - name: Set git config for private repositories + run: | + git config --local --unset-all http.https://github.com/.extraheader || true + git config --global url.https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com.insteadOf 'https://github.com' + + - name: Push to public repository + run: | + git remote add public ${{ env.SYNC_TARGET_REPOSITORY }} + git fetch public + git push public ${{ env.BASE_BRANCH }}:${{ env.SYNC_TARGET_BRANCH }} diff --git a/.github/workflows/sync-public.yaml b/.github/workflows/sync-public.yaml new file mode 100644 index 000000000..8cc1453bf --- /dev/null +++ b/.github/workflows/sync-public.yaml @@ -0,0 +1,40 @@ +name: sync public + +on: + schedule: + - cron: "0 19 * * *" # run at 4 AM JST + workflow_dispatch: + +env: + BASE_BRANCH: main + SYNC_TARGET_BRANCH: main + SYNC_TARGET_REPOSITORY: https://github.com/tier4/AutowareArchitectureProposal_launcher.git + +jobs: + sync-public: + 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.PROPOSAL_SYNC_APP_ID }} + private_key: ${{ secrets.PROPOSAL_SYNC_APP_PRIVATE_KEY }} + + - name: Set git config for private repositories + run: | + git config --local --unset-all http.https://github.com/.extraheader || true + git config --global url.https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com.insteadOf 'https://github.com' + + - name: Push to public repository + run: | + git remote add public ${{ env.SYNC_TARGET_REPOSITORY }} + git fetch public + git push public ${{ env.BASE_BRANCH }}:${{ env.SYNC_TARGET_BRANCH }} diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 000000000..605ac41ce --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,6 @@ +default: true +MD013: false +MD024: + siblings_only: true +MD033: false +MD041: false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..5b8232fe2 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,58 @@ +# To install: +# +# pip install pre-commit +# +# To use: +# +# pre-commit run -a +# +# Or: +# +# pre-commit install # (runs every time you commit in git) +# +# To update this file: +# +# pre-commit autoupdate +# +# See https://github.com/pre-commit/pre-commit + +repos: + # Standard hooks + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: check-json + - id: check-merge-conflict + - id: check-toml + - id: check-xml + - id: check-yaml + - id: detect-private-key + - id: double-quote-string-fixer + - id: end-of-file-fixer + - id: mixed-line-ending + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] + + - repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.27.1 + hooks: + - id: markdownlint + args: ["-c", ".markdownlint.yaml", "--fix"] + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v2.3.2 + hooks: + - id: prettier + + - repo: https://github.com/tier4/pre-commit-hooks-ros + rev: v0.1.2 + hooks: + - id: prettier-xml + - id: sort-package-xml + + - repo: https://github.com/gruntwork-io/pre-commit + rev: v0.1.12 + hooks: + - id: shellcheck + +exclude: "(.svg|.rviz|.param.yaml|traffic_light_camera.yaml)" diff --git a/.prettierrc.yaml b/.prettierrc.yaml new file mode 100644 index 000000000..ef9b1b85a --- /dev/null +++ b/.prettierrc.yaml @@ -0,0 +1,2 @@ +printWidth: 120 +tabWidth: 2 diff --git a/autoware_api_launch/package.xml b/autoware_api_launch/package.xml index f8698287b..b9b064d9b 100644 --- a/autoware_api_launch/package.xml +++ b/autoware_api_launch/package.xml @@ -10,9 +10,9 @@ ament_cmake_auto - awapi_awiv_adapter autoware_iv_external_api_adaptor autoware_iv_internal_api_adaptor + awapi_awiv_adapter path_distance_calculator topic_tools diff --git a/autoware_launch/package.xml b/autoware_launch/package.xml index 8a744017b..c56485985 100644 --- a/autoware_launch/package.xml +++ b/autoware_launch/package.xml @@ -9,28 +9,21 @@ ament_cmake_auto - autoware_api_launch + autoware_global_parameter_loader + autoware_web_controller control_launch localization_launch map_launch perception_launch planning_launch + python3-bson + python3-tornado + rviz2 sensing_launch system_launch vehicle_launch - - rviz2 - - - autoware_global_parameter_loader - autoware_web_controller - python-tornado - python3-tornado - python-bson - python3-bson - ament_lint_auto ament_lint_common diff --git a/control_launch/package.xml b/control_launch/package.xml index fd1003d97..6c44b73f8 100644 --- a/control_launch/package.xml +++ b/control_launch/package.xml @@ -11,14 +11,14 @@ ament_cmake_auto + external_cmd_converter + lane_departure_checker latlon_muxer mpc_follower pure_pursuit - external_cmd_converter shift_decider vehicle_cmd_gate velocity_controller - lane_departure_checker ament_lint_auto ament_lint_common diff --git a/integration_launch/package.xml b/integration_launch/package.xml index dc8da62d6..9bafa3c34 100644 --- a/integration_launch/package.xml +++ b/integration_launch/package.xml @@ -8,24 +8,19 @@ Apache 2 ament_cmake_auto - + autoware_web_controller control_launch localization_launch map_launch perception_launch planning_launch + python3-bson + python3-tornado + rviz2 sensing_launch system_launch vehicle_launch - - rviz2 - - - autoware_web_controller - python3-tornado - python3-bson - ament_lint_auto ament_lint_common diff --git a/localization_launch/package.xml b/localization_launch/package.xml index 3bd2e7bd2..fdfe2c6f9 100644 --- a/localization_launch/package.xml +++ b/localization_launch/package.xml @@ -11,11 +11,11 @@ ament_cmake_auto - ndt_scan_matcher ekf_localizer gyro_odometer - pose_initializer + ndt_scan_matcher pointcloud_preprocessor + pose_initializer topic_tools environment_params diff --git a/perception_launch/README.md b/perception_launch/README.md index 404042289..9cc11ca6f 100644 --- a/perception_launch/README.md +++ b/perception_launch/README.md @@ -12,7 +12,6 @@ Please see `` in `package.xml`. You can include as follows in `*.launch.xml` to use `perception.launch.xml`. - ```xml diff --git a/perception_launch/package.xml b/perception_launch/package.xml index 38fe7e376..35ed04f90 100644 --- a/perception_launch/package.xml +++ b/perception_launch/package.xml @@ -10,24 +10,21 @@ ament_cmake_auto - dynamic_object_visualization euclidean_cluster + image_transport_decompressor lidar_apollo_instance_segmentation map_based_prediction multi_object_tracker naive_path_prediction + object_merger + object_range_splitter roi_cluster_fusion shape_estimation tensorrt_yolo - object_range_splitter - object_merger - - - image_transport_decompressor + traffic_light_classifier traffic_light_map_based_detector traffic_light_ssd_fine_detector - traffic_light_classifier traffic_light_visualization ament_lint_auto diff --git a/planning_launch/launch/planning.launch.xml b/planning_launch/launch/planning.launch.xml index 3f33650f4..640b3a234 100644 --- a/planning_launch/launch/planning.launch.xml +++ b/planning_launch/launch/planning.launch.xml @@ -21,6 +21,6 @@ - + diff --git a/system_launch/launch/system.launch.xml b/system_launch/launch/system.launch.xml index 9c21c84e7..43b68c6f8 100644 --- a/system_launch/launch/system.launch.xml +++ b/system_launch/launch/system.launch.xml @@ -37,18 +37,19 @@ + + - diff --git a/system_launch/package.xml b/system_launch/package.xml index 21ff9552c..64664d843 100644 --- a/system_launch/package.xml +++ b/system_launch/package.xml @@ -10,11 +10,11 @@ ament_cmake_auto - system_monitor - autoware_state_monitor autoware_error_monitor + autoware_state_monitor autoware_version emergency_handler + system_monitor ament_lint_auto ament_lint_common diff --git a/vehicle_launch/README.md b/vehicle_launch/README.md index de5d447d4..eba3f836a 100644 --- a/vehicle_launch/README.md +++ b/vehicle_launch/README.md @@ -49,10 +49,10 @@ ex.) ### Arguments -| Name | Type | Description | Default | -| ------------- | ------ | ------------------ | ------------------ | -| sensor_model | String | sensor model name | "" | -| vehicle_model | String | vehicle model name | "" | +| Name | Type | Description | Default | +| ------------- | ------ | ------------------ | ------- | +| sensor_model | String | sensor model name | "" | +| vehicle_model | String | vehicle model name | "" | ### Usage diff --git a/vehicle_launch/package.xml b/vehicle_launch/package.xml index d9d663ace..c463f17c2 100644 --- a/vehicle_launch/package.xml +++ b/vehicle_launch/package.xml @@ -13,9 +13,9 @@ camera_description imu_description livox_description - velodyne_description robot_state_publisher simple_planning_simulator + velodyne_description xacro ament_lint_auto