-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Earthfile
56 lines (44 loc) · 1.17 KB
/
Earthfile
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
# earthly version
VERSION 0.6
# Earthfile
FROM ubuntu:22.04
# configure apt to be noninteractive
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true
# install dependencies
RUN apt-get update && apt-get install -y \
build-essential cmake \
git \
python3 python-is-python3
# iutest test env
ENV IUTEST_OUTPUT_DIR=TestResults
WORKDIR /code
all:
BUILD +lint
BUILD +build
BUILD +test
full:
BUILD +all
BUILD +cppcheck
code:
COPY . src
build:
FROM +code
RUN mkdir -p ${IUTEST_OUTPUT_DIR}
RUN cmake src/projects/cmake -DTEST_OUTPUT_DIR=${IUTEST_OUTPUT_DIR}
# cache cmake temp files to prevent rebuilding .o files
# when the .cpp files don't change
RUN --mount=type=cache,target=/code/CMakeFiles make
test:
FROM +build
RUN --mount=type=cache,target=/code/CMakeFiles ctest .
SAVE ARTIFACT ${IUTEST_OUTPUT_DIR} AS LOCAL earthly-out/
lint:
FROM +code
RUN make -C src/test/cpplint
cppcheck:
FROM +code
RUN apt-get update && apt-get install -y cppcheck
RUN make -C src/test/cppcheck
RUN make -C src/test/cppcheck html HTML_REPORT_DIR=./cppcheck-result
SAVE ARTIFACT src/test/cppcheck/cppcheck-result AS LOCAL earthly-out/