-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added workflow to add code coverage badge on readme
- Loading branch information
1 parent
99bf703
commit 5144d3a
Showing
2 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters