Home / Companies / Semaphore / Blog / August 2017

August 2017 Summaries

4 posts from Semaphore

Filter
Month: Year:
Post Summaries Back to Blog
Semaphore has introduced a new feature that enhances control over build queues by allowing users to configure a cancellation strategy that ignores the default branch. This update addresses the need for continuous integration (CI) efficiency by enabling the cancellation of ongoing builds in favor of newer code pushes, while still preserving the integrity of the default branch, typically the master branch, where all builds are verified before deployment. This flexibility allows for rapid development on feature branches without compromising the thoroughness required for production deployment. Users can configure these settings in the Branches tab of their project settings, ensuring a balance between speed and reliability in their CI workflows.
Aug 31, 2017 177 words in the original blog post.
In Ruby on Rails, polymorphic associations enable a model to be connected to multiple other models through a single association, as demonstrated with a Review model linked to both Event and Restaurant models. This setup uses a generic entity called Reviewable, facilitated by two database columns, reviewable_id and reviewable_type, which store the ID and type of the associated entity. The article details the implementation process, including creating a migration to alter the database schema and setting up the association in the Review model. It also involves creating a shared spec example and a concern called Reviewable to abstract the has_many side, which is included in the Event and Restaurant models. The article concludes by demonstrating the functionality with instantiated objects, showcasing the utility of polymorphic associations, and highlighting Semaphore's tools for improving continuous integration in Rails projects.
Aug 16, 2017 1,014 words in the original blog post.
Rails, often criticized for scalability issues, remains a backbone for many businesses, from startups to large platforms, due to its ease of learning and robust framework. The article explores common scalability issues, specifically the N+1 query problem, which arises when an application performs an excessive number of database queries, leading to poor performance as data scales. It suggests using Rails' eager loading feature to optimize database queries by reducing the number of independent queries, demonstrated through examples that show a significant performance improvement. The article also recommends the use of the Bullet gem to automatically detect and report inefficient queries, thereby preventing N+1 queries from slipping into production code. For larger projects with existing slow queries, it advises a gradual approach to optimizing performance by blacklisting problematic queries and focusing on clean code. The discussion extends to strategies for preventing performance issues and highlights Semaphore's continuous integration tools, which aim to streamline and accelerate testing processes.
Aug 09, 2017 1,237 words in the original blog post.
Flaky tests are a common and frustrating issue in software development, particularly affecting productivity and reliability in testing processes. Drawing from a year's experience with a Rails application, the article delves into specific sources of test flakiness, including FactoryGirl, timestamps, external network requests, and Ajax. It highlights how FactoryGirl can lead to incidental database states, timestamps can be affected by varying execution speeds across different environments, and external requests can fail due to service issues beyond a developer's control. Ajax-related flakiness is addressed with strategies for ensuring asynchronous requests complete before tests proceed. The article advocates for tools like Timecop for handling timestamps and VCR for stubbing external requests, while emphasizing the importance of understanding underlying code and frameworks to mitigate flakiness. It also recommends reading additional resources on handling flaky tests, suggesting that their maintenance should be integrated into regular development routines. The discussion encourages sharing experiences and solutions, emphasizing continuous learning and adaptation in tackling flaky tests, and introduces Semaphore Boosters, a tool designed to optimize test parallelization and reduce runtime in Rails applications.
Aug 03, 2017 1,134 words in the original blog post.