diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index f32405fd..54b7c654 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -1,21 +1,21 @@ -name: Build and test (actions-ros + setup-ros on ubuntu:focal) +name: Build and test on: pull_request: push: branches: - main + workflow_dispatch: jobs: build-and-test: runs-on: ubuntu-latest - container: ubuntu:focal steps: - name: Check out repo uses: actions/checkout@v2 with: - fetch-depth: 2 # https://github.com/codecov/codecov-action/issues/190#issuecomment-790729633 + fetch-depth: 2 # https://github.com/codecov/codecov-action/issues/190#issuecomment-790729633 - name: Setup ROS environment uses: ros-tooling/setup-ros@v0.1 @@ -24,27 +24,33 @@ jobs: - name: Run action-ros-ci id: action_ros_ci_step - uses: ros-tooling/action-ros-ci@v0.1 + uses: ros-tooling/action-ros-ci@v0.2 with: package-name: obstacle_stop_planner_refine target-ros2-distro: foxy vcs-repo-file-url: build_depends.repos - colcon-mixin-name: coverage-gcc coverage-pytest - # If possible, pin the repository in the workflow to a specific commit to avoid - # changes in colcon-mixin-repository from breaking your tests. + 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 - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1.2.1 + uses: codecov/codecov-action@v1 with: files: ros_ws/lcov/total_coverage.info,ros_ws/coveragepy/.coverage flags: unittests name: codecov-umbrella - # fail_ci_if_error: true # Temporarily disable it to suppress errors when there is no unit test. + fail_ci_if_error: true verbose: true - name: Upload colcon-logs - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v2 with: name: colcon-logs path: ${{ steps.action_ros_ci_step.outputs.ros-workspace-directory-name }}/log diff --git a/.github/workflows/code_metrics_main.yml b/.github/workflows/code_metrics_main.yml index 1620f9f4..4373affc 100644 --- a/.github/workflows/code_metrics_main.yml +++ b/.github/workflows/code_metrics_main.yml @@ -4,10 +4,15 @@ on: push: branches: - main + workflow_dispatch: + +env: + GITHUB_PAGES_URL: https://tier4.github.io/obstacle_stop_planner_refine jobs: code-metrics: runs-on: ubuntu-latest + steps: - name: Check out repo uses: actions/checkout@v2 @@ -16,10 +21,10 @@ jobs: run: | git clone https://github.com/terryyin/lizard.git mkdir -p public/pr-check/main - python3 lizard/lizard.py obstacle_stop_planner_refine/ -l cpp -l python -x"*test*" \ + python3 lizard/lizard.py -l cpp -l python -x "*test*" \ --CCN 20 -T nloc=200 --arguments 6 \ --html > public/pr-check/main/code-metrics.html || true - python3 lizard/lizard.py obstacle_stop_planner_refine/ -l cpp -l python -x"*test*" \ + python3 lizard/lizard.py -l cpp -l python -x "*test*" \ --CCN 20 -T nloc=200 --arguments 6 || true - name: Deploy measurement result page to gh-pages @@ -32,6 +37,7 @@ jobs: create-index-page: needs: code-metrics runs-on: ubuntu-latest + steps: - name: Check out repo uses: actions/checkout@v2 @@ -41,7 +47,7 @@ jobs: - name: Create index page run: | cd pr-check - tree -H 'https://tier4.github.io/obstacle_stop_planner_refine/pr-check' \ + tree -H "$GITHUB_PAGES_URL/pr-check" \ -L 2 --noreport --charset utf-8 -T 'Index of code metrics' \ -P "*.html" > index.html diff --git a/.github/workflows/code_metrics_pr.yml b/.github/workflows/code_metrics_pr.yml index 49881d5e..ff7b25d9 100644 --- a/.github/workflows/code_metrics_pr.yml +++ b/.github/workflows/code_metrics_pr.yml @@ -1,15 +1,18 @@ -name: Measure code metrics +name: Measure code metrics for PR on: pull_request: - workflow_dispatch: + +env: + GITHUB_PAGES_URL: https://tier4.github.io/obstacle_stop_planner_refine jobs: code-metrics: runs-on: ubuntu-latest + steps: - name: Set environment variable - id: plum + id: set_env run: echo "::set-output name=PULL_NUMBER::$(jq --raw-output .pull_request.number $GITHUB_EVENT_PATH)" - name: Check out repo @@ -23,17 +26,17 @@ jobs: mkdir -p public/pr-check git diff origin/$GITHUB_HEAD_REF..origin/$GITHUB_BASE_REF \ --diff-filter=AM \ - --name-only -- '*.hpp' '*.cpp' '*.py' > file_list.txt - python3 lizard/lizard.py obstacle_stop_planner_refine/ -l cpp -l python -x"*test*" -f file_list.txt \ + --name-only -- '*.hpp' '*.cpp' '*.py' > changed_file_list.txt + python3 lizard/lizard.py -l cpp -l python -x "*test*" -f changed_file_list.txt \ --CCN 20 -T nloc=200 --arguments 6 \ --html > public/pr-check/code-metrics.html || true - python3 lizard/lizard.py obstacle_stop_planner_refine/ -l cpp -l python -x"*test*" -f file_list.txt \ + python3 lizard/lizard.py -l cpp -l python -x "*test*" -f changed_file_list.txt \ --CCN 20 -T nloc=200 --arguments 6 || true - name: Rename file run: | - mkdir public/pr-check/pr${{ steps.plum.outputs.PULL_NUMBER }} - mv public/pr-check/code-metrics.html public/pr-check/pr${{ steps.plum.outputs.PULL_NUMBER }}/code-metrics.html + mkdir public/pr-check/pr${{ steps.set_env.outputs.PULL_NUMBER }} + mv public/pr-check/code-metrics.html public/pr-check/pr${{ steps.set_env.outputs.PULL_NUMBER }}/code-metrics.html - name: Deploy measurement result page to gh-pages uses: peaceiris/actions-gh-pages@v3 @@ -50,13 +53,14 @@ jobs: ### :bar_chart: Code Metrics Report Branch | Metrics ------- | ------- - This PR | [code-metrics.html](https://tier4.github.io/obstacle_stop_planner_refine/pr-check/pr${{ steps.plum.outputs.PULL_NUMBER }}/code-metrics.html) - main | [code-metrics.html](https://tier4.github.io/obstacle_stop_planner_refine/pr-check/main/code-metrics.html) + This PR | [code-metrics.html]($GITHUB_PAGES_URL/pr-check/pr${{ steps.set_env.outputs.PULL_NUMBER }}/code-metrics.html) + main | [code-metrics.html]($GITHUB_PAGES_URL/pr-check/main/code-metrics.html) GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} create-index-page: needs: code-metrics runs-on: ubuntu-latest + steps: - name: Check out repo uses: actions/checkout@v2 @@ -66,7 +70,7 @@ jobs: - name: Create index page run: | cd pr-check - tree -H 'https://tier4.github.io/obstacle_stop_planner_refine/pr-check' \ + tree -H "$GITHUB_PAGES_URL/pr-check" \ -L 2 --noreport --charset utf-8 -T 'Index of code metrics' \ -P "*.html" > index.html diff --git a/.github/workflows/mkdocs.yml b/.github/workflows/mkdocs.yml index 87e71d19..24a9bf74 100644 --- a/.github/workflows/mkdocs.yml +++ b/.github/workflows/mkdocs.yml @@ -5,23 +5,25 @@ on: push: branches: - main + workflow_dispatch: jobs: deploy: runs-on: ubuntu-latest + steps: - name: Set environment variable - id: plum + id: set_env run: echo "::set-output name=PULL_NUMBER::$(jq --raw-output .pull_request.number $GITHUB_EVENT_PATH)" - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Set up Python + - name: Setup Python uses: actions/setup-python@v2 with: - python-version: '3.8' + python-version: "3.8" - name: Build MkDocs run: | @@ -31,8 +33,8 @@ jobs: - name: Change directory structure run: | - mkdir -p public/pr-check/pr${{ steps.plum.outputs.PULL_NUMBER }} - mv site public/pr-check/pr${{ steps.plum.outputs.PULL_NUMBER }}/ + mkdir -p public/pr-check/pr${{ steps.set_env.outputs.PULL_NUMBER }} + mv site public/pr-check/pr${{ steps.set_env.outputs.PULL_NUMBER }}/ - name: Deploy MkDocs to gh-pages uses: peaceiris/actions-gh-pages@v3 diff --git a/.github/workflows/nightly_clang_build.yml b/.github/workflows/nightly_clang_build.yml index 317b1113..29fd046e 100644 --- a/.github/workflows/nightly_clang_build.yml +++ b/.github/workflows/nightly_clang_build.yml @@ -1,33 +1,41 @@ name: Clang nightly build on: - workflow_dispatch: schedule: - cron: "0 19 * * *" # run at 4 AM JST + workflow_dispatch: jobs: build-using-clang: - runs-on: ubuntu-20.04 - container: ubuntu:focal + runs-on: ubuntu-latest steps: - name: Check out repo - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2 - name: Setup ROS environment - uses: ros-tooling/setup-ros@0.1.1 + uses: ros-tooling/setup-ros@v0.1 with: required-ros-distributions: foxy - name: Run action-ros-ci id: action_ros_ci_step - uses: ros-tooling/action-ros-ci@0.1.2 + uses: ros-tooling/action-ros-ci@v0.2 with: package-name: obstacle_stop_planner_refine target-ros2-distro: foxy vcs-repo-file-url: build_depends.repos - colcon-mixin-name: clang-libcxx - # If possible, pin the repository in the workflow to a specific commit to avoid - # changes in colcon-mixin-repository from breaking your tests. + colcon-defaults: | + { + "build": { + "mixin": ["release", "compile-commands"], + "cmake-args": [ + "-DCMAKE_C_COMPILER=clang", + "-DCMAKE_CXX_COMPILER=clang++", + "-DCMAKE_CXX_FLAGS='-Wthread-safety'", + "-DFORCE_BUILD_VENDOR_PKG=ON" + ], + "continue-on-error": true + } + } colcon-mixin-repository: https://raw.githubusercontent.com/colcon/colcon-mixin-repository/1ddb69bedfd1f04c2f000e95452f7c24a4d6176b/index.yaml - extra-cmake-args: -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON