Skip to content

Commit f49b1f6

Browse files
authored
use docker base image in CI (#327)
1 parent c6ab72d commit f49b1f6

File tree

8 files changed

+45
-31
lines changed

8 files changed

+45
-31
lines changed

.github/workflows/docker.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ jobs:
3030
steps:
3131
- uses: actions/checkout@v4
3232

33+
- uses: docker/login-action@v3
34+
with:
35+
registry: ghcr.io
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
3339
# build base (if inputs.build-base)
3440
- uses: docker/metadata-action@v5
3541
id: base-meta

.github/workflows/linter.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
name: cpp-linter
22

3-
on: pull_request
3+
on:
4+
pull_request:
5+
workflow_dispatch:
46

57
jobs:
68
cpp-linter:
79
if: github.repository_owner == 'viamrobotics'
810
runs-on: ubuntu-latest
9-
container:
10-
image: ghcr.io/viamrobotics/canon:amd64
11+
container: ghcr.io/viamrobotics/cpp-base:bullseye-amd64
1112
steps:
1213
- name: Checkout Code
1314
uses: actions/checkout@v4
1415
with:
1516
fetch-depth: 0
16-
- name: install clang-format
17-
run: sudo apt install -y clang-format
1817
- name: verify no uncommitted changes
1918
run: |
19+
chown $(whoami) .
2020
git init
2121
git add .
22-
chown -R testbot .
23-
sudo -u testbot bash -lc 'sh ./bin/run-clang-format.sh'
22+
./bin/run-clang-format.sh
2423
GEN_DIFF=$(git status -s)
2524
2625
if [ -n "$GEN_DIFF" ]; then

.github/workflows/test.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,38 @@ name: Test
33
on:
44
pull_request:
55
workflow_dispatch:
6+
inputs:
7+
no-tidy:
8+
type: boolean
9+
description: set to true to build without clang-tidy (2x faster)
610

711
jobs:
812
run-tests:
913
if: github.repository_owner == 'viamrobotics'
1014
runs-on: ubuntu-latest
11-
container:
12-
image: ghcr.io/viamrobotics/canon:amd64
15+
container: ghcr.io/viamrobotics/cpp-base:bullseye-amd64
1316
strategy:
1417
matrix:
1518
include:
1619
- BUILD_SHARED: ON
1720
- BUILD_SHARED: OFF
1821
steps:
1922
- uses: actions/checkout@v4
20-
###########################################
21-
# necessary installs for building #
22-
###########################################
23-
- name: build-docker-test
23+
- name: cmake
2424
run: |
25-
docker build -t cpp . -f etc/docker/base-images/Dockerfile.debian.bullseye
26-
docker build -t cpp-test . -f etc/docker/Dockerfile.sdk-build \
27-
--build-arg BASE_TAG=cpp \
28-
--build-arg REPO_SETUP=copy \
29-
--build-arg BUILD_SHARED=${{ matrix.BUILD_SHARED }} \
30-
--build-arg BUILD_TESTS=ON \
31-
--build-arg BUILD_EXAMPLES=ON \
32-
--build-arg "EXTRA_CMAKE_ARGS=\
33-
-DVIAMCPPSDK_CLANG_TIDY=ON \
34-
-DVIAMCPPSDK_SANITIZED_BUILD=${{ matrix.BUILD_SHARED }}"
35-
36-
docker run -w /viam-cpp-sdk/build -t --entrypoint /viam-cpp-sdk/etc/docker/tests/run_test.sh cpp-test /bin/bash
25+
mkdir build
26+
cd build
27+
cmake .. -G Ninja \
28+
-DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED }} \
29+
-DVIAMCPPSDK_OFFLINE_PROTO_GENERATION=ON \
30+
-DVIAMCPPSDK_BUILD_TESTS=ON \
31+
-DVIAMCPPSDK_BUILD_EXAMPLES=ON \
32+
-DVIAMCPPSDK_CLANG_TIDY=${{ inputs.no-tidy && 'OFF' || 'ON' }} \
33+
-DVIAMCPPSDK_SANITIZED_BUILD=${{ matrix.BUILD_SHARED }}
34+
- name: build
35+
run: |
36+
cmake --build build --target install
37+
cmake --install build
38+
- name: test
39+
working-directory: build
40+
run: ../etc/docker/tests/run_test.sh

etc/docker/base-images/Dockerfile.debian.bookworm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ RUN apt-get update
4141

4242
RUN apt-get -y --no-install-recommends install -t llvm-toolchain-bookworm-15 \
4343
clang-15 \
44-
clang-tidy-15
44+
clang-tidy-15 \
45+
clang-format

etc/docker/base-images/Dockerfile.debian.bullseye

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM debian:bullseye
22

3-
ENV HOME /root
3+
ENV HOME=/root
44
ARG DEBIAN_FRONTEND=noninteractive
55

66
RUN apt-get update
@@ -39,7 +39,8 @@ RUN apt-get update
3939

4040
RUN apt-get -y --no-install-recommends install -t llvm-toolchain-bullseye-15 \
4141
clang-15 \
42-
clang-tidy-15
42+
clang-tidy-15 \
43+
clang-format
4344

4445
RUN apt-get -y --no-install-recommends install -t bullseye-backports \
4546
cmake

etc/docker/base-images/Dockerfile.debian.sid

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ RUN apt-get update
4141

4242
RUN apt-get -y --no-install-recommends install -t llvm-toolchain-15 \
4343
clang-15 \
44-
clang-tidy-15
44+
clang-tidy-15 \
45+
clang-format

etc/docker/base-images/Dockerfile.ubuntu.focal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ RUN apt-get update
4242

4343
RUN apt-get -y --no-install-recommends install -t llvm-toolchain-focal-15 \
4444
clang-15 \
45-
clang-tidy-15
45+
clang-tidy-15 \
46+
clang-format
4647

4748
RUN apt-get -y install cmake
4849

etc/docker/base-images/Dockerfile.ubuntu.jammy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ RUN apt-get update
4242

4343
RUN apt-get -y --no-install-recommends install -t llvm-toolchain-jammy-15 \
4444
clang-15 \
45-
clang-tidy-15
45+
clang-tidy-15 \
46+
clang-format
4647

4748
RUN apt-get -y install cmake

0 commit comments

Comments
 (0)