Skip to content

Commit

Permalink
sync upstream (tier4#24)
Browse files Browse the repository at this point in the history
* Improve build-pr CI (tier4#405)

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Add sync-public.yaml (tier4#404)

* Add sync-public.yaml

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Add sync-public-develop.yaml

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Fix pre-commit (tier4#407)

* Fix pre-commit errors

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Fix package.xml

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Add pre-commit (tier4#406)

* Add pre-commit

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Add sort-package-xml

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Update system.launch.xml (tier4#411)

* Handle empty output in get_modified_package.sh (tier4#412)

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com>
Co-authored-by: Taichi Higashide <taichi.higashide@tier4.jp>
Co-authored-by: Hiroki OTA <hiroki.ota@tier4.jp>
  • Loading branch information
4 people authored Sep 17, 2021
1 parent e3bbdf9 commit 38929bf
Show file tree
Hide file tree
Showing 21 changed files with 273 additions and 108 deletions.
76 changes: 76 additions & 0 deletions .github/get_modified_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash
# Search for packages that have been modified from the main branch.
# Usage: get_modified_package.sh <base_branch>

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
5 changes: 2 additions & 3 deletions .github/workflows/build_and_test_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: Build and test for PR

on:
pull_request:
workflow_dispatch:

jobs:
build-and-test-pr:
Expand All @@ -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: |
Expand Down
62 changes: 0 additions & 62 deletions .github/workflows/get_modified_package.sh

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -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
40 changes: 40 additions & 0 deletions .github/workflows/sync-public-develop.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
40 changes: 40 additions & 0 deletions .github/workflows/sync-public.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
6 changes: 6 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
default: true
MD013: false
MD024:
siblings_only: true
MD033: false
MD041: false
58 changes: 58 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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)"
2 changes: 2 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
printWidth: 120
tabWidth: 2
2 changes: 1 addition & 1 deletion autoware_api_launch/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

<buildtool_depend>ament_cmake_auto</buildtool_depend>

<exec_depend>awapi_awiv_adapter</exec_depend>
<exec_depend>autoware_iv_external_api_adaptor</exec_depend>
<exec_depend>autoware_iv_internal_api_adaptor</exec_depend>
<exec_depend>awapi_awiv_adapter</exec_depend>
<exec_depend>path_distance_calculator</exec_depend>
<exec_depend>topic_tools</exec_depend>

Expand Down
17 changes: 5 additions & 12 deletions autoware_launch/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,21 @@

<buildtool_depend>ament_cmake_auto</buildtool_depend>

<!-- launch -->
<exec_depend>autoware_api_launch</exec_depend>
<exec_depend>autoware_global_parameter_loader</exec_depend>
<exec_depend>autoware_web_controller</exec_depend>
<exec_depend>control_launch</exec_depend>
<exec_depend>localization_launch</exec_depend>
<exec_depend>map_launch</exec_depend>
<exec_depend>perception_launch</exec_depend>
<exec_depend>planning_launch</exec_depend>
<exec_depend>python3-bson</exec_depend>
<exec_depend>python3-tornado</exec_depend>
<exec_depend>rviz2</exec_depend>
<exec_depend>sensing_launch</exec_depend>
<exec_depend>system_launch</exec_depend>
<exec_depend>vehicle_launch</exec_depend>

<!-- visualization -->
<exec_depend>rviz2</exec_depend>

<!-- web controller -->
<exec_depend>autoware_global_parameter_loader</exec_depend>
<exec_depend>autoware_web_controller</exec_depend>
<exec_depend condition="$ROS_PYTHON_VERSION == 2">python-tornado</exec_depend>
<exec_depend condition="$ROS_PYTHON_VERSION == 3">python3-tornado</exec_depend>
<exec_depend condition="$ROS_PYTHON_VERSION == 2">python-bson</exec_depend>
<exec_depend condition="$ROS_PYTHON_VERSION == 3">python3-bson</exec_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

Expand Down
4 changes: 2 additions & 2 deletions control_launch/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

<buildtool_depend>ament_cmake_auto</buildtool_depend>

<exec_depend>external_cmd_converter</exec_depend>
<exec_depend>lane_departure_checker</exec_depend>
<exec_depend>latlon_muxer</exec_depend>
<exec_depend>mpc_follower</exec_depend>
<exec_depend>pure_pursuit</exec_depend>
<exec_depend>external_cmd_converter</exec_depend>
<exec_depend>shift_decider</exec_depend>
<exec_depend>vehicle_cmd_gate</exec_depend>
<exec_depend>velocity_controller</exec_depend>
<exec_depend>lane_departure_checker</exec_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
Expand Down
Loading

0 comments on commit 38929bf

Please sign in to comment.