Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
ci: overhaul build-and-test derivatives and split clang-tidy (#250)
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 14, 2024
1 parent c3fa064 commit bf8e542
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 59 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: build-and-test-self-hosted
name: build-and-test-arm64

on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:

jobs:
build-and-test-self-hosted:
build-and-test-arm64:
runs-on: [self-hosted, linux, ARM64]
container: ${{ matrix.container }}
strategy:
Expand All @@ -20,7 +20,12 @@ jobs:
build-depends-repos: build_depends.repos
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1

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

- name: Remove exec_depend
uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1
Expand All @@ -39,8 +44,21 @@ jobs:

- 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@v4
with:
files: ${{ steps.test.outputs.coverage-report-files }}
fail_ci_if_error: false
verbose: true
flags: total-arm64

- name: Show disk space after the tasks
run: df -h
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name: build-and-test-differential-self-hosted
name: build-and-test-differential-arm64

on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
workflow_dispatch:

jobs:
prevent-no-label-execution:
uses: autowarefoundation/autoware-github-actions/.github/workflows/prevent-no-label-execution.yaml@v1
make-sure-label-is-present:
uses: autowarefoundation/autoware-github-actions/.github/workflows/make-sure-label-is-present.yaml@v1
with:
label: ARM64
label: type:arm64

build-and-test-differential-self-hosted:
needs: prevent-no-label-execution
if: ${{ needs.prevent-no-label-execution.outputs.run == 'true' }}
build-and-test-differential-arm64:
needs: make-sure-label-is-present
if: ${{ needs.make-sure-label-is-present.outputs.result == 'true' }}
runs-on: [self-hosted, linux, ARM64]
container: ${{ matrix.container }}
strategy:
Expand All @@ -29,10 +29,17 @@ jobs:
container: ros:humble
build-depends-repos: build_depends.repos
steps:
- name: Check out repository
uses: actions/checkout@v3
- 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:
fetch-depth: 0
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
Expand All @@ -50,9 +57,22 @@ jobs:
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@v4
with:
files: ${{ steps.test.outputs.coverage-report-files }}
fail_ci_if_error: false
verbose: true
flags: differential-arm64

- name: Show disk space after the tasks
run: df -h
61 changes: 24 additions & 37 deletions .github/workflows/build-and-test-differential.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@ name: build-and-test-differential

on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled

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

build-and-test-differential:
needs: make-sure-label-is-present
if: ${{ needs.make-sure-label-is-present.outputs.result == 'true' }}
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
Expand All @@ -17,10 +29,17 @@ jobs:
container: ros:humble
build-depends-repos: build_depends.repos
steps:
- name: Check out repository
uses: actions/checkout@v3
- 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:
fetch-depth: 0
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
Expand Down Expand Up @@ -55,37 +74,5 @@ jobs:
verbose: true
flags: differential

clang-tidy-differential:
runs-on: ubuntu-latest
container: ros:humble
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@v42
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
- name: Show disk space after the tasks
run: df -h
13 changes: 5 additions & 8 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@ jobs:
build-depends-repos: build_depends.repos
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Free disk space (Ubuntu)
uses: jlumbroso/[email protected]
uses: actions/checkout@v4
with:
tool-cache: false
dotnet: false
swap-storage: false
large-packages: false
fetch-depth: 1

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

- name: Remove exec_depend
uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/clang-tidy-differential.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: clang-tidy-differential

on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled

jobs:
make-sure-label-is-present:
uses: autowarefoundation/autoware-github-actions/.github/workflows/make-sure-label-is-present.yaml@v1
with:
label: tag:run-clang-tidy-differential

clang-tidy-differential:
needs: make-sure-label-is-present
if: ${{ needs.make-sure-label-is-present.outputs.result == 'true' }}
runs-on: ubuntu-latest
container: ros:humble
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
uses: tj-actions/changed-files@v42
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

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

0 comments on commit bf8e542

Please sign in to comment.