Skip to content

Commit

Permalink
CI: Add a GC.stress run to our CI
Browse files Browse the repository at this point in the history
  • Loading branch information
larskanis committed Apr 1, 2024
1 parent 24143c4 commit 15ece3b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,29 @@ jobs:
env:
ITER: 10

gc_stress:
if: github.ref == 'refs/heads/master'
strategy:
fail-fast: false
matrix:
os: [ ubuntu ]
ruby: [ ruby-head ]
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}

- run: bundle install
- run: bundle exec rake libffi
- name: Play dice if we run the tests or don't
id: run_it
run: ruby -e "puts 'RUN_IT=true' if rand < 0.1" >> $GITHUB_OUTPUT
- name: Run all tests with GC.stress=true
if: steps.run_it.outputs.RUN_IT == 'true'
run: bundle exec rake compile test FFI_GC_STRESS=true

rcd_build:
name: build fat binary gems

Expand Down
11 changes: 11 additions & 0 deletions spec/ffi/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,14 @@ module OrderHelper
raise
end
end

if ENV['FFI_GC_STRESS'] == 'true'
RSpec.configure do |config|
config.before :each do
GC.stress=true
end
config.after :each do
GC.stress=false
end
end
end

0 comments on commit 15ece3b

Please sign in to comment.