petities/petitions.eu

View on GitHub
.github/workflows/ruby.yml

Summary

Maintainability
Test Coverage
name: Ruby

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  test:

    runs-on: ubuntu-latest

    services:
      db:
        image: mariadb:10.5
        ports:
          - 3306
        env:
          MYSQL_ALLOW_EMPTY_PASSWORD: yes
        options: >-
          --health-cmd="mysqladmin ping"
          --health-interval=10s
          --health-timeout=5s
          --health-retries=3
      redis:
        image: redis:5.0-alpine
        ports:
          - 6379:6379
        options: >-
          --health-cmd "redis-cli ping"
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5

    steps:
    - uses: actions/checkout@v4

    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        bundler-cache: true

    - name: Run tests
      env:
        DATABASE_URL: mysql2://root@127.0.0.1:${{ job.services.db.ports[3306] }}/petities_test
        RAILS_ENV: test
      run: |
        bundle exec rake db:setup
        bundle exec cap test # to test capistrano syntax
        bundle exec rake