From 46c71993cbc06d324d642226f29c918779a78156 Mon Sep 17 00:00:00 2001 From: Ryohsuke Mitsudome <43976834+mitsudome-r@users.noreply.github.com> Date: Fri, 9 Feb 2024 16:56:04 +0900 Subject: [PATCH] ci: port workflows from autoware.universe (#1) * ci: port workflows from autoware.universe Signed-off-by: Ryohsuke Mitsudome * fix(build_depends.repos): remove unnecessary build dependencies Signed-off-by: mitsudome-r --------- Signed-off-by: Ryohsuke Mitsudome Signed-off-by: mitsudome-r --- .clang-format | 47 ++++++++ .cspell-partial.json | 9 ++ .github/CODEOWNERS | 3 + .github/CODEOWNERS-manual | 0 .github/labeler.yaml | 41 +++++++ .github/stale.yml | 12 ++ .github/sync-files.yaml | 91 ++++++++++++++ .github/workflows/PULL_REQUEST_TEMPLATE.md | 50 ++++++++ ...ild-and-test-differential-self-hosted.yaml | 61 ++++++++++ .../build-and-test-differential.yaml | 111 ++++++++++++++++++ .../workflows/build-and-test-self-hosted.yaml | 49 ++++++++ .github/workflows/build-and-test.yaml | 69 +++++++++++ .../workflows/cancel-previous-workflows.yaml | 14 +++ .github/workflows/check-build-depends.yaml | 37 ++++++ .../clang-tidy-pr-comments-manually.yaml | 62 ++++++++++ .github/workflows/clang-tidy-pr-comments.yaml | 63 ++++++++++ .github/workflows/delete-closed-pr-docs.yaml | 20 ++++ .github/workflows/deploy-docs.yaml | 42 +++++++ .github/workflows/github-release.yaml | 78 ++++++++++++ .github/workflows/json-schema-check.yaml | 17 +++ .github/workflows/openai-pr-reviewer.yaml | 39 ++++++ .github/workflows/pr-labeler.yaml | 16 +++ .github/workflows/pre-commit-optional.yaml | 19 +++ .github/workflows/pre-commit.yaml | 27 +++++ .github/workflows/semantic-pull-request.yaml | 12 ++ .github/workflows/spell-check-all.yaml | 19 +++ .github/workflows/spell-check-partial.yaml | 18 +++ .github/workflows/sync-files.yaml | 33 ++++++ .../update-codeowners-from-packages.yaml | 33 ++++++ .markdown-link-check.json | 16 +++ .markdownlint.yaml | 11 ++ .pages | 2 + .pre-commit-config-optional.yaml | 6 + .pre-commit-config.yaml | 95 +++++++++++++++ .prettierignore | 2 + .prettierrc.yaml | 20 ++++ .yamllint.yaml | 22 ++++ CPPLINT.cfg | 14 +++ build_depends.repos | 23 ++++ codecov.yaml | 22 ++++ mkdocs.yaml | 96 +++++++++++++++ mkdocs_macros.py | 72 ++++++++++++ setup.cfg | 15 +++ 43 files changed, 1508 insertions(+) create mode 100644 .clang-format create mode 100644 .cspell-partial.json create mode 100644 .github/CODEOWNERS create mode 100644 .github/CODEOWNERS-manual create mode 100644 .github/labeler.yaml create mode 100644 .github/stale.yml create mode 100644 .github/sync-files.yaml create mode 100644 .github/workflows/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/build-and-test-differential-self-hosted.yaml create mode 100644 .github/workflows/build-and-test-differential.yaml create mode 100644 .github/workflows/build-and-test-self-hosted.yaml create mode 100644 .github/workflows/build-and-test.yaml create mode 100644 .github/workflows/cancel-previous-workflows.yaml create mode 100644 .github/workflows/check-build-depends.yaml create mode 100644 .github/workflows/clang-tidy-pr-comments-manually.yaml create mode 100644 .github/workflows/clang-tidy-pr-comments.yaml create mode 100644 .github/workflows/delete-closed-pr-docs.yaml create mode 100644 .github/workflows/deploy-docs.yaml create mode 100644 .github/workflows/github-release.yaml create mode 100644 .github/workflows/json-schema-check.yaml create mode 100644 .github/workflows/openai-pr-reviewer.yaml create mode 100644 .github/workflows/pr-labeler.yaml 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-all.yaml create mode 100644 .github/workflows/spell-check-partial.yaml create mode 100644 .github/workflows/sync-files.yaml create mode 100644 .github/workflows/update-codeowners-from-packages.yaml create mode 100644 .markdown-link-check.json create mode 100644 .markdownlint.yaml create mode 100644 .pages 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 codecov.yaml create mode 100644 mkdocs.yaml create mode 100644 mkdocs_macros.py create mode 100644 setup.cfg diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..b41fae91 --- /dev/null +++ b/.clang-format @@ -0,0 +1,47 @@ +# 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 +AllowShortFunctionsOnASingleLine: InlineOnly +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/.cspell-partial.json b/.cspell-partial.json new file mode 100644 index 00000000..e231eddd --- /dev/null +++ b/.cspell-partial.json @@ -0,0 +1,9 @@ +{ + "ignorePaths": [ + "**/perception/**", + "sensing/tier4_pcl_extensions/include/**", + "perception/bytetrack/lib/**" + ], + "ignoreRegExpList": [], + "words": ["dltype", "tvmgen", "quantizer", "imageio", "mimsave"] +} diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..f61a66c6 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,3 @@ +### Copied from .github/CODEOWNERS-manual ### + +### Automatically generated from package.xml ### diff --git a/.github/CODEOWNERS-manual b/.github/CODEOWNERS-manual new file mode 100644 index 00000000..e69de29b diff --git a/.github/labeler.yaml b/.github/labeler.yaml new file mode 100644 index 00000000..47f8737e --- /dev/null +++ b/.github/labeler.yaml @@ -0,0 +1,41 @@ +"type:ci": + - .github/**/* + - "*.json" + - "*.yaml" + - "*.cfg" + - .clang-format + - .gitignore + - .prettierignore +"type:documentation": + - docs/**/* + - "**/*.md" + - "**/*.rst" + - "**/*.jpg" + - "**/*.png" + - "**/*.svg" +"component:common": + - common/**/* +"component:control": + - control/**/* +"component:evaluator": + - evaluator/**/* +"component:launch": + - launch/**/* +"component:localization": + - localization/**/* +"component:map": + - map/**/* +"component:perception": + - perception/**/* +"component:planning": + - planning/**/* +"component:sensing": + - sensing/**/* +"component:simulation": + - simulator/**/* +"component:system": + - system/**/* +"component:tools": + - tools/**/* +"component:vehicle": + - vehicle/**/* diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 00000000..bc99e438 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,12 @@ +# Modified from https://github.com/probot/stale#usage + +# Number of days of inactivity before an Issue or Pull Request with the stale label is closed +daysUntilClose: false + +# Label to use when marking as stale +staleLabel: status:stale + +# Comment to post when marking as stale +markComment: > + This pull request has been automatically marked as stale because it has not had + recent activity. diff --git a/.github/sync-files.yaml b/.github/sync-files.yaml new file mode 100644 index 00000000..5b60a371 --- /dev/null +++ b/.github/sync-files.yaml @@ -0,0 +1,91 @@ +- repository: autowarefoundation/autoware + files: + - source: CODE_OF_CONDUCT.md + - source: CONTRIBUTING.md + - source: DISCLAIMER.md + - source: LICENSE + - source: .github/ISSUE_TEMPLATE/bug.yaml + - source: .github/ISSUE_TEMPLATE/config.yml + - source: .github/ISSUE_TEMPLATE/task.yaml + - source: .github/PULL_REQUEST_TEMPLATE.md + - source: .github/PULL_REQUEST_TEMPLATE/small-change.md + - source: .github/PULL_REQUEST_TEMPLATE/standard-change.md + - source: .github/dependabot.yaml + - source: .github/stale.yml + - source: .github/workflows/cancel-previous-workflows.yaml + - source: .github/workflows/github-release.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 + pre-commands: | + sd "container: ros:(\w+)" "container: ghcr.io/autowarefoundation/autoware-universe:\$1-latest" {source} + + sd -s 'container: ${{ matrix.container }}' 'container: ${{ matrix.container }}${{ matrix.container-suffix }}' {source} + sd -- \ + " include:" \ + " container-suffix: + - \"\" + - -cuda + include:" {source} + - source: .github/workflows/build-and-test-differential-self-hosted.yaml + pre-commands: | + sd "container: ros:(\w+)" "container: ghcr.io/autowarefoundation/autoware-universe:\$1-latest" {source} + + sd -s 'container: ${{ matrix.container }}' 'container: ${{ matrix.container }}${{ matrix.container-suffix }}' {source} + sd -- \ + " include:" \ + " container-suffix: + - \"\" + - -cuda + include:" {source} + - source: .github/workflows/build-and-test-self-hosted.yaml + pre-commands: | + sd "container: ros:(\w+)" "container: ghcr.io/autowarefoundation/autoware-universe:\$1-latest" {source} + + sd -s 'container: ${{ matrix.container }}' 'container: ${{ matrix.container }}${{ matrix.container-suffix }}' {source} + sd -- \ + " include:" \ + " container-suffix: + - \"\" + - -cuda + include:" {source} + - source: .github/workflows/check-build-depends.yaml + - source: .github/workflows/clang-tidy-pr-comments.yaml + - source: .github/workflows/clang-tidy-pr-comments-manually.yaml + - source: .github/workflows/update-codeowners-from-packages.yaml + - source: .pre-commit-config.yaml + - source: codecov.yaml + +- repository: autowarefoundation/autoware-documentation + files: + - source: .github/workflows/deploy-docs.yaml + - source: .github/workflows/delete-closed-pr-docs.yaml + - source: mkdocs-base.yaml + dest: mkdocs.yaml + pre-commands: | + sd "Autoware Documentation" "Autoware Universe Documentation" {source} + sd "autoware-documentation" "autoware.universe" {source} + sd "repo_url: .*" "repo_url: https://github.com/autowarefoundation/autoware.universe" {source} + sd "/edit/main/docs/" "/edit/main/" {source} + sd "docs_dir: .*" "docs_dir: ." {source} + sd "assets/(\w+)" "docs/assets/\$1" {source} + sd -- \ + " - macros" \ + " - macros: + module_name: mkdocs_macros" {source} + - source: docs/assets/js/mathjax.js diff --git a/.github/workflows/PULL_REQUEST_TEMPLATE.md b/.github/workflows/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..7aedefd0 --- /dev/null +++ b/.github/workflows/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,50 @@ +## Description + + + +## Related links + + + +## Tests performed + + + +## Notes for reviewers + + + +## Interface changes + + + +## Effects on system behavior + + + +## Pre-review checklist for the PR author + +The PR author **must** check the checkboxes below when creating the PR. + +- [ ] I've confirmed the [contribution guidelines]. +- [ ] The PR follows the [pull request guidelines]. + +## In-review checklist for the PR reviewers + +The PR reviewers **must** check the checkboxes below before approval. + +- [ ] The PR follows the [pull request guidelines]. +- [ ] The PR has been properly tested. +- [ ] The PR has been reviewed by the code owners. + +## Post-review checklist for the PR author + +The PR author **must** check the checkboxes below before merging. + +- [ ] There are no open discussions or they are tracked via tickets. +- [ ] The PR is ready for merge. + +After all checkboxes are checked, anyone who has write access can merge the PR. + +[contribution guidelines]: https://autowarefoundation.github.io/autoware-documentation/main/contributing/ +[pull request guidelines]: https://autowarefoundation.github.io/autoware-documentation/main/contributing/pull-request-guidelines/ diff --git a/.github/workflows/build-and-test-differential-self-hosted.yaml b/.github/workflows/build-and-test-differential-self-hosted.yaml new file mode 100644 index 00000000..86d3011c --- /dev/null +++ b/.github/workflows/build-and-test-differential-self-hosted.yaml @@ -0,0 +1,61 @@ +name: build-and-test-differential-self-hosted + +on: + pull_request: + types: + - opened + - synchronize + - labeled + workflow_dispatch: + +jobs: + prevent-no-label-execution: + uses: autowarefoundation/autoware-github-actions/.github/workflows/prevent-no-label-execution.yaml@v1 + with: + label: ARM64 + + build-and-test-differential-self-hosted: + needs: prevent-no-label-execution + if: ${{ needs.prevent-no-label-execution.outputs.run == 'true' }} + runs-on: [self-hosted, linux, ARM64] + container: ${{ matrix.container }}${{ matrix.container-suffix }} + strategy: + fail-fast: false + matrix: + rosdistro: + - humble + container-suffix: + - "" + - -cuda + include: + - rosdistro: humble + container: ghcr.io/autowarefoundation/autoware-universe:humble-latest + 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 + 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 }} diff --git a/.github/workflows/build-and-test-differential.yaml b/.github/workflows/build-and-test-differential.yaml new file mode 100644 index 00000000..e9db0d14 --- /dev/null +++ b/.github/workflows/build-and-test-differential.yaml @@ -0,0 +1,111 @@ +name: build-and-test-differential + +on: + pull_request: + types: + - opened + - synchronize + - labeled + +jobs: + prevent-no-label-execution: + uses: autowarefoundation/autoware-github-actions/.github/workflows/prevent-no-label-execution.yaml@v1 + with: + label: tag:run-build-and-test-differential + + build-and-test-differential: + needs: prevent-no-label-execution + if: ${{ needs.prevent-no-label-execution.outputs.run == 'true' }} + runs-on: [self-hosted, linux, X64] + container: ${{ matrix.container }}${{ matrix.container-suffix }} + strategy: + fail-fast: false + matrix: + rosdistro: + - humble + container-suffix: + - "" + - -cuda + include: + - rosdistro: humble + container: ghcr.io/autowarefoundation/autoware-universe:humble-latest + build-depends-repos: build_depends.repos + steps: + - name: Check out repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Check disk space before build + run: df -h + + - 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 + + - name: Check disk space after build + run: df -h + + clang-tidy-differential: + runs-on: [self-hosted, linux, X64] + container: ghcr.io/autowarefoundation/autoware-universe:humble-latest-cuda + 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-self-hosted.yaml b/.github/workflows/build-and-test-self-hosted.yaml new file mode 100644 index 00000000..9f351a5d --- /dev/null +++ b/.github/workflows/build-and-test-self-hosted.yaml @@ -0,0 +1,49 @@ +name: build-and-test-self-hosted + +on: + schedule: + - cron: 0 0 * * * + workflow_dispatch: + +jobs: + build-and-test-self-hosted: + runs-on: [self-hosted, linux, ARM64] + container: ${{ matrix.container }}${{ matrix.container-suffix }} + strategy: + fail-fast: false + matrix: + rosdistro: + - humble + container-suffix: + - "" + - -cuda + include: + - rosdistro: humble + container: ghcr.io/autowarefoundation/autoware-universe:humble-latest + 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 != '' }} + 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 }} diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml new file mode 100644 index 00000000..7568c899 --- /dev/null +++ b/.github/workflows/build-and-test.yaml @@ -0,0 +1,69 @@ +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 }}${{ matrix.container-suffix }} + strategy: + fail-fast: false + matrix: + rosdistro: + - humble + container-suffix: + - "" + - -cuda + include: + - rosdistro: humble + container: ghcr.io/autowarefoundation/autoware-universe:humble-latest + build-depends-repos: build_depends.repos + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Free disk space (Ubuntu) + uses: jlumbroso/free-disk-space@v1.2.0 + with: + tool-cache: false + dotnet: false + swap-storage: false + large-packages: false + + - 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/cancel-previous-workflows.yaml b/.github/workflows/cancel-previous-workflows.yaml new file mode 100644 index 00000000..1da4d249 --- /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.12.0 + with: + workflow_id: all + all_but_latest: true diff --git a/.github/workflows/check-build-depends.yaml b/.github/workflows/check-build-depends.yaml new file mode 100644 index 00000000..81618a1d --- /dev/null +++ b/.github/workflows/check-build-depends.yaml @@ -0,0 +1,37 @@ +name: check-build-depends + +on: + pull_request: + paths: + - build_depends*.repos + +jobs: + check-build-depends: + 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 + 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 }} diff --git a/.github/workflows/clang-tidy-pr-comments-manually.yaml b/.github/workflows/clang-tidy-pr-comments-manually.yaml new file mode 100644 index 00000000..9bccd972 --- /dev/null +++ b/.github/workflows/clang-tidy-pr-comments-manually.yaml @@ -0,0 +1,62 @@ +name: clang-tidy-pr-comments-manually + +on: + workflow_dispatch: + inputs: + workflow_run_id_or_url: + description: The target workflow run ID or URL of the build-and-test-differential workflow + required: true +jobs: + clang-tidy-pr-comments-manually: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Download analysis results + run: | + workflow_run_id=$(echo "${{ inputs.workflow_run_id_or_url }}" | sed -e "s|.*runs/||" -e "s|/jobs.*||") + gh run download "$workflow_run_id" -D /tmp || true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Check if the fixes.yaml file exists + id: check-fixes-yaml-existence + uses: autowarefoundation/autoware-github-actions/check-file-existence@v1 + with: + files: /tmp/clang-tidy-result/fixes.yaml + + - name: Set variables + if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }} + id: set-variables + run: | + echo "pr-id=$(cat /tmp/clang-tidy-result/pr-id.txt)" >> $GITHUB_OUTPUT + echo "pr-head-repo=$(cat /tmp/clang-tidy-result/pr-head-repo.txt)" >> $GITHUB_OUTPUT + echo "pr-head-ref=$(cat /tmp/clang-tidy-result/pr-head-ref.txt)" >> $GITHUB_OUTPUT + + - name: Check out PR head + if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }} + uses: actions/checkout@v3 + with: + repository: ${{ steps.set-variables.outputs.pr-head-repo }} + ref: ${{ steps.set-variables.outputs.pr-head-ref }} + persist-credentials: false + + - name: Replace paths in fixes.yaml + if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }} + run: | + sed -i -e "s|/__w/|/home/runner/work/|g" /tmp/clang-tidy-result/fixes.yaml + cat /tmp/clang-tidy-result/fixes.yaml + + - name: Copy fixes.yaml to access from Docker Container Action + if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }} + run: | + cp /tmp/clang-tidy-result/fixes.yaml fixes.yaml + + - name: Run clang-tidy-pr-comments action + if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }} + uses: platisd/clang-tidy-pr-comments@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + clang_tidy_fixes: fixes.yaml + pull_request_id: ${{ steps.set-variables.outputs.pr-id }} diff --git a/.github/workflows/clang-tidy-pr-comments.yaml b/.github/workflows/clang-tidy-pr-comments.yaml new file mode 100644 index 00000000..baaa0fb8 --- /dev/null +++ b/.github/workflows/clang-tidy-pr-comments.yaml @@ -0,0 +1,63 @@ +name: clang-tidy-pr-comments + +on: + workflow_run: + workflows: + - build-and-test-differential + types: + - completed + +jobs: + clang-tidy-pr-comments: + if: ${{ github.event.workflow_run.event == 'pull_request' && contains(fromJson('["success", "failure"]'), github.event.workflow_run.conclusion) }} + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Download analysis results + run: | + gh run download ${{ github.event.workflow_run.id }} -D /tmp || true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Check if the fixes.yaml file exists + id: check-fixes-yaml-existence + uses: autowarefoundation/autoware-github-actions/check-file-existence@v1 + with: + files: /tmp/clang-tidy-result/fixes.yaml + + - name: Set variables + if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }} + id: set-variables + run: | + echo "pr-id=$(cat /tmp/clang-tidy-result/pr-id.txt)" >> $GITHUB_OUTPUT + echo "pr-head-repo=$(cat /tmp/clang-tidy-result/pr-head-repo.txt)" >> $GITHUB_OUTPUT + echo "pr-head-ref=$(cat /tmp/clang-tidy-result/pr-head-ref.txt)" >> $GITHUB_OUTPUT + + - name: Check out PR head + if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }} + uses: actions/checkout@v3 + with: + repository: ${{ steps.set-variables.outputs.pr-head-repo }} + ref: ${{ steps.set-variables.outputs.pr-head-ref }} + persist-credentials: false + + - name: Replace paths in fixes.yaml + if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }} + run: | + sed -i -e "s|/__w/|/home/runner/work/|g" /tmp/clang-tidy-result/fixes.yaml + cat /tmp/clang-tidy-result/fixes.yaml + + - name: Copy fixes.yaml to access from Docker Container Action + if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }} + run: | + cp /tmp/clang-tidy-result/fixes.yaml fixes.yaml + + - name: Run clang-tidy-pr-comments action + if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }} + uses: platisd/clang-tidy-pr-comments@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + clang_tidy_fixes: fixes.yaml + pull_request_id: ${{ steps.set-variables.outputs.pr-id }} diff --git a/.github/workflows/delete-closed-pr-docs.yaml b/.github/workflows/delete-closed-pr-docs.yaml new file mode 100644 index 00000000..b7b009fb --- /dev/null +++ b/.github/workflows/delete-closed-pr-docs.yaml @@ -0,0 +1,20 @@ +name: delete-closed-pr-docs + +on: + schedule: + - cron: 0 0 * * * + workflow_dispatch: + +jobs: + delete-closed-pr-docs: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Delete closed PR docs + uses: autowarefoundation/autoware-github-actions/delete-closed-pr-docs@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/deploy-docs.yaml b/.github/workflows/deploy-docs.yaml new file mode 100644 index 00000000..b48d70db --- /dev/null +++ b/.github/workflows/deploy-docs.yaml @@ -0,0 +1,42 @@ +name: deploy-docs + +on: + push: + branches: + - main + - galactic + paths: + - mkdocs.yaml + - "**/*.md" + - "**/*.svg" + - "**/*.png" + - "**/*.jpg" + pull_request_target: + types: + - opened + - synchronize + - labeled + workflow_dispatch: + +jobs: + prevent-no-label-execution: + uses: autowarefoundation/autoware-github-actions/.github/workflows/prevent-no-label-execution.yaml@v1 + with: + label: tag:deploy-docs + + deploy-docs: + needs: prevent-no-label-execution + if: ${{ needs.prevent-no-label-execution.outputs.run == 'true' }} + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + + - name: Deploy docs + uses: autowarefoundation/autoware-github-actions/deploy-docs@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + latest: ${{ github.event_name != 'pull_request_target' && github.ref_name == github.event.repository.default_branch }} diff --git a/.github/workflows/github-release.yaml b/.github/workflows/github-release.yaml new file mode 100644 index 00000000..b426d0cb --- /dev/null +++ b/.github/workflows/github-release.yaml @@ -0,0 +1,78 @@ +name: github-release + +on: + push: + branches: + - beta/v* + tags: + - v* + workflow_dispatch: + inputs: + beta-branch-or-tag-name: + description: The name of the beta branch or tag to release + type: string + required: true + +jobs: + github-release: + runs-on: ubuntu-latest + steps: + - name: Set tag name + id: set-tag-name + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + REF_NAME="${{ github.event.inputs.beta-branch-or-tag-name }}" + else + REF_NAME="${{ github.ref_name }}" + fi + + echo "ref-name=$REF_NAME" >> $GITHUB_OUTPUT + echo "tag-name=${REF_NAME#beta/}" >> $GITHUB_OUTPUT + + - name: Check out repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ steps.set-tag-name.outputs.ref-name }} + + - name: Set target name for beta branches + id: set-target-name + run: | + if [[ "${{ steps.set-tag-name.outputs.ref-name }}" =~ "beta/" ]]; then + echo "target-name=${{ steps.set-tag-name.outputs.ref-name }}" >> $GITHUB_OUTPUT + fi + + - name: Create a local tag for beta branches + run: | + if [ "${{ steps.set-target-name.outputs.target-name }}" != "" ]; then + git tag "${{ steps.set-tag-name.outputs.tag-name }}" + fi + + - name: Run generate-changelog + id: generate-changelog + uses: autowarefoundation/autoware-github-actions/generate-changelog@v1 + + - name: Select verb + id: select-verb + run: | + has_previous_draft=$(gh release view --json isDraft -q ".isDraft" "${{ steps.set-tag-name.outputs.tag-name }}") || true + + verb=create + if [ "$has_previous_draft" = "true" ]; then + verb=edit + fi + + echo "verb=$verb" >> $GITHUB_OUTPUT + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Release to GitHub + run: | + gh release ${{ steps.select-verb.outputs.verb }} "${{ steps.set-tag-name.outputs.tag-name }}" \ + --draft \ + --target "${{ steps.set-target-name.outputs.target-name }}" \ + --title "Release ${{ steps.set-tag-name.outputs.tag-name }}" \ + --notes "$NOTES" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NOTES: ${{ steps.generate-changelog.outputs.changelog }} diff --git a/.github/workflows/json-schema-check.yaml b/.github/workflows/json-schema-check.yaml new file mode 100644 index 00000000..3d0c0b83 --- /dev/null +++ b/.github/workflows/json-schema-check.yaml @@ -0,0 +1,17 @@ +name: json-schema-check + +on: + pull_request: + paths: + - "**/schema/*.schema.json" + - "**/config/*.param.yaml" + +jobs: + json-schema-check: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v3 + + - name: Run json-schema-check + uses: autowarefoundation/autoware-github-actions/json-schema-check@v1 diff --git a/.github/workflows/openai-pr-reviewer.yaml b/.github/workflows/openai-pr-reviewer.yaml new file mode 100644 index 00000000..4ecbd931 --- /dev/null +++ b/.github/workflows/openai-pr-reviewer.yaml @@ -0,0 +1,39 @@ +name: Code Review By ChatGPT + +permissions: + contents: read + pull-requests: write + +on: + pull_request_target: + types: + - labeled + pull_request_review_comment: + types: [created] + +concurrency: + group: ${{ github.repository }}-${{ github.event.number || github.head_ref || + github.sha }}-${{ github.workflow }}-${{ github.event_name == + 'pull_request_review_comment' && 'pr_comment' || 'pr' }} + cancel-in-progress: ${{ github.event_name != 'pull_request_review_comment' }} + +jobs: + prevent-no-label-execution: + uses: autowarefoundation/autoware-github-actions/.github/workflows/prevent-no-label-execution.yaml@v1 + with: + label: tag:openai-pr-reviewer + review: + needs: prevent-no-label-execution + if: ${{ needs.prevent-no-label-execution.outputs.run == 'true' }} + runs-on: ubuntu-latest + steps: + - uses: fluxninja/openai-pr-reviewer@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + with: + debug: false + review_simple_changes: false + review_comment_lgtm: false + openai_light_model: gpt-3.5-turbo-0613 + openai_heavy_model: gpt-3.5-turbo-0613 # The default is to use GPT4, which needs to be changed to join ChatGPT Plus. diff --git a/.github/workflows/pr-labeler.yaml b/.github/workflows/pr-labeler.yaml new file mode 100644 index 00000000..d45067be --- /dev/null +++ b/.github/workflows/pr-labeler.yaml @@ -0,0 +1,16 @@ +name: pr-labeler +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +jobs: + label: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v4 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + configuration-path: .github/labeler.yaml diff --git a/.github/workflows/pre-commit-optional.yaml b/.github/workflows/pre-commit-optional.yaml new file mode 100644 index 00000000..38738196 --- /dev/null +++ b/.github/workflows/pre-commit-optional.yaml @@ -0,0 +1,19 @@ +name: pre-commit-optional + +on: + pull_request: + +jobs: + pre-commit-optional: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Run pre-commit + uses: autowarefoundation/autoware-github-actions/pre-commit@v1 + with: + pre-commit-config: .pre-commit-config-optional.yaml + base-branch: origin/${{ github.base_ref }} diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml new file mode 100644 index 00000000..33c00ee1 --- /dev/null +++ b/.github/workflows/pre-commit.yaml @@ -0,0 +1,27 @@ +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@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + + - 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 00000000..71224c22 --- /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-all.yaml b/.github/workflows/spell-check-all.yaml new file mode 100644 index 00000000..057bd78d --- /dev/null +++ b/.github/workflows/spell-check-all.yaml @@ -0,0 +1,19 @@ +name: spell-check-all + +on: + workflow_dispatch: + schedule: + - cron: 0 0 * * * + +jobs: + spell-check-all: + 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 + incremental-files-only: false diff --git a/.github/workflows/spell-check-partial.yaml b/.github/workflows/spell-check-partial.yaml new file mode 100644 index 00000000..608e7644 --- /dev/null +++ b/.github/workflows/spell-check-partial.yaml @@ -0,0 +1,18 @@ +name: spell-check-partial + +on: + pull_request: + +jobs: + spell-check-partial: + 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 + local-cspell-json: .cspell-partial.json + incremental-files-only: false diff --git a/.github/workflows/sync-files.yaml b/.github/workflows/sync-files.yaml new file mode 100644 index 00000000..5025e6c8 --- /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: | + tag:bot + tag:sync-files + auto-merge-method: squash diff --git a/.github/workflows/update-codeowners-from-packages.yaml b/.github/workflows/update-codeowners-from-packages.yaml new file mode 100644 index 00000000..7898dfe0 --- /dev/null +++ b/.github/workflows/update-codeowners-from-packages.yaml @@ -0,0 +1,33 @@ +name: update-codeowners-from-packages + +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 }} + + update-codeowners-from-packages: + 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 update-codeowners-from-packages + uses: autowarefoundation/autoware-github-actions/update-codeowners-from-packages@v1 + with: + token: ${{ steps.generate-token.outputs.token }} + pr-labels: | + tag:bot + tag:update-codeowners-from-packages + auto-merge-method: squash diff --git a/.markdown-link-check.json b/.markdown-link-check.json new file mode 100644 index 00000000..c71a3e42 --- /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 00000000..babaaa1f --- /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/.pages b/.pages new file mode 100644 index 00000000..7ee8aa05 --- /dev/null +++ b/.pages @@ -0,0 +1,2 @@ +nav: + - ... | regex=^(?!.*(README.md|CONTRIBUTING.md|CODE_OF_CONDUCT.md|DISCLAIMER.md)).*$ diff --git a/.pre-commit-config-optional.yaml b/.pre-commit-config-optional.yaml new file mode 100644 index 00000000..3b43f9ae --- /dev/null +++ b/.pre-commit-config-optional.yaml @@ -0,0 +1,6 @@ +repos: + - repo: https://github.com/tcort/markdown-link-check + rev: v3.11.2 + hooks: + - id: markdown-link-check + args: [--quiet, --config=.markdown-link-check.json] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..a5ca7b6c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,95 @@ +ci: + autofix_commit_msg: "style(pre-commit): autofix" + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-json + - id: check-merge-conflict + - id: check-toml + - id: check-xml + - id: check-yaml + args: [--unsafe] + - 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.33.0 + hooks: + - id: markdownlint + args: [-c, .markdownlint.yaml, --fix] + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v3.0.0-alpha.6 + hooks: + - id: prettier + + - repo: https://github.com/adrienverge/yamllint + rev: v1.30.0 + hooks: + - id: yamllint + + - repo: https://github.com/tier4/pre-commit-hooks-ros + rev: v0.8.0 + hooks: + - id: flake8-ros + - id: prettier-xacro + - id: prettier-launch-xml + - id: prettier-package-xml + - id: ros-include-guard + - id: sort-package-xml + + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.9.0.2 + hooks: + - id: shellcheck + + - repo: https://github.com/scop/pre-commit-shfmt + rev: v3.6.0-2 + 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: 23.3.0 + hooks: + - id: black + args: [--line-length=100] + + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v16.0.0 + hooks: + - id: clang-format + types_or: [c++, c, cuda] + + - repo: https://github.com/cpplint/cpplint + rev: 1.6.1 + hooks: + - id: cpplint + args: [--quiet] + exclude: .cu + + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.23.2 + hooks: + - id: check-metaschema + files: ^.+/schema/.*schema\.json$ + + - repo: local + hooks: + - id: prettier-svg + name: prettier svg + description: Apply Prettier with plugin-xml to svg. + entry: prettier --write --list-different --ignore-unknown --print-width 200 --xml-self-closing-space false --xml-whitespace-sensitivity ignore + language: node + files: .svg$ + additional_dependencies: [prettier@2.7.1, "@prettier/plugin-xml@2.2.0"] diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..a3c34d00 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +*.param.yaml +*.rviz diff --git a/.prettierrc.yaml b/.prettierrc.yaml new file mode 100644 index 00000000..e29bf327 --- /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 00000000..2c7bd088 --- /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 00000000..ba6bdf08 --- /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/build_depends.repos b/build_depends.repos new file mode 100644 index 00000000..6e4fc677 --- /dev/null +++ b/build_depends.repos @@ -0,0 +1,23 @@ +repositories: + # core + core/autoware_common: + type: git + url: https://github.com/autowarefoundation/autoware_common.git + version: main + core/autoware.core: + type: git + url: https://github.com/autowarefoundation/autoware.core.git + version: main + core/autoware_msgs: + type: git + url: https://github.com/autowarefoundation/autoware_msgs.git + version: main + core/autoware_adapi_msgs: + type: git + url: https://github.com/autowarefoundation/autoware_adapi_msgs.git + version: main + core/external/autoware_auto_msgs: + type: git + url: https://github.com/tier4/autoware_auto_msgs.git + version: tier4/main + diff --git a/codecov.yaml b/codecov.yaml new file mode 100644 index 00000000..8ca21967 --- /dev/null +++ b/codecov.yaml @@ -0,0 +1,22 @@ +coverage: + status: + project: + default: + target: auto + patch: + default: + target: auto + +comment: + show_carryforward_flags: true + +flag_management: + default_rules: + carryforward: true + statuses: + - name_prefix: project- + type: project + target: auto + - name_prefix: patch- + type: patch + target: auto diff --git a/mkdocs.yaml b/mkdocs.yaml new file mode 100644 index 00000000..9f868f28 --- /dev/null +++ b/mkdocs.yaml @@ -0,0 +1,96 @@ +site_name: Autoware Universe Documentation +site_url: https://autowarefoundation.github.io/autoware_tools +repo_url: https://github.com/autowarefoundation/autoware_tools +edit_uri: https://github.com/autowarefoundation/autoware_tools/edit/main/ +docs_dir: . +copyright: Copyright © 2023 The Autoware Foundation + +theme: + name: material + features: + - navigation.expand + - navigation.indexes + - navigation.instant + - navigation.sections + - navigation.tabs + - navigation.tabs.sticky + - navigation.top + - navigation.footer + favicon: docs/assets/images/autoware-foundation.png + icon: + logo: fontawesome/solid/car + repo: fontawesome/brands/github + language: en + palette: + - scheme: default + primary: white + toggle: + icon: material/weather-sunny + name: Switch to dark mode + - scheme: slate + primary: grey + toggle: + icon: material/weather-night + name: Switch to light mode + +extra: + font: + text: Roboto + code: Roboto Mono + version: + provider: mike + +extra_css: + - docs/assets/css/extra.css + - https://use.fontawesome.com/releases/v5.15.4/css/all.css + +extra_javascript: + - docs/assets/js/mathjax.js + - https://polyfill.io/v3/polyfill.min.js?features=es6 + - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js + +plugins: + - awesome-pages + - exclude: + regex: + - ^(?!(.*/)?assets/).*\.(?!(.*\.)?md|(.*\.)?svg|(.*\.)?png|(.*\.)?gif|(.*\.)?jpg).*$ + - ^(.*/)?[^.]*$ + - macros: + module_name: mkdocs_macros + - mkdocs-video + - same-dir + - search + +markdown_extensions: + - abbr + - admonition + - attr_list + - codehilite: + guess_lang: false + - fontawesome_markdown + - footnotes + - md_in_html + - mdx_math + - mdx_truly_sane_lists: + nested_indent: 2 + - plantuml_markdown: + server: http://www.plantuml.com/plantuml + format: svg + - pymdownx.arithmatex: + generic: true + - pymdownx.details + - pymdownx.emoji: + emoji_index: !!python/name:materialx.emoji.twemoji + emoji_generator: !!python/name:materialx.emoji.to_svg + - pymdownx.highlight + - pymdownx.snippets: + auto_append: + - includes/abbreviations.md + - pymdownx.superfences: + custom_fences: + - name: mermaid + class: mermaid + format: !!python/name:pymdownx.superfences.fence_code_format + - toc: + permalink: "#" + toc_depth: 3 diff --git a/mkdocs_macros.py b/mkdocs_macros.py new file mode 100644 index 00000000..97f76442 --- /dev/null +++ b/mkdocs_macros.py @@ -0,0 +1,72 @@ +import json + +from tabulate import tabulate + +# This file is for defining macros for mkdocs-macros plugin +# Check https://mkdocs-macros-plugin.readthedocs.io/en/latest/macros/ for the details + + +def format_param_type(param_type): + if param_type == "number": + return "float" + else: + return param_type + + +def format_param_range(param): + list_of_range = [] + if "enum" in param.keys(): + list_of_range.append(param["enum"]) + if "minimum" in param.keys(): + list_of_range.append("≥" + str(param["minimum"])) + if "exclusiveMinimum" in param.keys(): + list_of_range.append(">" + str(param["exclusiveMinimum"])) + if "maximum" in param.keys(): + list_of_range.append("≤" + str(param["maximum"])) + if "exclusiveMaximum" in param.keys(): + list_of_range.append("<" + str(param["exclusiveMaximum"])) + if "exclusive" in param.keys(): + list_of_range.append("≠" + str(param["exclusive"])) + + if len(list_of_range) == 0: + return "N/A" + else: + range_in_text = "" + for item in list_of_range: + if range_in_text != "": + range_in_text += "
" + range_in_text += str(item) + return range_in_text + + +def extract_parameter_info(parameters, namespace=""): + params = [] + for k, v in parameters.items(): + if "$ref" in v.keys(): + continue + if v["type"] != "object": + param = {} + param["Name"] = namespace + k + param["Type"] = format_param_type(v["type"]) + param["Description"] = v["description"] + param["Default"] = v["default"] + param["Range"] = format_param_range(v) + params.append(param) + else: # if the object is namespace, then dive deeper in to json value + params.extend(extract_parameter_info(v["properties"], k + ".")) + return params + + +def format_json(json_data): + parameters = list(json_data["definitions"].values())[0]["properties"] + # cspell: ignore tablefmt + markdown_table = tabulate(extract_parameter_info(parameters), headers="keys", tablefmt="github") + return markdown_table + + +def define_env(env): + @env.macro + def json_to_markdown(json_schema_file_path): + with open(json_schema_file_path) as f: + data = json.load(f) + return format_json(data) diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..5214751c --- /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