Skip to content

Commit

Permalink
ci: fix ignored errors within appraisal loop (#1103)
Browse files Browse the repository at this point in the history
The existing loop over appraisals for a gem is swallowing any error exits returned by commands within the loop.

Resolves #1097. The specific error mentioned in that issue for failure to bundle install pg 1.2 was fixed in #1108. This change fixes the appraisal loop.

Fix appraisal loop swallowing errors:

* add an explicit exit to the appraisal loop if any command in the chain fails so that the CI step also fails

Fix other errors that were being swallowed:

* add a workaround for GEM_HOME file permission problems during bundle install
  *  introduced to GitHub runner images sometime early July 2024
* bound which version of Ruby the gruf gem tests are run against
  * its gemspec includes upper bounds on Ruby versions which cause bundler install to fail under newer Rubies
  • Loading branch information
robbkidd authored Aug 8, 2024
1 parent 19c86ca commit 3584cfa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
9 changes: 8 additions & 1 deletion .github/actions/test_gem/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ runs:
ruby-version: "${{ inputs.ruby }}"
bundler: "latest"
working-directory: "${{ steps.setup.outputs.gem_dir }}"
# Perms workaround. See https://github.com/actions/runner-images/issues/10215
- name: Fix GEM_HOME permissions on GitHub Actions Runner
if: "${{ steps.setup.outputs.appraisals == 'true' }}"
shell: bash
run: |
# 🛠️😭 Fix GEM_HOME permissions 😭🛠️
chmod -R o-w $(gem env home)
- name: Install dependencies and generate appraisals
if: "${{ steps.setup.outputs.appraisals == 'true' }}"
shell: bash
Expand All @@ -100,7 +107,7 @@ runs:
echo "::group::🔎 Appraising ${i}"
BUNDLE_GEMFILE=gemfiles/${i}.gemfile bundle install --quiet --jobs=3 --retry=4 && \
BUNDLE_GEMFILE=gemfiles/${i}.gemfile bundle show && \
BUNDLE_GEMFILE=gemfiles/${i}.gemfile bundle exec rake test
BUNDLE_GEMFILE=gemfiles/${i}.gemfile bundle exec rake test || exit
echo "::endgroup::"
done
else
Expand Down
20 changes: 14 additions & 6 deletions instrumentation/gruf/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@
#
# SPDX-License-Identifier: Apache-2.0

appraise 'gruf-2.17' do
gem 'gruf', '~> 2.17.0'
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.3')
appraise 'gruf-2.17' do
gem 'gruf', '~> 2.17.0'
end

appraise 'gruf-2.18' do
gem 'gruf', '~> 2.18.0'
end
end

appraise 'gruf-2.18' do
gem 'gruf', '~> 2.18.0'
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.4')
appraise 'gruf-2.19' do
gem 'gruf', '~> 2.19.0'
end
end

appraise 'gruf-2.19' do
gem 'gruf', '~> 2.19.0'
appraise 'gruf-latest' do
gem 'gruf'
end

0 comments on commit 3584cfa

Please sign in to comment.