Skip to content

Commit 1b4f48e

Browse files
committed
chore: run ci in custom docker image
1 parent e4db7d4 commit 1b4f48e

File tree

5 files changed

+49
-87
lines changed

5 files changed

+49
-87
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,15 @@ on:
99
jobs:
1010
ut_coverage:
1111
runs-on: ubuntu-24.04
12+
container:
13+
image: zzjason/leanstore-dev:latest
1214
name: Unit Tests - Coverage
1315
steps:
14-
1516
- name: Check out repository
1617
uses: actions/checkout@v3
1718

18-
- name: Install dependencies
19-
run: |
20-
cat /etc/lsb-release;
21-
sudo apt update;
22-
sudo apt install -y build-essential git cmake make gcc-13 g++-13;
23-
sudo apt install -y libaio-dev python3-pip cppcheck ninja-build;
24-
sudo apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu;
25-
sudo apt install -y curl zip unzip tar pkg-config;
26-
sudo apt install -y autoconf libtool;
27-
sudo apt install -y clang-format-18;
28-
sudo ln -sf /usr/bin/cpp-13 /usr/bin/cpp;
29-
sudo ln -sf /usr/bin/g++-13 /usr/bin/g++;
30-
sudo ln -sf /usr/bin/gcc-13 /usr/bin/gcc;
31-
sudo ln -sf /usr/bin/gcc-ar-13 /usr/bin/gcc-ar;
32-
sudo ln -sf /usr/bin/gcc-nm-13 /usr/bin/gcc-nm;
33-
sudo ln -sf /usr/bin/gcc-ranlib-13 /usr/bin/gcc-ranlib;
34-
sudo ln -sf /usr/bin/gcov-13 /usr/bin/gcov;
35-
sudo ln -sf /usr/bin/gcov-dump-13 /usr/bin/gcov-dump;
36-
sudo ln -sf /usr/bin/gcov-tool-13 /usr/bin/gcov-tool;
37-
sudo ln -sf /usr/bin/lto-dump-13 /usr/bin/lto-dump;
38-
sudo ln -sf /usr/bin/g++-13 /usr/bin/c++;
39-
sudo ln -sf /usr/bin/gcc-13 /usr/bin/cc;
40-
sudo ln -sf /usr/bin/clang-format-18 /usr/bin/clang-format;
41-
pip3 install gcovr==6.0 --break-system-packages;
42-
sudo git clone https://github.com/Microsoft/vcpkg.git /opt/vcpkg;
43-
echo 'export VCPKG_ROOT=/opt/vcpkg' >> ~/.bashrc;
44-
echo 'export PATH=$VCPKG_ROOT:$PATH' >> ~/.bashrc;
45-
echo 'export VCPKG_FORCE_SYSTEM_BINARIES=1' >> ~/.bashrc;
46-
sudo rm -rf /var/lib/apt/lists/*;
47-
4819
- name: Config project
4920
run: |
50-
export VCPKG_ROOT=/opt/vcpkg;
51-
export PATH=$VCPKG_ROOT:$PATH;
52-
export VCPKG_FORCE_SYSTEM_BINARIES=1;
5321
which vcpkg;
5422
cmake --preset debug_tsan;
5523

docker/Dockerfile

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,48 @@
1-
FROM ubuntu:24.04
1+
FROM ubuntu:24.10
22

3-
################################################################################
4-
# install prerequisted libriaries
5-
################################################################################
6-
RUN apt-get update && apt-get install -y \
7-
&& rm -rf /var/lib/apt/lists/*
83

9-
RUN apt-get update && apt-get install -y \
4+
# install prerequisted libriaries
5+
RUN apt update \
6+
&& apt install -y \
107
build-essential g++-aarch64-linux-gnu gcc-aarch64-linux-gnu \
11-
&& rm -rf /var/lib/apt/lists/*
12-
13-
RUN apt-get update && apt-get install -y \
14-
git cmake make gcc g++ ninja-build \
15-
&& rm -rf /var/lib/apt/lists/*
16-
17-
RUN apt-get update && apt-get install -y \
8+
git cmake make gcc g++ clang-format ninja-build \
189
libaio-dev python3-pip cppcheck \
10+
curl zip unzip tar pkg-config \
11+
autoconf libtool golang graphviz sysstat \
1912
&& rm -rf /var/lib/apt/lists/*
2013

2114

22-
# install vcpkg and its prerequisites
23-
RUN apt-get update && apt-get install -y \
24-
curl zip unzip tar pkg-config \
25-
&& rm -rf /var/lib/apt/lists/*
15+
# env.sh
16+
RUN rm -rf /opt/env.sh \
17+
&& touch /opt/env.sh \
18+
&& echo 'source /opt/env.sh' >> ~/.bashrc
2619

27-
RUN git clone https://github.com/Microsoft/vcpkg.git /opt/vcpkg \
28-
&& echo 'export VCPKG_ROOT=/opt/vcpkg' >> ~/.bashrc \
29-
&& echo 'export PATH=$VCPKG_ROOT:$PATH' >> ~/.bashrc \
30-
&& echo 'export VCPKG_FORCE_SYSTEM_BINARIES=1' >> ~/.bashrc
20+
# install vcpkg
21+
RUN git clone --depth 1 https://github.com/Microsoft/vcpkg.git /opt/vcpkg \
22+
&& mv /opt/vcpkg/triplets/x64-linux.cmake /opt/vcpkg/triplets/x64-linux-static.cmake \
23+
&& echo 'export VCPKG_ROOT=/opt/vcpkg' >> /opt/env.sh \
24+
&& echo 'export PATH=$VCPKG_ROOT:$PATH' >> /opt/env.sh \
25+
&& echo 'export VCPKG_FORCE_SYSTEM_BINARIES=1' >> /opt/env.sh
3126

32-
RUN mv /opt/vcpkg/triplets/x64-linux.cmake /opt/vcpkg/triplets/x64-linux-static.cmake
3327
COPY vcpkg-triplets/x64-linux.cmake /opt/vcpkg/triplets/x64-linux.cmake
3428
COPY vcpkg-triplets/arm64-linux.cmake /opt/vcpkg/triplets/arm64-linux.cmake
3529

36-
RUN apt-get update && apt-get install -y \
37-
autoconf libtool golang graphviz sysstat \
38-
&& rm -rf /var/lib/apt/lists/*
30+
ENV VCPKG_ROOT="/opt/vcpkg"
31+
ENV PATH="$VCPKG_ROOT:$PATH"
32+
ENV VCPKG_FORCE_SYSTEM_BINARIES=1
33+
34+
35+
# install vcpkg packages
36+
RUN ./opt/vcpkg/bootstrap-vcpkg.sh \
37+
&& vcpkg install benchmark gflags spdlog gtest rapidjson gperftools \
38+
cpp-httplib crc32c libunwind cpptrace concurrentqueue boost-context
39+
40+
41+
# install gcov
42+
RUN pip3 install gcovr==6.0 --break-system-packages
3943

4044

41-
################################################################################
4245
# other settings
43-
################################################################################
4446
USER root
4547
WORKDIR /root
4648
CMD ["/usr/bin/bash"]

docker/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ This is the Dockerfile to construct the build image for LeanStore.
44

55
## How to use
66

7-
Build the docker image:
7+
Build and update image in dockerhub:
88

99
```sh
10-
docker build -t leanstore-dev .
10+
docker build --tag zzjason/leanstore-dev:latest .
11+
docker push zzjason/leanstore-dev:latest
1112
```
1213

13-
Run a container based on the image:
14+
Build leanstore inside a container:
1415

1516
```sh
16-
docker run -it --privileged --network=host -v /path/to/leanstore/on/host:/path/to/leanstore/on/container leanstore-dev bash
17-
```
18-
19-
Build and test LeanStore in the running container:
17+
# Run a container based on the image:
18+
export LEANSTORE_HOME=/path/to/leanstore/on/host
19+
docker run -it --privileged --network=host -v ${LEANSTORE_HOME}:/root/code/leanstore zzjason/leanstore-dev:latest bash
2020

21-
```sh
22-
cd /path/to/leanstore/on/container
21+
# Build and test LeanStore in the running container:
22+
cd /root/code/leanstore
2323
cmake --preset debug
2424
cmake --build build/debug -j `nproc`
2525
ctest --test-dir build/debug

src/telemetry/metrics_http_exposer.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
#include <httplib.h>
1212

13+
#include <fstream>
14+
1315
#include <fcntl.h>
1416
#include <unistd.h>
1517

@@ -113,4 +115,4 @@ class MetricsHttpExposer : public utils::ManagedThread {
113115
}
114116
};
115117

116-
} // namespace leanstore::telemetry
118+
} // namespace leanstore::telemetry

vcpkg.json

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,15 @@
22
"dependencies": [
33
"benchmark",
44
"gflags",
5-
{
6-
"name": "spdlog",
7-
"version>=": "1.13.0"
8-
},
5+
"spdlog",
96
"gtest",
107
"rapidjson",
118
"gperftools",
12-
{
13-
"name": "cpp-httplib",
14-
"version>=": "0.14.3"
15-
},
16-
{
17-
"name": "crc32c",
18-
"version>=": "1.1.2#2"
19-
},
9+
"cpp-httplib",
10+
"crc32c",
2011
"libunwind",
2112
"cpptrace",
2213
"concurrentqueue",
2314
"boost-context"
24-
],
25-
"builtin-baseline": "4a2c30139309a6e4690ce929df33e85a1706a0e2"
26-
}
15+
]
16+
}

0 commit comments

Comments
 (0)