From e1ddf75eb6f48677edfec967d91caa8d11d2c469 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Fri, 11 Oct 2019 20:31:53 -0700 Subject: [PATCH] Add testing of PRs in Buildkite Remove the Travis config Signed-off-by: Tim Smith --- .expeditor/config.yml | 5 ++++ .expeditor/run_linux_tests.sh | 44 ++++++++++++++++++++++++++++++++++ .expeditor/verify.pipeline.yml | 27 +++++++++++++++++++++ .travis.yml | 21 ---------------- 4 files changed, 76 insertions(+), 21 deletions(-) create mode 100755 .expeditor/run_linux_tests.sh create mode 100644 .expeditor/verify.pipeline.yml delete mode 100644 .travis.yml diff --git a/.expeditor/config.yml b/.expeditor/config.yml index b25253a5..c33d8323 100644 --- a/.expeditor/config.yml +++ b/.expeditor/config.yml @@ -40,6 +40,11 @@ merge_actions: - built_in:build_gem: only_if: built_in:bump_version +pipelines: + - verify: + description: Pull Request validation tests + public: true + promote: actions: - built_in:rollover_changelog diff --git a/.expeditor/run_linux_tests.sh b/.expeditor/run_linux_tests.sh new file mode 100755 index 00000000..a0b86e30 --- /dev/null +++ b/.expeditor/run_linux_tests.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# +# This script runs a passed in command, but first setups up the bundler caching on the repo + +set -e + +export USER="root" + +# make sure we have the aws cli +apt-get update -y +apt-get install awscli -y + +# grab the s3 bundler if it's there and use it for all operations in bundler +echo "Fetching bundle cache archive from s3://public-cd-buildkite-cache/${BUILDKITE_PIPELINE_SLUG}/${BUILDKITE_LABEL}/bundle.tar.bz2" +aws s3 cp "s3://public-cd-buildkite-cache/${BUILDKITE_PIPELINE_SLUG}/${BUILDKITE_LABEL}/bundle.tar.bz2" bundle.tar.bz2 || echo 'Could not pull the bundler archive from s3 for caching. Builds may be slower than usual as all gems will have to install.' +aws s3 cp "s3://public-cd-buildkite-cache/${BUILDKITE_PIPELINE_SLUG}/${BUILDKITE_LABEL}/bundle.sha256" bundle.sha256 || echo "Could not pull the sha256 hash of the vendor/bundle directory from s3. Without this we will compress and upload the bundler archive to S3 even if it hasn't changed" + +echo "Restoring the bundle cache archive to vendor/bundle" +if [ -f bundle.tar.bz2 ]; then + tar -xjf bundle.tar.bz2 +fi +bundle config --local path vendor/bundle + +bundle install --jobs=7 --retry=3 +bundle exec $1 + +if [[ -f bundle.tar.bz2 && -f bundle.sha256 ]]; then # dont' check the sha if we're missing either file + if shasum --check bundle.sha256 --status; then # if the the sha matches we're done + echo "Bundled gems have not changed. Skipping upload to s3" + exit + fi +fi + +echo "Generating sha256 hash file of the vendor/bundle directory to ship to s3" +shasum -a 256 vendor/bundle > bundle.sha256 + +echo "Creating the tar.bz2 to of the vendor/bundle directory to ship to s3" +tar -cjf bundle.tar.bz2 vendor/ + +echo "Uploading the tar.bz2 of the vendor/bundle directory to s3" +aws s3 cp bundle.tar.bz2 "s3://public-cd-buildkite-cache/${BUILDKITE_PIPELINE_SLUG}/${BUILDKITE_LABEL}/bundle.tar.bz2" || echo 'Could not push the bundler directory to s3 for caching. Future builds may be slower if this continues.' + +echo "Uploading the sha256 hash of the vendor/bundle directory to s3" +aws s3 cp bundle.sha256 "s3://public-cd-buildkite-cache/${BUILDKITE_PIPELINE_SLUG}/${BUILDKITE_LABEL}/bundle.sha256" || echo 'Could not push the bundler directory to s3 for caching. Future builds may be slower if this continues.' \ No newline at end of file diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml new file mode 100644 index 00000000..814baf5f --- /dev/null +++ b/.expeditor/verify.pipeline.yml @@ -0,0 +1,27 @@ +steps: + +- label: lint-chefstyle + command: + - .expeditor/run_linux_tests.sh "rake style" + expeditor: + executor: + docker: + image: ruby:2.6-buster + + +- label: run-specs-ruby-2.5 + command: + - .expeditor/run_linux_tests.sh "rake spec" + expeditor: + executor: + docker: + image: ruby:2.5-buster + +- label: run-specs-ruby-2.6 + command: + - .expeditor/run_linux_tests.sh "rake spec" + expeditor: + executor: + docker: + image: ruby:2.6-buster + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a49d47f8..00000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: ruby -cache: bundler - -matrix: - include: - - rvm: 2.3.8 - - rvm: 2.4.5 - - rvm: 2.5.3 - - rvm: ruby-head - allow_failures: - - rvm: ruby-head - -branches: - only: - - master - -bundler_args: --jobs 7 --without docs debug - -script: - - bundle exec chefstyle - - bundle exec rake