From 94a06ed38a266d7c511ab942de6657d76399fa71 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sat, 16 Jan 2021 12:29:17 -0500 Subject: [PATCH] cmake: Add a custom target for reproducing issue reports Use by issuing command "make RELEASE=v2.5.2 reproduce" where v2.5.2 can be substituted by other (tagged) release. --- CMakeLists.txt | 6 ++++++ scripts/reproduce-dockerfile | 31 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 scripts/reproduce-dockerfile diff --git a/CMakeLists.txt b/CMakeLists.txt index f643d9c45..6fc04840a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -160,6 +160,12 @@ add_custom_command(OUTPUT run-review ) add_custom_target(review DEPENDS run-review) +add_custom_command(OUTPUT run-reproduce + COMMAND docker build -f scripts/reproduce-dockerfile --build-arg RELEASE=$(RELEASE) -t taskwarrior-reproduce:$(RELEASE) . + COMMAND docker run --rm --hostname tw-$(RELEASE) -it taskwarrior-reproduce:$(RELEASE) bash || : +) +add_custom_target(reproduce DEPENDS run-reproduce) + # --- set (CPACK_SOURCE_GENERATOR "TGZ") diff --git a/scripts/reproduce-dockerfile b/scripts/reproduce-dockerfile new file mode 100644 index 000000000..72383446e --- /dev/null +++ b/scripts/reproduce-dockerfile @@ -0,0 +1,31 @@ +# Dockerfile for containers to perform PR review in +# Use with make as follows: make RELEASE=v2.5.1 reproduce + +FROM centos:8 + +RUN dnf update -y +RUN yum install epel-release -y +RUN dnf install python38 git gcc gcc-c++ cmake make gnutls-devel libuuid-devel libfaketime sudo man -y + +RUN useradd warrior +RUN echo warrior ALL=NOPASSWD:ALL > /etc/sudoers.d/warrior + +USER warrior +WORKDIR /home/warrior/ + +# Setup taskwarrior +# The purpose is to speed up subsequent re-installs due to Docker layer caching +RUN git clone https://github.com/GothenburgBitFactory/taskwarrior.git +WORKDIR /home/warrior/taskwarrior/ +RUN git submodule init + +# Install the given release +ARG RELEASE +RUN git checkout $RELEASE +RUN git submodule update --init +RUN cmake -DCMAKE_BUILD_TYPE=debug . +RUN make -j8 +RUN sudo make install + +WORKDIR /home/warrior +RUN task rc.confirmation=0 _ids || : # Generate default taskrc