-
Notifications
You must be signed in to change notification settings - Fork 8
54 lines (51 loc) · 1.89 KB
/
build_test.yml
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
name: Build/Test
on:
push:
branches:
- main
tags:
- "**"
pull_request:
branches:
- main
workflow_dispatch:
# only run one build doc workflow at a time, cancel any running ones
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_test:
strategy:
matrix:
os:
- ubuntu
version:
- 20.04
- 22.04
runs-on: ${{ matrix.os }}-${{ matrix.version }}
steps:
- uses: actions/checkout@v3
- name: Specify the Bazel cache
uses: actions/cache@v3
with:
path: "/home/runner/.cache/bazel"
key: ${{ hashFiles('.bazelrc', '.bazelversion', 'WORKSPACE', 'WORKSPACE.bazel', 'MODULE.bazel') }}
- name: Install buildifier
run: |
curl -f -s -L -o /usr/local/bin/buildifier https://github.com/bazelbuild/buildtools/releases/download/v7.3.1/buildifier-linux-$(arch | sed 's/aarch64/arm64/;s/x86_64/amd64/')
chmod a+x /usr/local/bin/buildifier
- name: Run buildifier
run: buildifier -mode check -r .
- name: Build
# TODO(evan.flynn): uncomment once the rules are properly fixed
# run: bazel build //...
run: bazel build -- $(cat repos/config/bazel.repos | sed -e '/^[#r]/d' -e '/^ /d' -e 's%/%.%' -e 's% \(.*\):%@\1//...%' -e '/@ros2.rosidl/d' -e '/@ros2.rcl_interfaces/d' -e '/@ros2.common_interfaces/d')
- name: Test
run: bazel test -- $(cat repos/config/bazel.repos | sed -e '/^[#r]/d' -e '/^ /d' -e 's%/%.%' -e 's% \(.*\):%@\1//...%' -e '/@ros2.rosidl/d' -e '/@ros2.rcl_interfaces/d' -e '/@ros2.common_interfaces/d')
- name: Store the bazel-testlogs
uses: actions/upload-artifact@v3
if: always()
with:
name: ${{ matrix.os }}-${{ matrix.version }}-bazel-testlogs
path: bazel-testlogs
retention-days: 5