From 2f18e340ea7337b21085f239a09ebf9a463ef6ca Mon Sep 17 00:00:00 2001 From: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com> Date: Tue, 7 Mar 2023 23:57:06 +0900 Subject: [PATCH] ci: sync template latest (#16) * ci: add sync files (#2) * ci: add sync files Signed-off-by: wep21 * Update .github/sync-files.yaml Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> * Update .github/sync-files.yaml Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> * Update .github/sync-files.yaml Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> * Update .github/sync-files.yaml Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> * Update .github/sync-files.yaml Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> * chore: sync files (#3) Signed-off-by: GitHub Co-authored-by: kenji-miyake * ci: update workflow (#1) * ci: update ci config Signed-off-by: wep21 * chore: apply pre-commit Signed-off-by: wep21 * ci: update workflow Signed-off-by: wep21 * Update .pre-commit-config.yaml Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> * chore: add empty repos (#4) Signed-off-by: wep21 * chore: sync files (#5) * chore: sync files Signed-off-by: GitHub * Update sync-files.yaml Co-authored-by: kenji-miyake Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> * chore: sync files (#6) * chore: sync files Signed-off-by: GitHub * Update sync-files.yaml Co-authored-by: wep21 Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> * chore: sync files (#7) Signed-off-by: GitHub Co-authored-by: kenji-miyake * chore: sync files (#9) Signed-off-by: GitHub Co-authored-by: kenji-miyake * chore: sync files (#10) * chore: sync files Signed-off-by: GitHub * Update sync-files.yaml Co-authored-by: wep21 Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> * chore: sync files (#11) Signed-off-by: GitHub Co-authored-by: wep21 * chore: sync files (#12) Signed-off-by: GitHub Co-authored-by: wep21 * chore: sync files (#13) Signed-off-by: GitHub Co-authored-by: wep21 * chore: sync files (#15) Signed-off-by: GitHub Co-authored-by: wep21 * chore: sync files (#16) * chore: sync files Signed-off-by: GitHub * Update sync-files.yaml Co-authored-by: wep21 Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> * chore: sync files (#17) Signed-off-by: GitHub Co-authored-by: wep21 * chore: sync files (#18) Signed-off-by: GitHub Co-authored-by: kenji-miyake * chore: sync files (#19) Signed-off-by: GitHub Co-authored-by: kenji-miyake * chore: sync files (#20) Signed-off-by: GitHub Co-authored-by: kenji-miyake * chore: sync files (#21) * chore: sync files Signed-off-by: GitHub * Update sync-files.yaml Co-authored-by: kenji-miyake Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> * chore: sync files (#22) Signed-off-by: GitHub Co-authored-by: kenji-miyake * chore: sync files (#23) Signed-off-by: GitHub Co-authored-by: kenji-miyake * chore: sync files (#24) Signed-off-by: GitHub Co-authored-by: kenji-miyake * chore: sync files (#25) Signed-off-by: GitHub Co-authored-by: kenji-miyake * chore: sync files (#27) Signed-off-by: GitHub Co-authored-by: kenji-miyake * chore: sync files (#28) * chore: sync files Signed-off-by: GitHub * Update sync-files.yaml Signed-off-by: GitHub Co-authored-by: kenji-miyake Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> * chore: sync files (#29) Signed-off-by: GitHub Signed-off-by: GitHub Co-authored-by: kenji-miyake * chore: sync files (#30) Signed-off-by: GitHub Co-authored-by: kenji-miyake * remove legacy ci Signed-off-by: Daisuke Nishimatsu * update isort Signed-off-by: Daisuke Nishimatsu --------- Signed-off-by: wep21 Signed-off-by: GitHub Signed-off-by: Daisuke Nishimatsu Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> Co-authored-by: tier4-autoware-bot[bot] <98652886+tier4-autoware-bot[bot]@users.noreply.github.com> Co-authored-by: kenji-miyake Co-authored-by: tier4-autoware-public-bot[bot] <98652886+tier4-autoware-public-bot[bot]@users.noreply.github.com> Co-authored-by: wep21 Co-authored-by: Daisuke Nishimatsu --- .clang-format | 46 ++++++++++ .github/dependabot.yaml | 10 ++ .github/dependabot.yml | 6 -- .github/sync-files.yaml | 23 +++++ .../build-and-test-differential.yaml | 91 ++++++++++++++++++ .github/workflows/build-and-test.yaml | 58 ++++++++++++ .github/workflows/build-and-test.yml | 66 ------------- .../workflows/cancel-previous-workflows.yaml | 14 +++ .github/workflows/codeql-analysis.yml | 69 -------------- .github/workflows/pre-commit-optional.yaml | 16 ++++ .github/workflows/pre-commit.yaml | 32 +++++++ .github/workflows/semantic-pull-request.yaml | 12 +++ .../workflows/spell-check-differential.yaml | 16 ++++ .github/workflows/sync-files.yaml | 33 +++++++ .gitignore | 32 +++---- .markdown-link-check.json | 16 ++++ .markdownlint.yaml | 11 +++ .pre-commit-config-optional.yaml | 6 ++ .pre-commit-config.yaml | 92 +++++++++++++++++++ .prettierignore | 2 + .prettierrc.yaml | 20 ++++ .yamllint.yaml | 22 +++++ CPPLINT.cfg | 14 +++ README.md | 1 + build_depends.repos | 1 + setup.cfg | 15 +++ 26 files changed, 562 insertions(+), 162 deletions(-) create mode 100644 .clang-format create mode 100644 .github/dependabot.yaml delete mode 100644 .github/dependabot.yml create mode 100644 .github/sync-files.yaml create mode 100644 .github/workflows/build-and-test-differential.yaml create mode 100644 .github/workflows/build-and-test.yaml delete mode 100644 .github/workflows/build-and-test.yml create mode 100644 .github/workflows/cancel-previous-workflows.yaml delete mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .github/workflows/pre-commit-optional.yaml create mode 100644 .github/workflows/pre-commit.yaml create mode 100644 .github/workflows/semantic-pull-request.yaml create mode 100644 .github/workflows/spell-check-differential.yaml create mode 100644 .github/workflows/sync-files.yaml create mode 100644 .markdown-link-check.json create mode 100644 .markdownlint.yaml create mode 100644 .pre-commit-config-optional.yaml create mode 100644 .pre-commit-config.yaml create mode 100644 .prettierignore create mode 100644 .prettierrc.yaml create mode 100644 .yamllint.yaml create mode 100644 CPPLINT.cfg create mode 100644 build_depends.repos create mode 100644 setup.cfg diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..c3b72db71 --- /dev/null +++ b/.clang-format @@ -0,0 +1,46 @@ +# 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 + - Regex: .*_srvs/.* + 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..3f3bf243f --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily + open-pull-requests-limit: 1 + labels: + - bot + - github-actions diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 3ba640e16..000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "github-actions" - directory: "/" # Location of package manifests - schedule: - interval: "daily" diff --git a/.github/sync-files.yaml b/.github/sync-files.yaml new file mode 100644 index 000000000..d3e31ace4 --- /dev/null +++ b/.github/sync-files.yaml @@ -0,0 +1,23 @@ +- repository: autowarefoundation/autoware + files: + - source: .github/dependabot.yaml + - source: .github/workflows/pre-commit.yaml + - source: .github/workflows/pre-commit-optional.yaml + - source: .github/workflows/semantic-pull-request.yaml + - source: .github/workflows/spell-check-differential.yaml + - source: .github/workflows/sync-files.yaml + - source: .clang-format + - source: .markdown-link-check.json + - source: .markdownlint.yaml + - source: .pre-commit-config-optional.yaml + - source: .prettierignore + - source: .prettierrc.yaml + - 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-differential.yaml + - source: .github/workflows/cancel-previous-workflows.yaml diff --git a/.github/workflows/build-and-test-differential.yaml b/.github/workflows/build-and-test-differential.yaml new file mode 100644 index 000000000..8eeb1de06 --- /dev/null +++ b/.github/workflows/build-and-test-differential.yaml @@ -0,0 +1,91 @@ +name: build-and-test-differential + +on: + pull_request: + +jobs: + build-and-test-differential: + runs-on: ubuntu-latest + container: ${{ matrix.container }} + strategy: + fail-fast: false + matrix: + rosdistro: + - humble + include: + - rosdistro: humble + container: ros:humble + build-depends-repos: build_depends.repos + steps: + - name: Check out repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Remove exec_depend + uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1 + + - name: Get modified packages + id: get-modified-packages + uses: autowarefoundation/autoware-github-actions/get-modified-packages@v1 + + - name: Build + if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }} + uses: autowarefoundation/autoware-github-actions/colcon-build@v1 + with: + rosdistro: ${{ matrix.rosdistro }} + target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }} + build-depends-repos: ${{ matrix.build-depends-repos }} + + - name: Test + id: test + if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }} + uses: autowarefoundation/autoware-github-actions/colcon-test@v1 + with: + rosdistro: ${{ matrix.rosdistro }} + target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }} + build-depends-repos: ${{ matrix.build-depends-repos }} + + - name: Upload coverage to CodeCov + if: ${{ steps.test.outputs.coverage-report-files != '' }} + uses: codecov/codecov-action@v3 + with: + files: ${{ steps.test.outputs.coverage-report-files }} + fail_ci_if_error: false + verbose: true + flags: differential + + clang-tidy-differential: + runs-on: ubuntu-latest + container: ros:humble + needs: build-and-test-differential + steps: + - name: Check out repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Remove exec_depend + uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1 + + - name: Get modified packages + id: get-modified-packages + uses: autowarefoundation/autoware-github-actions/get-modified-packages@v1 + + - name: Get modified files + id: get-modified-files + uses: tj-actions/changed-files@v35 + with: + files: | + **/*.cpp + **/*.hpp + + - name: Run clang-tidy + if: ${{ steps.get-modified-files.outputs.all_changed_files != '' }} + uses: autowarefoundation/autoware-github-actions/clang-tidy@v1 + with: + rosdistro: humble + target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }} + target-files: ${{ steps.get-modified-files.outputs.all_changed_files }} + clang-tidy-config-url: https://raw.githubusercontent.com/autowarefoundation/autoware/main/.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..6459a9804 --- /dev/null +++ b/.github/workflows/build-and-test.yaml @@ -0,0 +1,58 @@ +name: build-and-test + +on: + push: + schedule: + - cron: 0 0 * * * + workflow_dispatch: + +jobs: + build-and-test: + if: ${{ github.event_name != 'push' || github.ref_name == github.event.repository.default_branch }} + runs-on: ubuntu-latest + container: ${{ matrix.container }} + strategy: + fail-fast: false + matrix: + rosdistro: + - humble + include: + - rosdistro: humble + container: ros:humble + build-depends-repos: build_depends.repos + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Remove exec_depend + uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1 + + - name: Get self packages + id: get-self-packages + uses: autowarefoundation/autoware-github-actions/get-self-packages@v1 + + - name: Build + if: ${{ steps.get-self-packages.outputs.self-packages != '' }} + uses: autowarefoundation/autoware-github-actions/colcon-build@v1 + with: + rosdistro: ${{ matrix.rosdistro }} + target-packages: ${{ steps.get-self-packages.outputs.self-packages }} + build-depends-repos: ${{ matrix.build-depends-repos }} + + - name: Test + if: ${{ steps.get-self-packages.outputs.self-packages != '' }} + id: test + uses: autowarefoundation/autoware-github-actions/colcon-test@v1 + with: + rosdistro: ${{ matrix.rosdistro }} + target-packages: ${{ steps.get-self-packages.outputs.self-packages }} + build-depends-repos: ${{ matrix.build-depends-repos }} + + - name: Upload coverage to CodeCov + if: ${{ steps.test.outputs.coverage-report-files != '' }} + uses: codecov/codecov-action@v3 + with: + files: ${{ steps.test.outputs.coverage-report-files }} + fail_ci_if_error: false + verbose: true + flags: total diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml deleted file mode 100644 index c2b72272c..000000000 --- a/.github/workflows/build-and-test.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Build and test - -on: - pull_request: - push: - branches: - - main - workflow_dispatch: - -jobs: - build-and-test: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - ros_distribution: - - foxy - - galactic - - include: - # Foxy Fitzroy (June 2020 - May 2023) - - docker_image: ubuntu:focal - ros_distribution: foxy - - # Galactic Geochelone (May 2021 - November 2022) - - docker_image: ubuntu:focal - ros_distribution: galactic - - container: - image: ${{ matrix.docker_image }} - - steps: - - name: Check out repo - uses: actions/checkout@v3.1.0 - with: - fetch-depth: 2 # https://github.com/codecov/codecov-action/issues/190#issuecomment-790729633 - - - name: Setup ROS environment - uses: ros-tooling/setup-ros@v0.5 - with: - required-ros-distributions: ${{ matrix.ros_distribution }} - - - name: Search packages in this repository - id: list_packages - run: | - echo ::set-output name=package_list::$(colcon list --names-only) - - - name: Run action-ros-ci - id: action_ros_ci_step - uses: ros-tooling/action-ros-ci@v0.2 - with: - package-name: ${{ steps.list_packages.outputs.package_list }} - target-ros2-distro: ${{ matrix.ros_distribution }} - # Set following option if you need. - # vcs-repo-file-url: build_depends.repos - # import-token: ${{ secrets.REPO_TOKEN }} - colcon-defaults: | - { - "build": { - "mixin": ["coverage-gcc", "coverage-pytest"] - }, - "test": { - "mixin": ["coverage-pytest"] - } - } - colcon-mixin-repository: https://raw.githubusercontent.com/colcon/colcon-mixin-repository/1ddb69bedfd1f04c2f000e95452f7c24a4d6176b/index.yaml diff --git a/.github/workflows/cancel-previous-workflows.yaml b/.github/workflows/cancel-previous-workflows.yaml new file mode 100644 index 000000000..f9c29b81b --- /dev/null +++ b/.github/workflows/cancel-previous-workflows.yaml @@ -0,0 +1,14 @@ +name: cancel-previous-workflows + +on: + pull_request_target: + +jobs: + cancel-previous-workflows: + runs-on: ubuntu-latest + steps: + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.11.0 + with: + workflow_id: all + all_but_latest: true diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index c22b454c0..000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,69 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ main ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ main ] - schedule: - - cron: "0 19 * * 0" # run at Sun 4 AM JST - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'cpp', 'python' ] - ros_distribution: [ 'foxy', 'galactic' ] - - steps: - - name: Checkout repository - uses: actions/checkout@v3.1.0 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - - - name: Setup ROS environment - uses: ros-tooling/setup-ros@v0.5 - with: - required-ros-distributions: ${{ matrix.ros_distribution }} - - - name: Search packages in this repository - id: list_packages - run: | - echo ::set-output name=package_list::$(colcon list --names-only) - - - name: Run action-ros-ci - id: action_ros_ci_step - uses: ros-tooling/action-ros-ci@v0.2 - with: - package-name: ${{ steps.list_packages.outputs.package_list }} - target-ros2-distro: ${{ matrix.ros_distribution }} - # Set following option if you need. - # vcs-repo-file-url: build_depends.repos - # import-token: ${{ secrets.REPO_TOKEN }} - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/pre-commit-optional.yaml b/.github/workflows/pre-commit-optional.yaml new file mode 100644 index 000000000..93e05dc2c --- /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@v3 + + - name: Run pre-commit + uses: autowarefoundation/autoware-github-actions/pre-commit@v1 + with: + pre-commit-config: .pre-commit-config-optional.yaml diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml new file mode 100644 index 000000000..bda722c87 --- /dev/null +++ b/.github/workflows/pre-commit.yaml @@ -0,0 +1,32 @@ +name: pre-commit + +on: + pull_request: + +jobs: + pre-commit: + if: ${{ github.event.repository.private }} # Use pre-commit.ci for public repositories + 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@v3 + with: + ref: ${{ github.event.pull_request.head.ref }} + + - name: Set git config + uses: autowarefoundation/autoware-github-actions/set-git-config@v1 + with: + token: ${{ steps.generate-token.outputs.token }} + + - name: Run pre-commit + uses: autowarefoundation/autoware-github-actions/pre-commit@v1 + with: + pre-commit-config: .pre-commit-config.yaml + token: ${{ steps.generate-token.outputs.token }} diff --git a/.github/workflows/semantic-pull-request.yaml b/.github/workflows/semantic-pull-request.yaml new file mode 100644 index 000000000..71224c224 --- /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@v1 diff --git a/.github/workflows/spell-check-differential.yaml b/.github/workflows/spell-check-differential.yaml new file mode 100644 index 000000000..eb18ccdba --- /dev/null +++ b/.github/workflows/spell-check-differential.yaml @@ -0,0 +1,16 @@ +name: spell-check-differential + +on: + pull_request: + +jobs: + spell-check-differential: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Run spell-check + uses: autowarefoundation/autoware-github-actions/spell-check@v1 + with: + cspell-json-url: https://raw.githubusercontent.com/tier4/autoware-spell-check-dict/main/.cspell.json diff --git a/.github/workflows/sync-files.yaml b/.github/workflows/sync-files.yaml new file mode 100644 index 000000000..b9dc5907a --- /dev/null +++ b/.github/workflows/sync-files.yaml @@ -0,0 +1,33 @@ +name: sync-files + +on: + schedule: + - cron: 0 0 * * * + workflow_dispatch: + +jobs: + check-secret: + uses: autowarefoundation/autoware-github-actions/.github/workflows/check-secret.yaml@v1 + secrets: + secret: ${{ secrets.APP_ID }} + + sync-files: + needs: check-secret + if: ${{ needs.check-secret.outputs.set == 'true' }} + 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@v1 + with: + token: ${{ steps.generate-token.outputs.token }} + pr-labels: | + bot + sync-files + auto-merge-method: squash diff --git a/.gitignore b/.gitignore index a38da67c2..5ce2c2681 100644 --- a/.gitignore +++ b/.gitignore @@ -1,25 +1,15 @@ -install/ -log/ -build/ +# Vim +*.swp +*.swo -# Ignore generated docs -*.dox -*.wikidoc +# Visual Studio Code +.vscode/ +*.code-workspace -# eclipse stuff -.project -.cproject - -# qcreator stuff -CMakeLists.txt.user +# colcon +build/ +install/ +log/ -srv/_*.py -*.pcd +# Python *.pyc -qtcreator-* -*.user - -*~ - -# Emacs -.#* diff --git a/.markdown-link-check.json b/.markdown-link-check.json new file mode 100644 index 000000000..c71a3e425 --- /dev/null +++ b/.markdown-link-check.json @@ -0,0 +1,16 @@ +{ + "aliveStatusCodes": [200, 206, 403], + "ignorePatterns": [ + { + "pattern": "^http://localhost" + }, + { + "pattern": "^http://127\\.0\\.0\\.1" + }, + { + "pattern": "^https://github.com/.*/discussions/new" + } + ], + "retryOn429": true, + "retryCount": 10 +} diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 000000000..babaaa1f1 --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,11 @@ +# See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md for all rules. +default: true +MD013: false +MD024: + siblings_only: true +MD029: + style: ordered +MD033: false +MD041: false +MD046: false +MD049: false diff --git a/.pre-commit-config-optional.yaml b/.pre-commit-config-optional.yaml new file mode 100644 index 000000000..e0019e10d --- /dev/null +++ b/.pre-commit-config-optional.yaml @@ -0,0 +1,6 @@ +repos: + - repo: https://github.com/tcort/markdown-link-check + rev: v3.10.3 + hooks: + - id: markdown-link-check + args: [--config=.markdown-link-check.json] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..13c31ce62 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,92 @@ +ci: + autofix_commit_msg: "ci(pre-commit): autofix" + autoupdate_commit_msg: "ci(pre-commit): autoupdate" + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.1.0 + hooks: + - id: check-json + - id: check-merge-conflict + - id: check-toml + - id: check-xml + - id: check-yaml + - id: detect-private-key + - 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.30.0 + hooks: + - id: markdownlint + args: [-c, .markdownlint.yaml, --fix] + + - repo: https://github.com/pre-commit/mirrors-prettier + 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/shellcheck-py/shellcheck-py + rev: v0.8.0.3 + hooks: + - id: shellcheck + + - repo: https://github.com/scop/pre-commit-shfmt + rev: v3.4.2-1 + hooks: + - id: shfmt + args: [-w, -s, -i=4] + + - repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort + + - repo: https://github.com/psf/black + rev: 22.1.0 + hooks: + - id: black + args: [--line-length=100] + + - repo: https://github.com/PyCQA/flake8 + rev: 4.0.1 + hooks: + - id: flake8 + additional_dependencies: + [ + flake8-blind-except, + flake8-builtins, + flake8-class-newline, + flake8-comprehensions, + flake8-deprecated, + flake8-docstrings, + flake8-import-order, + flake8-quotes, + ] + + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v13.0.0 + 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/.prettierignore b/.prettierignore new file mode 100644 index 000000000..a3c34d00a --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +*.param.yaml +*.rviz diff --git a/.prettierrc.yaml b/.prettierrc.yaml new file mode 100644 index 000000000..e29bf3276 --- /dev/null +++ b/.prettierrc.yaml @@ -0,0 +1,20 @@ +printWidth: 100 +tabWidth: 2 +overrides: + - files: package.xml + options: + printWidth: 1000 + xmlSelfClosingSpace: false + xmlWhitespaceSensitivity: ignore + + - files: "*.launch.xml" + options: + printWidth: 200 + xmlSelfClosingSpace: false + xmlWhitespaceSensitivity: ignore + + - files: "*.xacro" + options: + printWidth: 200 + xmlSelfClosingSpace: false + xmlWhitespaceSensitivity: ignore diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 000000000..2c7bd088e --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,22 @@ +extends: default + +ignore: | + *.param.yaml + +rules: + braces: + level: error + max-spaces-inside: 1 # To format with Prettier + 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..ba6bdf08c --- /dev/null +++ b/CPPLINT.cfg @@ -0,0 +1,14 @@ +# 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 # we automatically fix the names of header guards using pre-commit +filter=-build/include_order # we use the custom include order +filter=-build/include_subdir # we allow the style of "foo.hpp" diff --git a/README.md b/README.md index 14ef6cd16..63f3578d1 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # ros2-project-template + Project template for ROS2 diff --git a/build_depends.repos b/build_depends.repos new file mode 100644 index 000000000..56f46b6f7 --- /dev/null +++ b/build_depends.repos @@ -0,0 +1 @@ +repositories: diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 000000000..5214751c7 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,15 @@ +[flake8] +# Modified from https://github.com/ament/ament_lint/blob/ebd524bb9973d5ec1dc48a670ce54f958a5a0243/ament_flake8/ament_flake8/configuration/ament_flake8.ini +extend-ignore = B902,C816,D100,D101,D102,D103,D104,D105,D106,D107,D203,D212,D404,I202,CNL100,E203,E501,Q000 +import-order-style = pep8 +max-line-length = 100 +show-source = true +statistics = true + +[isort] +profile=black +line_length=100 +force_sort_within_sections=true +force_single_line=true +reverse_relative=true +known_third_party=launch