Recently, I'm using GitHub Actions as a CI / CD service, but I was dissatisfied with the fact that it was difficult to understand the execution result when RSpec failed when compared with CircleCI. Introducing the following GitHub Action created by an in-house hackathon to relieve such stress.
RSpec Report · Actions · GitHub Marketplace · GitHub
In the case of a PR event, the failure result is commented. Also, by commenting, the same content will be notified by email, so you can understand the content of the failed test without accessing GitHub.
Other than PR events, you will be notified via the Checks API.
test.yml
name: Build
on:
pull_request:
jobs:
rspec:
steps:
#Preparations for RSpec execution are omitted
- name: Test
run: bundle exec rspec -f j -o tmp/rspec_results.json -f p
- name: RSpec Report
uses: SonicGarden/rspec-report-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
json-path: tmp/rspec_results.json
if: always()
--Analyzing and commenting on the execution result of RSpec output in JSON format
--The -f j -o tmp / rspec_results.json
option of the rspec
command is required (save destination is arbitrary)
--Comments will be deleted if all tests pass
--The same comment will not be posted repeatedly
--Supports parallel execution of tests
--In that case, please adjust so that the title is unique as follows.
with:
token: ${{ secrets.GITHUB_TOKEN }}
json-path: tmp/rspec_results.json
title: "# :cold_sweat: RSpec failure ${{ matrix.ci_node_index }}"
GitHub - SonicGarden/rspec-report-action: A GitHub Action that report RSpec failure.
Please use it if you like.
Recommended Posts