Skip to content

Commit 0cc6ab0

Browse files
committed
Extend CI to rebuild docker automatically
1 parent 47a978c commit 0cc6ab0

File tree

7 files changed

+93
-39
lines changed

7 files changed

+93
-39
lines changed

.github/workflows/build-cachelib-centos.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: build-cachelib-docker
2+
on:
3+
push:
4+
pull_request:
5+
6+
jobs:
7+
build-cachelib-docker:
8+
name: "CentOS/latest - Build CacheLib with all dependencies"
9+
runs-on: ubuntu-latest
10+
env:
11+
REPO: cachelib
12+
GITHUB_REPO: pmem/CacheLib
13+
CONTAINER_REG: ghcr.io/pmem/cachelib
14+
CONTAINER_REG_USER: ${{ secrets.GH_CR_USER }}
15+
CONTAINER_REG_PASS: ${{ secrets.GH_CR_PAT }}
16+
FORCE_IMAGE_ACTION: ${{ secrets.FORCE_IMAGE_ACTION }}
17+
HOST_WORKDIR: ${{ github.workspace }}
18+
WORKDIR: docker
19+
IMG_VER: develop
20+
strategy:
21+
matrix:
22+
CONFIG: ["OS=centos OS_VER=8streams PUSH_IMAGE=1"]
23+
steps:
24+
- name: "System Information"
25+
run: |
26+
echo === uname ===
27+
uname -a
28+
echo === /etc/os-release ===
29+
cat /etc/os-release
30+
echo === df -hl ===
31+
df -hl
32+
echo === free -h ===
33+
free -h
34+
echo === top ===
35+
top -b -n1 -1 -Eg || timeout 1 top -b -n1
36+
echo === env ===
37+
env
38+
echo === gcc -v ===
39+
gcc -v
40+
- name: "checkout sources"
41+
uses: actions/checkout@v2
42+
43+
- name: Pull the image or rebuild and push it
44+
run: cd $WORKDIR && ${{ matrix.CONFIG }} ./pull-or-rebuild-image.sh $FORCE_IMAGE_ACTION
45+
46+
- name: Run the build
47+
run: cd $WORKDIR && ${{ matrix.CONFIG }} ./build.sh

docker/build.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ TAG="${OS}-${OS_VER}-${IMG_VER}"
2727
IMAGE_NAME=${CONTAINER_REG}:${TAG}
2828
CONTAINER_NAME=CacheLib-${OS}-${OS_VER}
2929
WORKDIR=/CacheLib # working dir within Docker container
30-
SCRIPTSDIR=${WORKDIR}/utils/docker
30+
SCRIPTSDIR=${WORKDIR}/docker
3131

3232
if [[ -z "${OS}" || -z "${OS_VER}" ]]; then
3333
echo "ERROR: The variables OS and OS_VER have to be set " \
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM quay.io/centos/centos:stream8
2+
3+
RUN dnf install -y \
4+
cmake \
5+
sudo \
6+
git \
7+
tzdata \
8+
vim \
9+
gdb \
10+
clang
11+
12+
COPY ./install-cachelib-deps.sh ./install-cachelib-deps.sh
13+
RUN ./install-cachelib-deps.sh
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
# SPDX-License-Identifier: BSD-3-Clause
3+
# Copyright 2022, Intel Corporation
4+
5+
git clone https://github.com/pmem/CacheLib CacheLib
6+
7+
./CacheLib/contrib/prerequisites-centos8.sh
8+
9+
for pkg in zstd googleflags googlelog googletest sparsemap fmt folly fizz wangle fbthrift ;
10+
do
11+
sudo ./CacheLib/contrib/build-package.sh -j -I /opt/ "$pkg"
12+
done
13+
14+
rm -rf CacheLib

docker/pull-or-rebuild-image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function push_image {
6161
# - not a pull_request event,
6262
# - and PUSH_IMAGE flag was set for current build.
6363
if [[ "${CI_REPO_SLUG}" == "${GITHUB_REPO}" \
64-
&& (${CI_BRANCH} == stable-* || ${CI_BRANCH} == master) \
64+
&& (${CI_BRANCH} == develop || ${CI_BRANCH} == main) \
6565
&& ${CI_EVENT_TYPE} != "pull_request" \
6666
&& ${PUSH_IMAGE} == "1" ]]
6767
then

docker/run-build.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
# SPDX-License-Identifier: BSD-3-Clause
3+
# Copyright 2022, Intel Corporation
4+
5+
set -e
6+
7+
function sudo_password() {
8+
echo ${USERPASS} | sudo -Sk $*
9+
}
10+
11+
cd ..
12+
mkdir build
13+
cd build
14+
cmake ../cachelib -DBUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=/opt -DCMAKE_BUILD_TYPE=Debug
15+
sudo_password make install -j$(nproc)
16+
17+
cd /opt/tests && $WORKDIR/run_tests.sh

0 commit comments

Comments
 (0)