Skip to content

Commit

Permalink
ci(build-and-test-x): fix cache and merge clang-tidy (#7723)
Browse files Browse the repository at this point in the history
Signed-off-by: M. Fatih Cırıt <[email protected]>
  • Loading branch information
xmfcx authored Jun 27, 2024
1 parent 49ec490 commit 8df1d33
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 55 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/build-and-test-daily-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,24 @@ jobs:
id: get-self-packages
uses: autowarefoundation/autoware-github-actions/get-self-packages@v1

- name: Export CUDA state as a variable for adding to cache key
run: |
build_type_cuda_state=nocuda
if [[ "${{ matrix.container-suffix }}" == "-cuda" ]]; then
build_type_cuda_state=cuda
fi
echo "BUILD_TYPE_CUDA_STATE=$build_type_cuda_state" >> "${GITHUB_ENV}"
echo "::notice::BUILD_TYPE_CUDA_STATE=$build_type_cuda_state"
shell: bash

- 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 }}
cache-key-element: ${{ env.BUILD_TYPE_CUDA_STATE }}

- name: Test
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/build-and-test-daily.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,24 @@ jobs:
id: get-self-packages
uses: autowarefoundation/autoware-github-actions/get-self-packages@v1

- name: Export CUDA state as a variable for adding to cache key
run: |
build_type_cuda_state=nocuda
if [[ "${{ matrix.container-suffix }}" == "-cuda" ]]; then
build_type_cuda_state=cuda
fi
echo "BUILD_TYPE_CUDA_STATE=$build_type_cuda_state" >> "${GITHUB_ENV}"
echo "::notice::BUILD_TYPE_CUDA_STATE=$build_type_cuda_state"
shell: bash

- 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 }}
cache-key-element: ${{ env.BUILD_TYPE_CUDA_STATE }}

- name: Test
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/build-and-test-differential-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,24 @@ jobs:
id: get-modified-packages
uses: autowarefoundation/autoware-github-actions/get-modified-packages@v1

- name: Export CUDA state as a variable for adding to cache key
run: |
build_type_cuda_state=nocuda
if [[ "${{ matrix.container-suffix }}" == "-cuda" ]]; then
build_type_cuda_state=cuda
fi
echo "BUILD_TYPE_CUDA_STATE=$build_type_cuda_state" >> "${GITHUB_ENV}"
echo "::notice::BUILD_TYPE_CUDA_STATE=$build_type_cuda_state"
shell: bash

- 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 }}
cache-key-element: ${{ env.BUILD_TYPE_CUDA_STATE }}

- name: Test
id: test
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/build-and-test-differential.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,24 @@ jobs:
run: du -sh ${CCACHE_DIR} && ccache -s
shell: bash

- name: Export CUDA state as a variable for adding to cache key
run: |
build_type_cuda_state=nocuda
if [[ "${{ matrix.container-suffix }}" == "-cuda" ]]; then
build_type_cuda_state=cuda
fi
echo "BUILD_TYPE_CUDA_STATE=$build_type_cuda_state" >> "${GITHUB_ENV}"
echo "::notice::BUILD_TYPE_CUDA_STATE=$build_type_cuda_state"
shell: bash

- 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 }}
cache-key-element: ${{ env.BUILD_TYPE_CUDA_STATE }}

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

- name: Show disk space after the tasks
run: df -h

clang-tidy-differential:
needs: build-and-test-differential
runs-on: ubuntu-latest
container: ghcr.io/autowarefoundation/autoware:latest-prebuilt-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 modified files
id: get-modified-files
run: |
echo "changed_files=$(git diff --name-only "origin/${{ github.base_ref }}"...HEAD | grep -E '\.(cpp|hpp)$' | tr '\n' ' ' || true)" >> $GITHUB_OUTPUT
shell: bash

- name: Run clang-tidy
if: ${{ steps.get-modified-files.outputs.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.changed_files }}
clang-tidy-config-url: https://raw.githubusercontent.com/autowarefoundation/autoware/main/.clang-tidy
build-depends-repos: build_depends.repos
cache-key-element: cuda

- name: Show disk space after the tasks
run: df -h
11 changes: 11 additions & 0 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,24 @@ jobs:
run: du -sh ${CCACHE_DIR} && ccache -s
shell: bash

- name: Export CUDA state as a variable for adding to cache key
run: |
build_type_cuda_state=nocuda
if [[ "${{ matrix.container-suffix }}" == "-cuda" ]]; then
build_type_cuda_state=cuda
fi
echo "BUILD_TYPE_CUDA_STATE=$build_type_cuda_state" >> "${GITHUB_ENV}"
echo "::notice::BUILD_TYPE_CUDA_STATE=$build_type_cuda_state"
shell: bash

- 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 }}
cache-key-element: ${{ env.BUILD_TYPE_CUDA_STATE }}

- name: Show ccache stats after build
run: du -sh ${CCACHE_DIR} && ccache -s
Expand Down
55 changes: 0 additions & 55 deletions .github/workflows/clang-tidy-differential.yaml

This file was deleted.

0 comments on commit 8df1d33

Please sign in to comment.