Skip to content
This repository was archived by the owner on Jul 15, 2025. It is now read-only.

LIBAAEC-56 Add dependabot.yml to trigger dependabot scans weekly #114

LIBAAEC-56 Add dependabot.yml to trigger dependabot scans weekly

LIBAAEC-56 Add dependabot.yml to trigger dependabot scans weekly #114

name: Tests & Coverage
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby and Gems
uses: ./.github/actions/setup-ruby-deps
- name: Run Database Migrations
uses: ./.github/actions/migrate
- name: Run Tests with SimpleCov
run: |
bundle exec rspec --format progress --format RspecJunitFormatter --out /tmp/test-results/rspec.xml
- name: Upload Coverage Artifact
if: success()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/
coverage:
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby and Gems
uses: ./.github/actions/setup-ruby-deps
- name: Run Database Migrations
uses: ./.github/actions/migrate
- name: Download Coverage Artifact
uses: actions/download-artifact@v4
with:
name: coverage-report
path: coverage/
- name: Coverage Check
shell: bash
run: |
# Extract the coverage percentage from index.html
COVERAGE=$(grep -oE '[0-9]+\.[0-9]+%' coverage/index.html | head -n1 | tr -d '%')
echo "Current coverage: $COVERAGE"
BASELINE=$( [ -f coverage/coverage_baseline.txt ] && cat coverage/coverage_baseline.txt || echo 0 )
echo "Baseline coverage: $BASELINE"
if (( $(echo "$COVERAGE < $BASELINE" | bc -l) )); then
echo "Coverage dropped below baseline."
exit 1
fi
if (( $(echo "$COVERAGE > $BASELINE" | bc -l) )); then
echo "$COVERAGE" > coverage/coverage_baseline.txt
git add -f coverage/coverage_baseline.txt
git config user.name "ci-bot"
git config user.email "[email protected]"
git commit -m "Update coverage baseline" || true
git push || true
fi