Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2469d1e

Browse files
xmfcxtby-udel
authored andcommittedJul 14, 2024
ci(build-and-test-x): fix cache and merge clang-tidy (autowarefoundation#7723)
Signed-off-by: M. Fatih Cırıt <mfc@leodrive.ai>
1 parent 0d758c7 commit 2469d1e

6 files changed

+99
-55
lines changed
 

‎.github/workflows/build-and-test-daily-arm64.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,24 @@ jobs:
3737
id: get-self-packages
3838
uses: autowarefoundation/autoware-github-actions/get-self-packages@v1
3939

40+
- name: Export CUDA state as a variable for adding to cache key
41+
run: |
42+
build_type_cuda_state=nocuda
43+
if [[ "${{ matrix.container-suffix }}" == "-cuda" ]]; then
44+
build_type_cuda_state=cuda
45+
fi
46+
echo "BUILD_TYPE_CUDA_STATE=$build_type_cuda_state" >> "${GITHUB_ENV}"
47+
echo "::notice::BUILD_TYPE_CUDA_STATE=$build_type_cuda_state"
48+
shell: bash
49+
4050
- name: Build
4151
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}
4252
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
4353
with:
4454
rosdistro: ${{ matrix.rosdistro }}
4555
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
4656
build-depends-repos: ${{ matrix.build-depends-repos }}
57+
cache-key-element: ${{ env.BUILD_TYPE_CUDA_STATE }}
4758

4859
- name: Test
4960
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}

‎.github/workflows/build-and-test-daily.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,24 @@ jobs:
3737
id: get-self-packages
3838
uses: autowarefoundation/autoware-github-actions/get-self-packages@v1
3939

40+
- name: Export CUDA state as a variable for adding to cache key
41+
run: |
42+
build_type_cuda_state=nocuda
43+
if [[ "${{ matrix.container-suffix }}" == "-cuda" ]]; then
44+
build_type_cuda_state=cuda
45+
fi
46+
echo "BUILD_TYPE_CUDA_STATE=$build_type_cuda_state" >> "${GITHUB_ENV}"
47+
echo "::notice::BUILD_TYPE_CUDA_STATE=$build_type_cuda_state"
48+
shell: bash
49+
4050
- name: Build
4151
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}
4252
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
4353
with:
4454
rosdistro: ${{ matrix.rosdistro }}
4555
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
4656
build-depends-repos: ${{ matrix.build-depends-repos }}
57+
cache-key-element: ${{ env.BUILD_TYPE_CUDA_STATE }}
4758

4859
- name: Test
4960
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}

‎.github/workflows/build-and-test-differential-arm64.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,24 @@ jobs:
5151
id: get-modified-packages
5252
uses: autowarefoundation/autoware-github-actions/get-modified-packages@v1
5353

54+
- name: Export CUDA state as a variable for adding to cache key
55+
run: |
56+
build_type_cuda_state=nocuda
57+
if [[ "${{ matrix.container-suffix }}" == "-cuda" ]]; then
58+
build_type_cuda_state=cuda
59+
fi
60+
echo "BUILD_TYPE_CUDA_STATE=$build_type_cuda_state" >> "${GITHUB_ENV}"
61+
echo "::notice::BUILD_TYPE_CUDA_STATE=$build_type_cuda_state"
62+
shell: bash
63+
5464
- name: Build
5565
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }}
5666
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
5767
with:
5868
rosdistro: ${{ matrix.rosdistro }}
5969
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
6070
build-depends-repos: ${{ matrix.build-depends-repos }}
71+
cache-key-element: ${{ env.BUILD_TYPE_CUDA_STATE }}
6172

6273
- name: Test
6374
id: test

‎.github/workflows/build-and-test-differential.yaml

+55
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,24 @@ jobs:
7474
run: du -sh ${CCACHE_DIR} && ccache -s
7575
shell: bash
7676

77+
- name: Export CUDA state as a variable for adding to cache key
78+
run: |
79+
build_type_cuda_state=nocuda
80+
if [[ "${{ matrix.container-suffix }}" == "-cuda" ]]; then
81+
build_type_cuda_state=cuda
82+
fi
83+
echo "BUILD_TYPE_CUDA_STATE=$build_type_cuda_state" >> "${GITHUB_ENV}"
84+
echo "::notice::BUILD_TYPE_CUDA_STATE=$build_type_cuda_state"
85+
shell: bash
86+
7787
- name: Build
7888
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }}
7989
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
8090
with:
8191
rosdistro: ${{ matrix.rosdistro }}
8292
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
8393
build-depends-repos: ${{ matrix.build-depends-repos }}
94+
cache-key-element: ${{ env.BUILD_TYPE_CUDA_STATE }}
8495

8596
- name: Show ccache stats after build
8697
run: du -sh ${CCACHE_DIR} && ccache -s
@@ -106,3 +117,47 @@ jobs:
106117

107118
- name: Show disk space after the tasks
108119
run: df -h
120+
121+
clang-tidy-differential:
122+
needs: build-and-test-differential
123+
runs-on: ubuntu-latest
124+
container: ghcr.io/autowarefoundation/autoware:latest-prebuilt-cuda
125+
steps:
126+
- name: Set PR fetch depth
127+
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}"
128+
129+
- name: Checkout PR branch and all PR commits
130+
uses: actions/checkout@v4
131+
with:
132+
ref: ${{ github.event.pull_request.head.sha }}
133+
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
134+
135+
- name: Show disk space before the tasks
136+
run: df -h
137+
138+
- name: Remove exec_depend
139+
uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1
140+
141+
- name: Get modified packages
142+
id: get-modified-packages
143+
uses: autowarefoundation/autoware-github-actions/get-modified-packages@v1
144+
145+
- name: Get modified files
146+
id: get-modified-files
147+
run: |
148+
echo "changed_files=$(git diff --name-only "origin/${{ github.base_ref }}"...HEAD | grep -E '\.(cpp|hpp)$' | tr '\n' ' ' || true)" >> $GITHUB_OUTPUT
149+
shell: bash
150+
151+
- name: Run clang-tidy
152+
if: ${{ steps.get-modified-files.outputs.changed_files != '' }}
153+
uses: autowarefoundation/autoware-github-actions/clang-tidy@v1
154+
with:
155+
rosdistro: humble
156+
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
157+
target-files: ${{ steps.get-modified-files.outputs.changed_files }}
158+
clang-tidy-config-url: https://raw.githubusercontent.com/autowarefoundation/autoware/main/.clang-tidy
159+
build-depends-repos: build_depends.repos
160+
cache-key-element: cuda
161+
162+
- name: Show disk space after the tasks
163+
run: df -h

‎.github/workflows/build-and-test.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,24 @@ jobs:
6666
run: du -sh ${CCACHE_DIR} && ccache -s
6767
shell: bash
6868

69+
- name: Export CUDA state as a variable for adding to cache key
70+
run: |
71+
build_type_cuda_state=nocuda
72+
if [[ "${{ matrix.container-suffix }}" == "-cuda" ]]; then
73+
build_type_cuda_state=cuda
74+
fi
75+
echo "BUILD_TYPE_CUDA_STATE=$build_type_cuda_state" >> "${GITHUB_ENV}"
76+
echo "::notice::BUILD_TYPE_CUDA_STATE=$build_type_cuda_state"
77+
shell: bash
78+
6979
- name: Build
7080
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}
7181
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
7282
with:
7383
rosdistro: ${{ matrix.rosdistro }}
7484
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
7585
build-depends-repos: ${{ matrix.build-depends-repos }}
86+
cache-key-element: ${{ env.BUILD_TYPE_CUDA_STATE }}
7687

7788
- name: Show ccache stats after build
7889
run: du -sh ${CCACHE_DIR} && ccache -s

‎.github/workflows/clang-tidy-differential.yaml

-55
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.