{"id":13879619,"url":"https://github.com/PigCI/pig-ci-rails","last_synced_at":"2025-07-16T15:32:42.463Z","repository":{"id":53491334,"uuid":"199334776","full_name":"PigCI/pig-ci-rails","owner":"PigCI","description":"Monitor your Ruby Applications metrics (Memory, SQL Requests \u0026 Request Time) as part of your test suite.","archived":true,"fork":false,"pushed_at":"2021-03-28T16:45:22.000Z","size":297,"stargazers_count":55,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-15T05:35:00.143Z","etag":null,"topics":["code-performance","gem","rspec","rspec-rails","ruby","ruby-applications-metrics","ruby-on-rails"],"latest_commit_sha":null,"homepage":"https://pigci.mikerogers.io/","language":"Ruby","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PigCI.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-28T20:37:52.000Z","updated_at":"2023-01-28T09:53:02.000Z","dependencies_parsed_at":"2022-08-19T22:11:01.101Z","dependency_job_id":null,"html_url":"https://github.com/PigCI/pig-ci-rails","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PigCI%2Fpig-ci-rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PigCI%2Fpig-ci-rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PigCI%2Fpig-ci-rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PigCI%2Fpig-ci-rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PigCI","download_url":"https://codeload.github.com/PigCI/pig-ci-rails/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226143895,"owners_count":17580245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-performance","gem","rspec","rspec-rails","ruby","ruby-applications-metrics","ruby-on-rails"],"created_at":"2024-08-06T08:02:26.974Z","updated_at":"2024-11-24T08:31:34.282Z","avatar_url":"https://github.com/PigCI.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  PigCI\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\nMonitor your Ruby Applications metrics (Memory, SQL Requests \u0026 Request Time) as part of your test suite. If your app exceeds an acceptable threshold it'll fail the test suite.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://badge.fury.io/rb/pig-ci-rails\"\u003e\n    \u003cimg src=\"https://badge.fury.io/rb/pig-ci-rails.svg\" alt=\"Gem Version\" style=\"max-width:100%;\"\u003e\n  \u003c/a\u003e\n  \u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/PigCI/pig-ci-rails/workflows/RSpec/badge.svg\"\u003e\n    \u003cimg src=\"https://github.com/PigCI/pig-ci-rails/workflows/RSpec/badge.svg\" alt=\"RSpec\" style=\"max-width:100%;\"\u003e\n  \u003c/a\u003e\n  \u003ca target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/PigCI/pig-ci-rails/workflows/Linters/badge.svg\"\u003e\n    \u003cimg src=\"https://github.com/PigCI/pig-ci-rails/workflows/Linters/badge.svg\" alt=\"Linters\" style=\"max-width:100%;\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\n## Deprecation notice\n\nThis gem is not longer actively maintained, I suggest using theses alternatives instead:\n\n- [TestProf](https://github.com/test-prof/test-prof)\n- [rack-mini-profiler](https://github.com/MiniProfiler/rack-mini-profiler)\n- [RSpec::Benchmark](https://github.com/piotrmurach/rspec-benchmark)\n\n## Sample Output\n\n![Sample Output of PigCI in TravisCI](https://user-images.githubusercontent.com/325384/78711087-545b6400-790e-11ea-96b7-bb75c119914a.png)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngroup :test do\n  gem 'pig-ci-rails'\nend\n```\n\nAnd then execute:\n\n```bash\n$ bundle\n```\n\nOr install it yourself as:\n\n```bash\n$ gem install pig-ci-rails\n```\n\n## Usage\n\n### On it's own\n\n```ruby\n# In spec/rails_helper.rb\nrequire 'pig_ci'\nPigCI.start\n```\n\n### Configuring thresholds\n\nConfiguring the thresholds will allow your test suite to fail in CI. You will need to configure the thresholds depending on your application.\n\n```ruby\n# In spec/rails_helper.rb\nrequire 'pig_ci'\nPigCI.start do |config|\n  # Maximum memory in megabytes\n  config.thresholds.memory = 350\n\n  # Maximum time per a HTTP request\n  config.thresholds.request_time = 250\n\n  # Maximum database calls per a request\n  config.thresholds.database_request = 35\nend if RSpec.configuration.files_to_run.count \u003e 1\n```\n\n### Configuring other options\n\nThis gems was setup to be configured by passing a block to the `PigCI.start` method, e.g:\n\n```ruby\n# In spec/rails_helper.rb\nrequire 'pig_ci'\nPigCI.start do |config|\n  config.option = 'new_value'\n\n  # E.g. disable terminal summary output\n  config.generate_terminal_summary = false\n\n  # Rails caches repeated SQL queries, you might want to omit these from your report.\n  config.ignore_cached_queries = true\nend # if RSpec.configuration.files_to_run.count \u003e 1\n```\n\nYou can see the full configuration options [lib/pig_ci.rb](https://github.com/PigCI/pig-ci-rails/blob/master/lib/pig_ci.rb#L21).\n\n### Skipping individual tests\n\nIf you have a scenario where you'd like PigCI to not log a specific test, you can add the RSpec metadata `pig_ci: true`. For example:\n\n```ruby\nRSpec.describe \"Comments\", type: :request do\n  # This test block will be not be tracked.\n  describe \"GET #index\", pig_ci: false do\n    it do\n      get comments_path\n      expect(response).to be_successful\n    end\n  end\nend\n```\n\n### Framework support\n\nCurrently this gem only supports Ruby on Rails tested via RSpec.\n\n### Metric notes\n\nMinor fluctuations in memory usage and request time are to be expected and are nothing to worry about. Though any large spike is a signal of something worth investigating.\n\n#### Memory\n\nBy default, this gem will tell Rails to eager load your application on startup. This aims to help identify leaks, over just pure bulk.\n\nYou can disable this functionality by setting your configuration to be:\n\n```ruby\nrequire 'pig_ci'\nPigCI.start do |config|\n  config.during_setup_eager_load_application = false\nend\n```\n\n#### Request Time\n\nOften the first request test will be slow, as rails is loading a full environment \u0026 rendering assets. To mitigate this issue, this gem will make a blank request to your application before your test suite starts \u0026 compiling assets.\n\nYou can disable this functionality by setting your configuration to be:\n\n```ruby\nrequire 'pig_ci'\nPigCI.start do |config|\n  config.during_setup_make_blank_application_request = false\n  config.during_setup_precompile_assets = false\nend\n```\n\n## Authors\n\n* This gem was made by [@MikeRogers0](https://github.com/MikeRogers0).\n* It was originally inspired by [oink](https://github.com/noahd1/oink), after it was used to [monitor acceptance tests](https://mikerogers.io/2015/03/28/monitor-rails-memory-usage-in-integration-tests.html) and it spotted a memory leak. It seemed like something that would be useful to have as part of CI.\n* The HTML output was inspired by [simplecov](https://github.com/colszowka/simplecov).\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at [PigCI/pig-ci-rails](https://github.com/PigCI/pig-ci-rails). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## Code of Conduct\n\nEveryone interacting in the PigCI project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/PigCI/pig-ci-rails/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPigCI%2Fpig-ci-rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPigCI%2Fpig-ci-rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPigCI%2Fpig-ci-rails/lists"}