Re: [ruby-libvirt 1/3] gitlab: introduce CI jobs testing git master & distro libvirt

2020-05-14 Thread Andrea Bolognani
On Tue, 2020-05-12 at 11:21 +0100, Daniel P. Berrangé wrote:
> +.container_job_template: &container_job_definition
> +  image: docker:stable
> +  stage: containers
> +  services:
> +- docker:dind
> +  before_script:
> +- export TAG="$CI_REGISTRY_IMAGE/ci-$NAME:latest"
> +- export COMMON_TAG="$CI_REGISTRY/libvirt/ruby-libvirt/ci-$NAME:latest"

Can we rename the repo to libvirt-ruby already?

> +.dist_build_job_template: &dist_build_job_definition
> +  image: $CI_REGISTRY_IMAGE/ci-$NAME:latest
> +  stage: builds
> +  before_script:
> +- export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"
> +  script:
> +- rake build
> +- if test "$NAME" != "opensuse-151" ; then rake package; fi

Same comment made for the Java bindings: please make this an optional
part of the build that can be skipped by using the appropriate
variable at job definition time.

Everything else looks good.

-- 
Andrea Bolognani / Red Hat / Virtualization



[ruby-libvirt 1/3] gitlab: introduce CI jobs testing git master & distro libvirt

2020-05-12 Thread Daniel P . Berrangé
The ruby build needs to validate two axis

 - A variety of libvirt versions
 - A variety of ruby versions

We get coverage for both these axis by running a build against the
distro provided libvirt packages. All that is then missing is a build
against the latest libvirt git master, which only needs to be run on
a single distro, for which CentOS 8 is picked as a stable long life
base.

For unknown reasons  "rake package" fails on OpenSUSE Leap 15, but it
appears to be a bug in the old version of rake, so we skip that part
of the build.

Signed-off-by: Daniel P. Berrangé 
---
 .gitlab-ci.yml   | 168 +++
 ci/README.rst|  14 +++
 ci/libvirt-centos-7.Dockerfile   |  86 ++
 ci/libvirt-centos-8.Dockerfile   |  64 ++
 ci/libvirt-debian-10.Dockerfile  |  56 +
 ci/libvirt-debian-9.Dockerfile   |  59 ++
 ci/libvirt-debian-sid.Dockerfile |  56 +
 ci/libvirt-fedora-31.Dockerfile  |  53 +
 ci/libvirt-fedora-32.Dockerfile  |  53 +
 ci/libvirt-fedora-rawhide.Dockerfile |  54 +
 ci/libvirt-opensuse-151.Dockerfile   |  55 +
 ci/libvirt-ubuntu-1804.Dockerfile|  59 ++
 ci/libvirt-ubuntu-2004.Dockerfile|  56 +
 ci/refresh   |  27 +
 14 files changed, 860 insertions(+)
 create mode 100644 ci/README.rst
 create mode 100644 ci/libvirt-centos-7.Dockerfile
 create mode 100644 ci/libvirt-centos-8.Dockerfile
 create mode 100644 ci/libvirt-debian-10.Dockerfile
 create mode 100644 ci/libvirt-debian-9.Dockerfile
 create mode 100644 ci/libvirt-debian-sid.Dockerfile
 create mode 100644 ci/libvirt-fedora-31.Dockerfile
 create mode 100644 ci/libvirt-fedora-32.Dockerfile
 create mode 100644 ci/libvirt-fedora-rawhide.Dockerfile
 create mode 100644 ci/libvirt-opensuse-151.Dockerfile
 create mode 100644 ci/libvirt-ubuntu-1804.Dockerfile
 create mode 100644 ci/libvirt-ubuntu-2004.Dockerfile
 create mode 100755 ci/refresh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 50dae92..0ca4bb9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,57 @@
 
 stages:
   - prebuild
+  - containers
+  - builds
+
+.container_job_template: &container_job_definition
+  image: docker:stable
+  stage: containers
+  services:
+- docker:dind
+  before_script:
+- export TAG="$CI_REGISTRY_IMAGE/ci-$NAME:latest"
+- export COMMON_TAG="$CI_REGISTRY/libvirt/ruby-libvirt/ci-$NAME:latest"
+- docker info
+- docker login registry.gitlab.com -u "$CI_REGISTRY_USER" -p 
"$CI_REGISTRY_PASSWORD"
+  script:
+- docker pull "$TAG" || docker pull "$COMMON_TAG" || true
+- docker build --cache-from "$TAG" --cache-from "$COMMON_TAG" --tag "$TAG" 
-f "ci/libvirt-$NAME.Dockerfile" ci
+- docker push "$TAG"
+  after_script:
+- docker logout
+
+.git_build_job_template: &git_build_job_definition
+  image: $CI_REGISTRY_IMAGE/ci-$NAME:latest
+  stage: builds
+  before_script:
+- export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"
+- export SCRATCH_DIR="/tmp/scratch"
+- export VROOT="$SCRATCH_DIR/vroot"
+- export LD_LIBRARY_PATH="$VROOT/lib"
+- export PATH="$VROOT/bin:$PATH"
+- export PKG_CONFIG_PATH="$VROOT/lib/pkgconfig"
+  script:
+- pushd "$PWD"
+- mkdir -p "$SCRATCH_DIR"
+- cd "$SCRATCH_DIR"
+- git clone --depth 1 https://gitlab.com/libvirt/libvirt.git
+- mkdir libvirt/build
+- cd libvirt/build
+- ../autogen.sh --prefix="$VROOT" --without-libvirtd
+- $MAKE install
+- popd
+- rake build
+- if test "$NAME" != "opensuse-151" ; then rake package; fi
+
+.dist_build_job_template: &dist_build_job_definition
+  image: $CI_REGISTRY_IMAGE/ci-$NAME:latest
+  stage: builds
+  before_script:
+- export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"
+  script:
+- rake build
+- if test "$NAME" != "opensuse-151" ; then rake package; fi
 
 # Check that all commits are signed-off for the DCO.
 # Skip on "libvirt" namespace, since we only need to run
@@ -14,3 +65,120 @@ check-dco:
   except:
 variables:
   - $CI_PROJECT_NAMESPACE == 'libvirt'
+
+centos-7-container:
+  <<: *container_job_definition
+  variables:
+NAME: centos-7
+
+centos-8-container:
+  <<: *container_job_definition
+  variables:
+NAME: centos-8
+
+debian-9-container:
+  <<: *container_job_definition
+  variables:
+NAME: debian-9
+
+debian-10-container:
+  <<: *container_job_definition
+  variables:
+NAME: debian-10
+
+debian-sid-container:
+  <<: *container_job_definition
+  variables:
+NAME: debian-sid
+
+fedora-31-container:
+  <<: *container_job_definition
+  variables:
+NAME: fedora-31
+
+fedora-32-container:
+  <<: *container_job_definition
+  variables:
+NAME: fedora-32
+
+fedora-rawhide-container:
+  <<: *container_job_definition
+  variables:
+NAME: fedora-rawhide
+
+opensuse-151-container:
+  <<: *container_job_definition
+  variables:
+NAME: opensuse-151