Skip to content

Commit f7d7b26

Browse files
committed
Revert "remove custom commands and custom scripts (#3468)"
This reverts commit 236a5f0.
1 parent e33b760 commit f7d7b26

File tree

3 files changed

+105
-0
lines changed

3 files changed

+105
-0
lines changed

CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,23 @@ foreach (doc_FILE ${doc_FILES})
157157
install (FILES ${doc_FILE} DESTINATION ${TASK_DOCDIR})
158158
endforeach (doc_FILE)
159159

160+
add_custom_command(OUTPUT run-review
161+
COMMAND docker build -q --build-arg PR=$(PR) --build-arg LIBPR=$(LIBPR) -t taskwarrior-review:$(PR)s$(LIBPR) - < scripts/review-dockerfile
162+
COMMAND docker run --rm --memory 1g --hostname pr-$(PR)s$(LIBPR) -it taskwarrior-review:$(PR)s$(LIBPR) bash || :
163+
)
164+
add_custom_target(review DEPENDS run-review)
165+
166+
add_custom_command(OUTPUT run-reproduce
167+
COMMAND docker build -q --build-arg RELEASE=$(RELEASE) -t taskwarrior-reproduce:$(RELEASE) - < scripts/reproduce-dockerfile
168+
COMMAND docker run --rm --memory 1g --hostname tw-$(RELEASE) -it taskwarrior-reproduce:$(RELEASE) bash || :
169+
)
170+
add_custom_target(reproduce DEPENDS run-reproduce)
171+
172+
add_custom_command(OUTPUT show-problems
173+
COMMAND cd test && ./problems
174+
)
175+
add_custom_target(problems DEPENDS show-problems)
176+
160177
# ---
161178

162179
set (CPACK_SOURCE_GENERATOR "TGZ")

scripts/reproduce-dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Dockerfile for containers to perform PR review in
2+
# Use with make as follows: make RELEASE=v2.5.1 reproduce
3+
4+
FROM centos:8
5+
6+
RUN dnf update -y
7+
RUN yum install epel-release -y
8+
RUN dnf install python38 vim git gcc gcc-c++ cmake make libuuid-devel libfaketime sudo man gdb -y
9+
10+
RUN useradd warrior
11+
RUN echo warrior ALL=NOPASSWD:ALL > /etc/sudoers.d/warrior
12+
13+
USER warrior
14+
WORKDIR /home/warrior/
15+
16+
# Setup taskwarrior
17+
# The purpose is to speed up subsequent re-installs due to Docker layer caching
18+
RUN git clone https://github.com/GothenburgBitFactory/taskwarrior.git
19+
WORKDIR /home/warrior/taskwarrior/
20+
RUN git submodule init
21+
22+
# Install the given release
23+
ARG RELEASE
24+
RUN git checkout $RELEASE
25+
RUN git submodule update --init
26+
RUN cmake -DCMAKE_BUILD_TYPE=debug .
27+
RUN make -j8
28+
RUN sudo make install
29+
30+
# Set the PS1 variable
31+
ENV PS1="[\u@\H \W]\$ "
32+
33+
WORKDIR /home/warrior
34+
RUN task rc.confirmation=0 _ids || : # Generate default taskrc

scripts/review-dockerfile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Dockerfile for containers to perform PR review in
2+
# Use with make as follows: make PR=1234 review
3+
4+
FROM centos:8
5+
6+
# Workaround to the location of the repos
7+
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
8+
RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
9+
10+
RUN dnf update -y
11+
RUN yum install epel-release -y
12+
RUN dnf install python38 git gcc gcc-c++ cmake make libuuid-devel libfaketime sudo man -y
13+
14+
RUN useradd warrior
15+
RUN echo warrior ALL=NOPASSWD:ALL > /etc/sudoers.d/warrior
16+
17+
USER warrior
18+
WORKDIR /home/warrior/
19+
20+
# Setup Rust
21+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh && \
22+
sh rustup.sh -y --profile minimal --default-toolchain stable --component rust-docs
23+
24+
# Setup taskwarrior
25+
# The purpose is to speed up subsequent re-installs due to Docker layer caching
26+
RUN git clone https://github.com/GothenburgBitFactory/taskwarrior.git
27+
WORKDIR /home/warrior/taskwarrior/
28+
RUN git submodule init
29+
RUN git submodule update
30+
RUN cmake -DCMAKE_BUILD_TYPE=debug .
31+
RUN make -j8
32+
RUN sudo make install
33+
34+
# Use specified PR's branch, if provided
35+
ARG PR
36+
RUN if [[ ! -z $PR ]]; then \
37+
git fetch origin refs/pull/${PR}/head:pr-${PR}; \
38+
git checkout pr-${PR}; fi
39+
40+
# Use specified libshared PR's branch, if provided
41+
ARG LIBPR
42+
WORKDIR /home/warrior/taskwarrior/src/libshared/
43+
RUN if [[ ! -z $LIBPR ]]; then \
44+
git fetch origin refs/pull/${LIBPR}/head:libpr-${LIBPR}; \
45+
git checkout libpr-${LIBPR}; fi
46+
47+
# Install taskwarrior
48+
WORKDIR /home/warrior/taskwarrior/
49+
RUN cmake -DCMAKE_BUILD_TYPE=debug .
50+
RUN make -j8
51+
RUN sudo make install
52+
53+
WORKDIR /home/warrior
54+
RUN task rc.confirmation=0 _ids || : # Generate default taskrc

0 commit comments

Comments
 (0)