From 9a61df1ca00a258c6ad499575a317bd9a031c9ca Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 14 May 2024 15:32:04 -0400 Subject: [PATCH] Run flatware on CI --- .github/workflows/test-ruby.yml | 8 +++++--- spec/flatware_helper.rb | 12 ++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 spec/flatware_helper.rb diff --git a/.github/workflows/test-ruby.yml b/.github/workflows/test-ruby.yml index dd71fd253b..ef898968d0 100644 --- a/.github/workflows/test-ruby.yml +++ b/.github/workflows/test-ruby.yml @@ -132,15 +132,17 @@ jobs: additional-system-dependencies: ffmpeg libpam-dev - name: Load database schema - run: './bin/rails db:create db:schema:load db:seed' + run: | + bin/rails db:setup + bin/flatware fan bin/rails db:test:prepare - - run: bin/rspec + - run: bin/flatware rspec -r ./spec/flatware_helper.rb - name: Upload coverage reports to Codecov if: matrix.ruby-version == '.ruby-version' uses: codecov/codecov-action@v4 with: - files: coverage/lcov/mastodon.lcov + files: coverage/lcov/*.lcov env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/spec/flatware_helper.rb b/spec/flatware_helper.rb new file mode 100644 index 0000000000..57a7c1f56a --- /dev/null +++ b/spec/flatware_helper.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +if defined?(Flatware) + Flatware.configure do |config| + config.after_fork do |test_env_number| + unless ENV.fetch('DISABLE_SIMPLECOV', nil) == 'true' + require 'simplecov' + SimpleCov.at_fork.call(test_env_number) # Combines parallel coverage results + end + end + end +end