URL: https://github.com/freeipa/freeipa/pull/1317
Author: abbra
 Title: #1317: [WIP] Travis ci cache builds
Action: opened

PR body:
"""

"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1317/head:pr1317
git checkout pr1317
From d69b61335338897744a85b557febe4f116299fdf Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <aboko...@redhat.com>
Date: Tue, 21 Nov 2017 12:08:55 +0200
Subject: [PATCH 1/2] travis-ci: make sure we run cmocka tests under gdb and
 collect logs

---
 .test_runner_config.yaml          | 4 +++-
 .test_runner_config_py3_temp.yaml | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/.test_runner_config.yaml b/.test_runner_config.yaml
index 928f64a146..8db7f2e688 100644
--- a/.test_runner_config.yaml
+++ b/.test_runner_config.yaml
@@ -24,11 +24,12 @@ server:
   realm: IPA.TEST
 steps:
   build:
-  - make V=0 ${make_target}
+  - make V=0 ${make_target} LOG_COMPILE="gdb -batch -ex 'run; bt full'"
   builddep:
   - rm -rf /var/cache/dnf/*
   - "dnf makecache || :"
   - dnf builddep -y ${builddep_opts} -D "with_wheels 1" --spec freeipa.spec.in --best --allowerasing
+  - dnf install -y gdb
   cleanup:
   - chown -R ${uid}:${gid} ${container_working_dir}
   - journalctl -b --no-pager > systemd_journal.log
@@ -40,6 +41,7 @@ steps:
       /var/log/krb5kdc.log
       /var/log/pki
       systemd_journal.log
+      `find daemons -name '*.log' -print`
   - chown ${uid}:${gid} ${container_working_dir}/var_log.tar
   configure:
   - ./autogen.sh
diff --git a/.test_runner_config_py3_temp.yaml b/.test_runner_config_py3_temp.yaml
index 00d1de79ea..71ebc5d89f 100644
--- a/.test_runner_config_py3_temp.yaml
+++ b/.test_runner_config_py3_temp.yaml
@@ -26,11 +26,12 @@ server:
   realm: IPA.TEST
 steps:
   build:
-  - make V=0 ${make_target}
+  - make V=0 ${make_target} LOG_COMPILE="gdb -batch -ex 'run; bt full'"
   builddep:
   - rm -rf /var/cache/dnf/*
   - "dnf makecache || :"
   - dnf builddep -y ${builddep_opts} --spec freeipa.spec.in --best --allowerasing
+  - dnf install -y gdb
   cleanup:
   - chown -R ${uid}:${gid} ${container_working_dir}
   - >
@@ -41,6 +42,7 @@ steps:
       /var/log/krb5kdc.log
       /var/log/pki
       systemd_journal.log
+      `find daemons -name '*.log' -print`
   - chown ${uid}:${gid} ${container_working_dir}/var_log.tar
   configure:
   - ./autogen.sh

From d073c9805e74bf64e149bcf68801e8ba1163dad3 Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <aboko...@redhat.com>
Date: Tue, 21 Nov 2017 23:59:20 +0200
Subject: [PATCH 2/2] travis-ci: use directory cache for per-PR caching of RPMs

---
 .test_runner_config.yaml | 9 +++++----
 .travis.yml              | 9 ++++++++-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/.test_runner_config.yaml b/.test_runner_config.yaml
index 8db7f2e688..7a34636aec 100644
--- a/.test_runner_config.yaml
+++ b/.test_runner_config.yaml
@@ -12,6 +12,7 @@ host:
   binds:
   - /sys/fs/cgroup:/sys/fs/cgroup:ro
   - /dev/urandom:/dev/random:ro
+  - ${TRAVIS_BUILD_DIR}/freeipa-cache:${container_working_dir}/dist/rpms
   privileged: true
   security_opt:
   - label:disable
@@ -24,7 +25,7 @@ server:
   realm: IPA.TEST
 steps:
   build:
-  - make V=0 ${make_target} LOG_COMPILE="gdb -batch -ex 'run; bt full'"
+  - [ -f ${container_working_dir}/dist/rpms/freeipa-server-*.rpm ] || make V=0 ${make_target} LOG_COMPILE="gdb -batch -ex 'run; bt full'"
   builddep:
   - rm -rf /var/cache/dnf/*
   - "dnf makecache || :"
@@ -44,7 +45,7 @@ steps:
       `find daemons -name '*.log' -print`
   - chown ${uid}:${gid} ${container_working_dir}/var_log.tar
   configure:
-  - ./autogen.sh
+  - [ -f ${container_working_dir}/dist/rpms/freeipa-server-*.rpm ] || ./autogen.sh
   install_packages:
   - dnf install -y ${container_working_dir}/dist/rpms/*.rpm --best --allowerasing
   install_server:
@@ -53,8 +54,8 @@ steps:
   - sed -ri "s/mode = production/mode = development/" /etc/ipa/default.conf
   - systemctl restart httpd.service
   lint:
-  - make PYTHON=/usr/bin/python2 V=0 lint
-  - make PYTHON=/usr/bin/python3 V=0 pylint
+   - [ -f ${container_working_dir}/dist/rpms/freeipa-server-*.rpm ] || make PYTHON=/usr/bin/python2 V=0 lint
+   - [ -f ${container_working_dir}/dist/rpms/freeipa-server-*.rpm ] || make PYTHON=/usr/bin/python3 V=0 pylint
   tox:
   # just run one pylint and one Python 3 target (time/coverage trade-off)
   - tox -e py27,py36,pypi,pylint3
diff --git a/.travis.yml b/.travis.yml
index 4b81d8a3b2..cb15718d2a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,7 +5,10 @@ services:
 
 python:
     - "2.7"
-cache: pip
+cache:
+    pip: true
+    directories:
+        - freeipa-cache
 env:
     global:
         - TEST_RUNNER_IMAGE="freeipa/freeipa-test-runner:master-latest"
@@ -14,7 +17,10 @@ env:
           CI_BACKLOG_SIZE=5000
           CI_RUNNER_LOGS_DIR="/tmp/test-runner-logs"
           CI_RUNNER_LOG_ARCHIVE="freeipa-ci-pr-${TRAVIS_PULL_REQUEST}-job-${TRAVIS_JOB_NUMBER}.tar.gz"
+          CACHE_NAME="freeipa-cache-ci-pr-${TRAVIS_PULL_REQUEST}"
     matrix:
+        - TASK_TO_RUN="build"
+          TEST_RUNNER_CONFIG=".test_runner_config.yaml"
         - TASK_TO_RUN="lint"
           TEST_RUNNER_CONFIG=".test_runner_config.yaml"
         - TASK_TO_RUN="run-tests"
@@ -56,6 +62,7 @@ install:
     - >
       pip3 install
       git+https://github.com/freeipa/ipa-docker-test-runner@release-0-2-2
+    - mkdir -p freeipa-cache
 
 script:
     - mkdir -p $CI_RUNNER_LOGS_DIR
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to