Skip to content

Add tests and address #31 #2

Add tests and address #31

Add tests and address #31 #2

Workflow file for this run

name: Ruby CI
on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.3.1']
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Install dependencies
run: bundle install
- name: Run tests
run: bundle exec rspec
- name: Upload coverage results
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: coverage
retention-days: 7
- name: Check test coverage
run: |
COVERAGE=$(grep -A 2 "Coverage" coverage/.last_run.json | tail -n 1 | cut -d ":" -f 2 | cut -d "}" -f 1 | tr -d " ")
echo "Coverage: $COVERAGE%"
if (( $(echo "$COVERAGE < 90" | bc -l) )); then
echo "Test coverage is below 90%"
exit 1
fi