Skip to content

Commit 5144d3a

Browse files
committed
Added workflow to add code coverage badge on readme
1 parent 99bf703 commit 5144d3a

File tree

2 files changed

+65
-2
lines changed

2 files changed

+65
-2
lines changed

.github/workflows/code_coverage.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Code Coverage
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
8+
jobs:
9+
test-and-coverage:
10+
runs-on: ubuntu-latest
11+
services:
12+
memcached:
13+
image: memcached:1.4.31
14+
ports:
15+
- 11211/udp
16+
env:
17+
MEMCACHE_SERVERS: "localhost:11211"
18+
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
19+
SESSION_ENCRYPTED_COOKIE_SALT: ${{ secrets.SESSION_ENCRYPTED_COOKIE_SALT }}
20+
JWT_PRIVATE_KEY: ${{ secrets.JWT_PRIVATE_KEY }}
21+
JWT_PUBLIC_KEY: ${{ secrets.JWT_PUBLIC_KEY }}
22+
AWS_REGION: ${{ secrets.AWS_REGION }}
23+
24+
steps:
25+
- uses: actions/checkout@v3
26+
- name: Set up Ruby 2.6
27+
uses: ruby/setup-ruby@v1
28+
with:
29+
ruby-version: '2.6'
30+
- uses: actions/cache@v3
31+
with:
32+
path: vendor/bundle
33+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
34+
restore-keys: |
35+
${{ runner.os }}-gems-
36+
- name: Install
37+
run: |
38+
cp .env.build .env
39+
gem install bundler
40+
bundle config path vendor/bundle
41+
bundle install --jobs 4 --retry 3
42+
- name: Lint and Test
43+
env:
44+
MEMCACHE_SERVERS: "localhost:11211"
45+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
46+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
47+
STAFF_ADMIN_TOKEN: ${{ secrets.STAFF_ADMIN_TOKEN }}
48+
STAFF_PROFILES_ADMIN_TOKEN: ${{ secrets.STAFF_PROFILES_ADMIN_TOKEN }}
49+
run: |
50+
bundle exec rspec
51+
echo $?
52+
- name: Generate Coverage Report
53+
run: |
54+
mkdir -p coverage
55+
touch coverage/index.html
56+
# Customize this based on your coverage setup
57+
echo "Your coverage report content" > coverage/index.html
58+
- name: Update README with Coverage Badge
59+
run: |
60+
echo "[![Code Coverage](coverage_badge_placeholder.svg)](coverage/index.html)" > coverage_badge.md
61+
cat coverage_badge.md >> README.md
62+
if: success()

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Message broker for Event Data Services
22

3-
<!-- [![Identifier](https://img.shields.io/badge/doi-10.5438%2Ft1jg--hvhn-fca709.svg)](https://doi.org/10.5438/t1jg-hvhn) -->
4-
[![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)
3+
[![Identifier](https://img.shields.io/badge/doi-10.5438%2Ft1jg--hvhn-fca709.svg)](https://doi.org/10.5438/t1jg-hvhn)
4+
[![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)
5+
56

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

0 commit comments

Comments
 (0)