Skip to content

Commit

Permalink
Added workflow to add code coverage badge on readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwinisukale committed Nov 28, 2023
1 parent 99bf703 commit 5144d3a
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 2 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/code_coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Code Coverage

on:
push:
branches:
- "master"

jobs:
test-and-coverage:
runs-on: ubuntu-latest
services:
memcached:
image: memcached:1.4.31
ports:
- 11211/udp
env:
MEMCACHE_SERVERS: "localhost:11211"
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
SESSION_ENCRYPTED_COOKIE_SALT: ${{ secrets.SESSION_ENCRYPTED_COOKIE_SALT }}
JWT_PRIVATE_KEY: ${{ secrets.JWT_PRIVATE_KEY }}
JWT_PUBLIC_KEY: ${{ secrets.JWT_PUBLIC_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}

steps:
- uses: actions/checkout@v3
- name: Set up Ruby 2.6
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'
- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install
run: |
cp .env.build .env
gem install bundler
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Lint and Test
env:
MEMCACHE_SERVERS: "localhost:11211"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
STAFF_ADMIN_TOKEN: ${{ secrets.STAFF_ADMIN_TOKEN }}
STAFF_PROFILES_ADMIN_TOKEN: ${{ secrets.STAFF_PROFILES_ADMIN_TOKEN }}
run: |
bundle exec rspec
echo $?
- name: Generate Coverage Report
run: |
mkdir -p coverage
touch coverage/index.html
# Customize this based on your coverage setup
echo "Your coverage report content" > coverage/index.html
- name: Update README with Coverage Badge
run: |
echo "[![Code Coverage](coverage_badge_placeholder.svg)](coverage/index.html)" > coverage_badge.md
cat coverage_badge.md >> README.md
if: success()
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Message broker for Event Data Services

<!-- [![Identifier](https://img.shields.io/badge/doi-10.5438%2Ft1jg--hvhn-fca709.svg)](https://doi.org/10.5438/t1jg-hvhn) -->
[![Build Status](https://travis-ci.org/datacite/levriero.svg?branch=master)](https://travis-ci.org/datacite/levriero) [![Code Climate](https://codeclimate.com/github/datacite/levriero/badges/gpa.svg)](https://codeclimate.com/github/datacite/levriero) [![Test Coverage](https://codeclimate.com/github/datacite/levriero/badges/coverage.svg)](https://codeclimate.com/github/datacite/levriero/coverage)
[![Identifier](https://img.shields.io/badge/doi-10.5438%2Ft1jg--hvhn-fca709.svg)](https://doi.org/10.5438/t1jg-hvhn)
[![Build Status](https://github.com/datacite/levriero/actions/workflows/deploy.yml/badge.svg?branch=master)](https://github.com/datacite/levriero/actions/workflows/deploy.yml?branch=master)


Levriero runs agents for the Crossref/DataCite Event Data service.

Expand Down

0 comments on commit 5144d3a

Please sign in to comment.