From 97f783ce96269181c55f363a660a033d54591e82 Mon Sep 17 00:00:00 2001 From: Joe Kutner Date: Thu, 23 Apr 2020 17:55:05 -0700 Subject: [PATCH] Update travis config [changelog skip] (#963) * Update travis config to only setup hatchet when running hatchet [changelog skip] Fix a bug in the hatchet tests, and allow previous builds to finish before running the next test * Add logging when skipping hatchet tests Only skip hatchet tests on a forked PR * Build on Travis only for master branch * Upgrade from trusty to bionic on Travis --- .travis.yml | 10 +++++++--- spec/hatchet/python_spec.rb | 6 ++++++ spec/spec_helper.rb | 12 +++++++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index d5449a3..8c6a51a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,14 @@ language: ruby -dist: trusty +dist: bionic sudo: required +branches: + only: + - master rvm: - 2.4.4 before_script: - gem install bundler -v 1.16.2 - - bundle exec hatchet ci:setup script: - docker build --pull --tag travis-build-cedar-14 --file $(pwd)/builds/cedar-14.Dockerfile . @@ -24,7 +26,9 @@ jobs: - stage: Hatchet Integration if: branch = master name: Run Hatchet - script: "bundle exec rspec" + script: + - bundle exec hatchet ci:setup + - bundle exec rspec env: matrix: - TESTFOLDER=test/run-deps diff --git a/spec/hatchet/python_spec.rb b/spec/hatchet/python_spec.rb index 871aa7e..66023bf 100644 --- a/spec/hatchet/python_spec.rb +++ b/spec/hatchet/python_spec.rb @@ -31,6 +31,9 @@ describe "Default Python Deploy" do expect(app.output).to_not match("No such file or directory") expect(app.output).to_not match("cp: cannot create regular file") + # let the previous build finish + sleep(5) + # Redeploy with changed requirements file run!(%Q{echo "" >> requirements.txt}) run!(%Q{echo "flask" >> requirements.txt}) @@ -44,6 +47,9 @@ describe "Default Python Deploy" do expect(app.output).to_not match("No dependencies found, preparing to install") expect(app.output).to_not match("No change in requirements detected, installing from cache") + # let the previous build finish + sleep(5) + run!(%Q{git commit --allow-empty -m next}) app.push! diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index dc7acd1..a53d735 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -17,7 +17,12 @@ end if ENV['TRAVIS'] # Don't execute tests against "merge" commits - exit 0 if ENV['TRAVIS_PULL_REQUEST'] != 'false' && ENV['TRAVIS_BRANCH'] == 'master' + if ENV['TRAVIS_PULL_REQUEST'] != 'false' && + ENV['TRAVIS_BRANCH'] == 'master' && + ENV["TRAVIS_PULL_REQUEST_SLUG"] != ENV['TRAVIS_REPO_SLUG'] # forked PR + puts "Skipping Hatchet tests" + exit 0 + end end DEFAULT_STACK = 'heroku-18' @@ -27,3 +32,8 @@ def run!(cmd) raise "Error running command #{cmd} with output: #{out}" unless $?.success? return out end + +def init_app(app, stack=DEFAULT_STACK) + app.setup! + app.platform_api.app.update(app.name, {"build_stack" => ENV["HEROKU_TEST_STACK"] || stack}) +end \ No newline at end of file