feat(build-and-test-differential): modify clang-tidy to run only on specified packages #39283
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-and-test-differential | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- labeled | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} | |
cancel-in-progress: true | |
env: | |
CC: /usr/lib/ccache/gcc | |
CXX: /usr/lib/ccache/g++ | |
jobs: | |
make-sure-label-is-present: | |
uses: autowarefoundation/autoware-github-actions/.github/workflows/make-sure-label-is-present.yaml@v1 | |
with: | |
label: tag:run-build-and-test-differential | |
make-sure-require-cuda-label-is-present: | |
uses: autowarefoundation/autoware-github-actions/.github/workflows/make-sure-label-is-present.yaml@v1 | |
with: | |
label: tag:require-cuda-build-and-test | |
build-and-test-differential: | |
needs: [make-sure-label-is-present, make-sure-require-cuda-label-is-present] | |
if: ${{ needs.make-sure-label-is-present.outputs.result == 'true' }} | |
runs-on: ${{ matrix.runner }} | |
container: ${{ matrix.container }}${{ matrix.container-suffix }} | |
strategy: | |
fail-fast: false | |
matrix: | |
rosdistro: | |
- humble | |
container-suffix: | |
- "" | |
- -cuda | |
include: | |
- rosdistro: humble | |
container: ghcr.io/autowarefoundation/autoware:latest-autoware-universe | |
build-depends-repos: build_depends.repos | |
- container-suffix: -cuda | |
runner: codebuild-autoware-us-east-1-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-large | |
build-pre-command: taskset --cpu-list 0-6 | |
- container-suffix: "" | |
runner: ubuntu-latest | |
build-pre-command: "" | |
steps: | |
- name: Set PR fetch depth | |
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}" | |
shell: bash | |
- name: Checkout PR branch and all PR commits | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: ${{ env.PR_FETCH_DEPTH }} | |
- name: Run build-and-test-differential action | |
if: ${{ !(matrix.container-suffix == '-cuda') || needs.make-sure-require-cuda-label-is-present.outputs.result == 'true' }} | |
uses: ./.github/actions/build-and-test-differential | |
with: | |
rosdistro: ${{ matrix.rosdistro }} | |
container: ${{ matrix.container }} | |
container-suffix: ${{ matrix.container-suffix }} | |
runner: ${{ matrix.runner }} | |
build-depends-repos: ${{ matrix.build-depends-repos }} | |
build-pre-command: ${{ matrix.build-pre-command }} | |
codecov-token: ${{ secrets.CODECOV_TOKEN }} | |
clang-tidy-differential: | |
needs: build-and-test-differential | |
runs-on: ubuntu-latest | |
container: ghcr.io/autowarefoundation/autoware:latest-autoware-universe-cuda | |
steps: | |
- name: Set PR fetch depth | |
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}" | |
- name: Checkout PR branch and all PR commits | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: ${{ env.PR_FETCH_DEPTH }} | |
- name: Show disk space before the tasks | |
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: Get required packages | |
id: get-required-packages | |
uses: mikefarah/yq@master | |
with: | |
cmd: yq '.[]' clang-tidy-required-packages.yaml | |
- name: Get target packages | |
id: get-target-packages | |
run: | | |
echo "${{ steps.get-required-packages.outputs.result }}" > required_packages.txt | |
echo "${{ steps.get-modified-packages.outputs.modified-packages }}" | tr ' ' '\n' > modified_packages.txt | |
PACKAGES=$(grep -Fxf required_packages.txt modified_packages.txt | xargs) | |
echo "target-packages=${PACKAGES}" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Run clang-tidy | |
if: ${{ steps.get-target-packages.outputs.target-packages != '' }} | |
uses: yhisaki/autoware-github-actions/clang-tidy@use-ament_clang_tidy | |
with: | |
rosdistro: humble | |
clang-tidy-config-url: https://raw.githubusercontent.com/autowarefoundation/autoware/main/.clang-tidy-ci | |
target-packages: ${{ steps.get-target-packages.outputs.target-packages }} | |
build-depends-repos: build_depends.repos | |
cache-key-element: cuda | |
- name: Show disk space after the tasks | |
run: df -h |