Skip to content

Commit

Permalink
feat: automate the build
Browse files Browse the repository at this point in the history
  • Loading branch information
gsdevme committed Feb 1, 2018
1 parent d086484 commit a00baf9
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .build/centos6.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# Take a copy of the source files to build in an isolated directory
mkdir -p /build
cp -R /vmod-queryfilter/* /build
cd /build

cat << EOF > /etc/yum.repos.d/varnish.repo
[varnish]
name=Varnish Repository
baseurl=https://packagecloud.io/varnishcache/varnish41/el/6/\$basearch
enabled=1
fastestmirror_enabled=0
gpgcheck=0
gpgkey=https://packagecloud.io/varnishcache/varnish41/gpgkey
EOF

yum -q makecache -y --disablerepo='*' --enablerepo='varnish'
yum install varnish -y

# Varnish version installed
VERSION=$(rpm --queryformat "%{VERSION}" -q varnish)

wget "https://github.com/varnishcache/varnish-cache/archive/varnish-$VERSION.tar.gz"
tar -xzf "varnish-$VERSION.tar.gz"

cd "varnish-cache-varnish-$VERSION"
export VARNISHSRC=$(pwd)
./autogen.sh && ./configure && make

cd ..

./autogen.sh
./configure VARNISHSRC=$VARNISHSRC
make
20 changes: 20 additions & 0 deletions .build/debian8.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Take a copy of the source files to build in an isolated directory
mkdir -p /build
cp -R /vmod-queryfilter/* /build
cd /build

curl -L https://packagecloud.io/varnishcache/varnish52/gpgkey | apt-key add -

cat << EOF > /etc/apt/sources.list.d/varnish.list
deb https://packagecloud.io/varnishcache/varnish5/ubuntu/ trusty main
deb-src https://packagecloud.io/varnishcache/varnish5/ubuntu/ trusty main
EOF

apt-get update -y
apt-get install varnish varnish-dev -y --force-yes

./autogen.sh
./configure VARNISHSRC=/usr/include/varnish/
make
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ vmod_queryfilter.3

# Things not to ignore
!m4/ax_*

# Kitchen CI
.bundle/
.kitchen/
vendor/
Gemfile.lock
46 changes: 46 additions & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
driver:
name: docker
privileged: true
use_sudo: false
# Share the code into the Kitchen Container
volume:
- $(pwd):/vmod-queryfilter

platforms:
- name: centos-6.9
provisioner:
script: .build/centos6.sh
driver_config:
provision_command:
# Update & install epel-release & yum-utils
- yum update -y
- yum install epel-release -y
- yum install pygpgme yum-utils wget python-docutils ncurses-devel pcre-devel libedit-devel -y
# Install build tools
- yum groupinstall 'Development Tools' -y

- name: debian-8
provisioner:
script: .build/debian8.sh
driver_config:
image: debian:8
provision_command:
# Update & install require packages
- apt-get update && apt-get upgrade -y
- apt-get install curl gnupg apt-transport-https debian-archive-keyring -y
# Install build tools
- apt-get install build-essential autotools-dev libtool automake -y


provisioner:
name: shell

verifier:
name: inspec

suites:
- name: centos
excludes: ["debian-8"]
- name: debian
excludes: ["centos-6.9"]
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
language: ruby
dist: trusty

matrix:
include:
- rvm: 2.3
env: suite=centos-69
# - rvm: 2.3
# env: suite=debian-8

sudo: required
services: docker

before_script:
- gem install bundler
- bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --retry=3

script: bundle exec kitchen test "$suite"
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source 'https://rubygems.org'

gem 'inspec'
gem 'test-kitchen'
gem 'kitchen-docker'
gem 'kitchen-inspec'

2 changes: 1 addition & 1 deletion src/vmod_queryfilter.vcc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#==============================================================================
# libvmod-queryfilter: Simple VMOD for filtering/sorting query strings
#
# Copyright © 2014-2018 The New York Times Company
# Copyright 2014-2018 The New York Times Company
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down

0 comments on commit a00baf9

Please sign in to comment.