Skip to content

Commit

Permalink
Cache bundles on travis, use bundle exec
Browse files Browse the repository at this point in the history
  • Loading branch information
adangel committed Aug 17, 2018
1 parent 43a2199 commit eb03003
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -11,3 +11,5 @@ bin/
*.patch
*/src/site/site.xml
pmd-core/dependency-reduced-pom.xml
.bundle
vendor
3 changes: 2 additions & 1 deletion .travis.yml
Expand Up @@ -34,7 +34,7 @@ before_install:
# Install OracleJDK 10 - see https://sormuras.github.io/blog/2018-03-20-jdk-matrix.html
install:
- . ./install-jdk.sh -F 10 -L BCL
- bundle install
- bundle install --without=release_notes_preprocessing
before_script: true
script: source .travis/build-$BUILD.sh
after_success: true
Expand Down Expand Up @@ -71,6 +71,7 @@ notifications:
cache:
directories:
- "$HOME/.m2"
- vendor/bundle


# Secure Keys, that need to be set for snapshot builds
Expand Down
5 changes: 4 additions & 1 deletion .travis/release.sh
Expand Up @@ -28,8 +28,11 @@ if [ "${BUILD}" = "deploy" ]; then
true
)

# install the gems required for rendering the release notes
bundle install --with=release_notes_preprocessing

# renders, and skips the first 6 lines - the Jekyll front-matter
RENDERED_RELEASE_NOTES=$(.travis/render_release_notes.rb docs/pages/release_notes.md | tail -n +6)
RENDERED_RELEASE_NOTES=$(bundle exec .travis/render_release_notes.rb docs/pages/release_notes.md | tail -n +6)

# Assumes, the release has already been created by travis github releases provider
RELEASE_ID=$(curl -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" https://api.github.com/repos/pmd/pmd/releases/tags/pmd_releases/${RELEASE_VERSION}|jq ".id")
Expand Down
3 changes: 3 additions & 0 deletions .travis/render_release_notes.rb
Expand Up @@ -15,6 +15,9 @@
require_relative "../docs/_plugins/rule_tag"
require_relative "../docs/_plugins/custom_filters"

# explicitly setting safe mode to get rid of the warning
SafeYAML::OPTIONS[:default_mode] = :safe

# START OF THE SCRIPT

unless ARGV.length == 1 && File.exists?(ARGV[0])
Expand Down
4 changes: 1 addition & 3 deletions Gemfile
Expand Up @@ -3,9 +3,7 @@ source 'https://rubygems.org/'
gem 'pmdtester', '~> 1.0.0.pre.beta3'
gem 'danger', '~> 5.6', '>= 5.6'

# I think we could skip installing these if we're not a release build
# https://docs.travis-ci.com/user/languages/ruby/#speeding-up-your-build-by-excluding-non-essential-dependencies
# I don't know where to put that in .travis.yml though...
# This group is only needed during release (via .travis/release.sh and do-release.sh)
group :release_notes_preprocessing do
gem 'liquid', '>=4.0.0'
gem 'safe_yaml', '>=1.0'
Expand Down
6 changes: 5 additions & 1 deletion do-release.sh
Expand Up @@ -62,6 +62,10 @@ echo "Press enter to continue..."
read


# install bundles needed for rendering release notes
bundle install with=release_notes_preprocessing --path vendor/bundle


export RELEASE_VERSION
export DEVELOPMENT_VERSION
export CURRENT_BRANCH
Expand Down Expand Up @@ -137,7 +141,7 @@ read

# update release_notes_old
OLD_RELEASE_NOTES=$(tail -n +8 docs/pages/release_notes_old.md)
NEW_RELEASE_NOTES=$(.travis/render_release_notes.rb docs/pages/release_notes.md | tail -n +6)
NEW_RELEASE_NOTES=$(bundle exec .travis/render_release_notes.rb docs/pages/release_notes.md | tail -n +6)
echo "$(head -n 7 docs/pages/release_notes_old.md)" > docs/pages/release_notes_old.md
echo "$NEW_RELEASE_NOTES" >> docs/pages/release_notes_old.md
echo >> docs/pages/release_notes_old.md
Expand Down

0 comments on commit eb03003

Please sign in to comment.