2025-07-15 11:02:58 -04:00
|
|
|
name: Run Tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
runs-on: docker
|
|
|
|
container:
|
|
|
|
image: ruby:3.3-alpine
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: ./app
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Install system dependencies
|
|
|
|
run: |
|
2025-07-15 11:18:12 -04:00
|
|
|
apk add --no-cache build-base libffi-dev linux-headers postgresql-dev git curl tzdata nodejs npm
|
2025-07-15 11:02:58 -04:00
|
|
|
|
|
|
|
- name: Install bundler
|
|
|
|
run: gem install bundler -v 2.6.7
|
|
|
|
|
|
|
|
- name: Cache Ruby gems
|
|
|
|
uses: actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: app/vendor/bundle
|
|
|
|
key: ${{ runner.os }}-gems-${{ hashFiles('app/Gemfile.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-gems-
|
|
|
|
|
|
|
|
- name: Install Ruby dependencies
|
|
|
|
run: |
|
|
|
|
bundle config path vendor/bundle
|
|
|
|
bundle install --jobs 4 --retry 3
|
|
|
|
|
|
|
|
- name: Run unit tests
|
|
|
|
run: |
|
|
|
|
echo "🧪 Running unit tests..."
|
|
|
|
bundle exec rspec spec/unit/ --format documentation
|
|
|
|
|
|
|
|
- name: Run integration tests
|
|
|
|
run: |
|
|
|
|
echo "🧪 Running integration tests..."
|
|
|
|
bundle exec rspec spec/integration/ --format documentation
|
|
|
|
|
|
|
|
- name: Generate coverage report
|
|
|
|
run: |
|
|
|
|
echo "📊 Generating coverage report..."
|
|
|
|
COVERAGE=true bundle exec rspec --format progress
|
|
|
|
|
|
|
|
- name: Upload coverage results
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
if: always()
|
|
|
|
with:
|
|
|
|
name: coverage-report
|
|
|
|
path: app/coverage/
|