infra: Optimize for docker build cache

svn-origin-rev: 18397
This commit is contained in:
Ole Schütt 2018-04-25 17:56:48 +00:00
parent 3934c69b85
commit e840dd56d5
9 changed files with 52 additions and 46 deletions

View file

@ -15,9 +15,9 @@ CP2K_LOCAL=`realpath ../../`
echo -n "Date: "
date --utc --rfc-3339=seconds
echo ""
git log -1 --pretty="format:CommitSHA: %H%nCommitTime: %ci%nCommitAuthor: %an%nCommitSubject: %s%n"
echo ""
if git rev-parse; then
git log -1 --pretty="%nCommitSHA: %H%nCommitTime: %ci%nCommitAuthor: %an%nCommitSubject: %s%n"
fi
set -x
docker build -t img_cp2k_test_${TESTNAME} ./test_${TESTNAME}/

View file

@ -2,6 +2,20 @@ FROM cp2k/toolchain:latest
# author: Ole Schuett
# download and compile cp2k snapshot
WORKDIR /opt/
RUN wget -O cp2k-master.zip https://github.com/cp2k/cp2k/archive/master.zip && \
unzip cp2k-master.zip && \
rm cp2k-master.zip
WORKDIR /opt/cp2k-master/cp2k/arch
RUN ln -vs /opt/cp2k-toolchain/install/arch/local* .
WORKDIR /opt/cp2k-master/cp2k/makefiles
RUN source /opt/cp2k-toolchain/install/setup && \
make -j VERSION=pdbg && \
rm -rf ../lib/ ../exe/
# install Debian packages
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
@ -18,20 +32,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
rsync \
&& rm -rf /var/lib/apt/lists/*
# download and compile cp2k snapshot
WORKDIR /opt/
RUN wget -O cp2k-master.zip https://github.com/cp2k/cp2k/archive/master.zip && \
unzip cp2k-master.zip && \
rm cp2k-master.zip
WORKDIR /opt/cp2k-master/cp2k/arch
RUN ln -vs /opt/cp2k-toolchain/install/arch/local* .
WORKDIR /opt/cp2k-master/cp2k/makefiles
RUN source /opt/cp2k-toolchain/install/setup && \
make -j VERSION=pdbg cp2k && \
rm -rf ../lib/ ../exe/
# install python packages
RUN pip install flake8 aiida ase

View file

@ -4,7 +4,7 @@
set -e
echo -e "\n========== Rsyncing =========="
echo -e "\n========== Copying Changed Files =========="
rsync --exclude="*~" \
--exclude=".*/" \
--exclude="*.pyc" \
@ -34,9 +34,10 @@ SUDO="sudo -u ubuntu -H"
cd /opt/aiida-cp2k/test/
$SUDO ./configure_aiida.sh
echo -e "\n========== Running AiiDA-CP2K tests =========="
echo -e "\n========== Running AiiDA-CP2K Tests =========="
cd /opt/aiida-cp2k/test/
set +e
set +e # disable error trapping for remainder of script
(
set -e # abort on error
$SUDO ./run_tests.sh

View file

@ -2,6 +2,20 @@ FROM cp2k/toolchain:latest
# author: Ole Schuett
# download and compile cp2k snapshot
WORKDIR /opt/
RUN wget -O cp2k-master.zip https://github.com/cp2k/cp2k/archive/master.zip && \
unzip cp2k-master.zip && \
rm cp2k-master.zip
WORKDIR /opt/cp2k-master/cp2k/arch
RUN ln -vs /opt/cp2k-toolchain/install/arch/local* .
WORKDIR /opt/cp2k-master/cp2k/makefiles
RUN source /opt/cp2k-toolchain/install/setup && \
make -j VERSION=pdbg && \
rm -rf ../lib/ ../exe/
# install Debian packages
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
@ -14,23 +28,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*
# download and compile cp2k snapshot
WORKDIR /opt/
RUN wget -O cp2k-master.zip https://github.com/cp2k/cp2k/archive/master.zip && \
unzip cp2k-master.zip && \
rm cp2k-master.zip
WORKDIR /opt/cp2k-master/cp2k/arch
RUN ln -vs /opt/cp2k-toolchain/install/arch/local* .
WORKDIR /opt/cp2k-master/cp2k/makefiles
RUN source /opt/cp2k-toolchain/install/setup && \
make -j VERSION=pdbg cp2k_shell && \
rm -rf ../lib/ ../exe/
# install python packages
RUN pip3 install numpy scipy matplotlib flask
# clone ase reprository
WORKDIR /opt/
RUN git clone https://gitlab.com/ase/ase.git
WORKDIR /opt/cp2k_test_ase
COPY cmd.sh .
CMD ["/opt/cp2k_test_ase/cmd.sh"]

View file

@ -4,7 +4,7 @@
set -e
echo -e "\n========== Rsyncing =========="
echo -e "\n========== Copying Changed Files =========="
rsync --exclude="*~" \
--exclude=".*/" \
--exclude="*.pyc" \
@ -25,14 +25,15 @@ make -j VERSION=pdbg cp2k_shell
ln -s /opt/cp2k-master/cp2k/exe/local/cp2k.pdbg /usr/bin/cp2k
echo -e "\n========== Installing ASE =========="
cd /opt/
git clone https://gitlab.com/ase/ase.git
pip3 install ./ase/
cd /opt/ase/
git pull
pip3 install .
echo -e "\n========== Running ASE tests =========="
echo -e "\n========== Running ASE Tests =========="
cd /opt/ase/
export ASE_CP2K_COMMAND="mpiexec -np 2 /opt/cp2k-master/cp2k/exe/local/cp2k_shell.pdbg"
set +e # disable error trapping for remainder of script
(
set -e # abort if error is encountered
for i in ./ase/test/cp2k/cp2k_*.py

View file

@ -4,7 +4,7 @@
set -e
echo -e "\n========== Rsyncing =========="
echo -e "\n========== Copying Changed Files =========="
rsync --exclude="*~" \
--exclude=".*/" \
--exclude="*.pyc" \
@ -18,7 +18,7 @@ rsync --exclude="*~" \
--checksum \
/opt/cp2k-local/ /opt/cp2k-master/
echo -e "\n========== Running Conventions test =========="
echo -e "\n========== Running Conventions Test =========="
source /opt/cp2k-toolchain/install/setup
cd /opt/cp2k-master/cp2k/tools/conventions/
#TODO port to Python3

View file

@ -4,7 +4,7 @@
set -e
echo -e "\n========== Rsyncing =========="
echo -e "\n========== Copying Changed Files =========="
rsync --exclude="*~" \
--exclude=".*/" \
--exclude="*.pyc" \
@ -18,7 +18,7 @@ rsync --exclude="*~" \
--checksum \
/opt/cp2k-local/ /opt/cp2k-master/
echo -e "\n========== Running formatting test =========="
echo -e "\n========== Running Formatting Test =========="
cd /opt/cp2k-master/cp2k
./tools/formatting/test_formatting.sh

View file

@ -10,7 +10,7 @@ run_selftests() {
BASEDIR=`pwd`
VERSION=`$PYTHON -V 2>&1 | tr -d '\n'`
echo ""
echo "==========" $VERSION "=========="
echo "========== Running ${VERSION} Tests =========="
#find ./src/ ./tools/ -name "*.pyc" -exec rm {} \;
for i in $@ ; do
set +e #disable error trapping
@ -32,12 +32,12 @@ run_selftests() {
#===============================================================================
echo "Copy start..."
echo -e "\n========== Copying Changed Files =========="
mkdir /opt/cp2k-local-rw/
cp -r /opt/cp2k-local/cp2k/tools /opt/cp2k-local-rw/tools
cp -r /opt/cp2k-local/cp2k/src /opt/cp2k-local-rw/src
cd /opt/cp2k-local-rw/
echo "Copy done."
ERRORS=0