-
Notifications
You must be signed in to change notification settings - Fork 658
191 lines (163 loc) · 7.46 KB
/
build-and-test-differential.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
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
prepare-build-and-test-differential:
runs-on: ubuntu-latest
needs: [make-sure-label-is-present, make-sure-require-cuda-label-is-present]
outputs:
cuda_build: ${{ steps.check-if-cuda-build-is-required.outputs.cuda_build }}
steps:
- name: Check if cuda-build is required
id: check-if-cuda-build-is-required
run: |
if ${{ needs.make-sure-require-cuda-label-is-present.outputs.result == 'true' }}; then
echo "cuda-build is required"
echo "cuda_build=true" >> $GITHUB_OUTPUT
else
echo "cuda-build is not required"
echo "cuda_build=false" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Fail if the tag:run-build-and-test-differential is missing
if: ${{ needs.make-sure-label-is-present.outputs.result != 'true' }}
run: exit 1
build-and-test-differential:
runs-on: ubuntu-latest
container: ghcr.io/autowarefoundation/autoware:universe-devel
needs: prepare-build-and-test-differential
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
uses: ./.github/actions/build-and-test-differential
with:
rosdistro: humble
container: ghcr.io/autowarefoundation/autoware:universe-devel
container-suffix: ""
runner: ubuntu-latest
build-depends-repos: build_depends.repos
build-pre-command: ""
codecov-token: ${{ secrets.CODECOV_TOKEN }}
build-and-test-differential-cuda:
runs-on: codebuild-autoware-us-east-1-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-large
container: ghcr.io/autowarefoundation/autoware:universe-devel-cuda
needs: prepare-build-and-test-differential
if: ${{ needs.prepare-build-and-test-differential.outputs.cuda_build == 'true' }}
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
uses: ./.github/actions/build-and-test-differential
with:
rosdistro: humble
container: ghcr.io/autowarefoundation/autoware:universe-devel
container-suffix: -cuda
runner: codebuild-autoware-us-east-1-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-large
build-depends-repos: build_depends.repos
build-pre-command: taskset --cpu-list 0-5
codecov-token: ${{ secrets.CODECOV_TOKEN }}
clang-tidy-differential:
needs: [build-and-test-differential, prepare-build-and-test-differential]
if: ${{ needs.prepare-build-and-test-differential.outputs.cuda_build == 'false' }}
runs-on: ubuntu-latest
container: ghcr.io/autowarefoundation/autoware:universe-devel
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 changed files (existing files only)
id: get-changed-files
run: |
echo "changed-files=$(git diff --name-only "origin/${{ github.base_ref }}"...HEAD | grep -E '\.(cpp|hpp)$' | while read -r file; do [ -e "$file" ] && echo -n "$file "; done)" >> $GITHUB_OUTPUT
shell: bash
- name: Run clang-tidy
if: ${{ steps.get-changed-files.outputs.changed-files != '' }}
uses: autowarefoundation/autoware-github-actions/clang-tidy@v1
with:
rosdistro: humble
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
clang-tidy-config-url: https://raw.githubusercontent.com/autowarefoundation/autoware/main/.clang-tidy-ci
clang-tidy-ignore-path: .clang-tidy-ignore
build-depends-repos: build_depends.repos
cache-key-element: cuda
- name: Show disk space after the tasks
run: df -h
clang-tidy-differential-cuda:
needs: build-and-test-differential-cuda
runs-on: codebuild-autoware-us-east-1-${{ github.run_id }}-${{ github.run_attempt }}-ubuntu-7.0-large
container: ghcr.io/autowarefoundation/autoware:universe-devel-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 changed files (existing files only)
id: get-changed-files
run: |
echo "changed-files=$(git diff --name-only "origin/${{ github.base_ref }}"...HEAD | grep -E '\.(cpp|hpp)$' | while read -r file; do [ -e "$file" ] && echo -n "$file "; done)" >> $GITHUB_OUTPUT
shell: bash
- name: Run clang-tidy
if: ${{ steps.get-changed-files.outputs.changed-files != '' }}
uses: autowarefoundation/autoware-github-actions/clang-tidy@v1
with:
rosdistro: humble
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
clang-tidy-config-url: https://raw.githubusercontent.com/autowarefoundation/autoware/main/.clang-tidy-ci
clang-tidy-ignore-path: .clang-tidy-ignore
build-depends-repos: build_depends.repos
cache-key-element: cuda
- name: Show disk space after the tasks
run: df -h