From c79d1c9f0801910489070313036fb388de4a35b1 Mon Sep 17 00:00:00 2001 From: Thomas Wood <thomas.wood09@imperial.ac.uk> Date: Thu, 5 Oct 2017 19:41:10 +0100 Subject: [PATCH] Dockerise the build/deployment --- .gitlab-ci.yml | 57 ++++++++++++++++++++++++++++++-------------------- Gemfile | 6 ++++-- Rakefile | 5 ----- 3 files changed, 38 insertions(+), 30 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0842e30..78b17b4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,47 +9,58 @@ update_publications: - git checkout -B ${CI_BUILD_REF_NAME} - git submodule update --init --remote - git add publications - - git commit -m "[AUTO] Updating publications submodule" --author="Resource Reasoning Group Backup Bot <rr-gitlab-bot@example.com>" || exit 0 + - git commit -m "[AUTO] Updating publications submodule\n\n[ci skip]" || exit 0 - git remote rm rw || true - git remote add rw git@gitlab.doc.ic.ac.uk:${CI_PROJECT_PATH}.git - eval `ssh-agent` - echo "$PUSH_KEY" | ssh-add - - git push rw ${CI_BUILD_REF_NAME} - - ssh-agent -k + variables: + GIT_AUTHOR_NAME: Resource Reasoning Group Backup Bot + GIT_COMMITTER_NAME: Resource Reasoning Group Backup Bot + GIT_AUTHOR_EMAIL: rr-gitlab-bot@example.com + EMAIL: rr-gitlab-bot@example.com + image: ignoredambience/github-gitlab-sync + tags: + - docker only: - triggers -.before_script: &before_script - - bundle install --without=development - - bundle exec rake init - test: stage: test - before_script: *before_script + image: "ruby:2.4" + tags: + - docker + before_script: + - bundle install --without=development + - bundle exec rake init script: - bundle exec rake -s --suppress-backtrace . test - except: - - triggers + artifacts: + paths: + - _site/ + expire_in: 1 day + +deadlinks: + stage: deploy + image: "ruby:2.4" + tags: + - docker + before_script: + - bundle install --without="build development" --with=test + script: + - bundle exec rake -s --suppress-backtrace . testlinks + allow_failure: true deploy: stage: deploy environment: production - before_script: *before_script script: - - bundle exec rake -s --suppress-backtrace . deploy + - "umask 0002 && rsync --chmod=Dg+s,ug+rwX,o+rX --chown=:rr -igrp --delete _site/ /vol/rr/www" tags: - - doc + - auth-rr only: - master - except: - - triggers - -# Not a test stage to prevent race conditions with gem installations. -deadlinks: - stage: deploy - script: - - bundle exec rake -s --suppress-backtrace . testlinks - allow_failure: true - except: - - triggers +variables: + NOKOGIRI_USE_SYSTEM_LIBRARIES: "true" diff --git a/Gemfile b/Gemfile index 709c1cd..6211f92 100644 --- a/Gemfile +++ b/Gemfile @@ -1,9 +1,11 @@ source 'https://rubygems.org' gem 'rake' -gem 'jekyll' +group :build do + gem 'jekyll' +end -group :default, :jekyll_plugins do +group :build, :jekyll_plugins do gem 'jekyll-scholar', '~> 5.10' #gem 'jekyll-scholar', :git => '/home/thomas/jekyll-scholar', :branch => 'master' gem 'jekyll-redirect-from' diff --git a/Rakefile b/Rakefile index b8d7ec5..7fd1a1b 100644 --- a/Rakefile +++ b/Rakefile @@ -34,8 +34,3 @@ desc "Build the site, rebuild when files are edited, and serve via a local http task :serve do sh "bundle exec jekyll serve" end - -desc "Deploy the site using rsync" -task :deploy => :build do - sh "umask 0002 && rsync --chmod=Dg+s,ug+rwX,o+rX --chown=:rr -igrp --delete _site/ /vol/rr/www" -end -- GitLab