You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

77 lines
1.8 KiB

  1. name: CI
  2. on:
  3. pull_request:
  4. push:
  5. branches: [ main ]
  6. jobs:
  7. scan_ruby:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Checkout code
  11. uses: actions/checkout@v4
  12. - name: Set up Ruby
  13. uses: ruby/setup-ruby@v1
  14. with:
  15. ruby-version: .ruby-version
  16. bundler-cache: true
  17. - name: Scan for common Rails security vulnerabilities using static analysis
  18. run: bin/brakeman --no-pager
  19. lint:
  20. runs-on: ubuntu-latest
  21. steps:
  22. - name: Checkout code
  23. uses: actions/checkout@v4
  24. - name: Set up Ruby
  25. uses: ruby/setup-ruby@v1
  26. with:
  27. ruby-version: .ruby-version
  28. bundler-cache: true
  29. - name: Lint code for consistent style
  30. run: bin/rubocop -f github
  31. test:
  32. runs-on: ubuntu-latest
  33. services:
  34. mysql:
  35. image: mysql
  36. env:
  37. MYSQL_ALLOW_EMPTY_PASSWORD: true
  38. ports:
  39. - 3306:3306
  40. options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
  41. # redis:
  42. # image: redis
  43. # ports:
  44. # - 6379:6379
  45. # options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
  46. steps:
  47. - name: Install packages
  48. run: sudo apt-get update && sudo apt-get install --no-install-recommends -y build-essential default-libmysqlclient-dev git libyaml-dev pkg-config
  49. - name: Checkout code
  50. uses: actions/checkout@v4
  51. - name: Set up Ruby
  52. uses: ruby/setup-ruby@v1
  53. with:
  54. ruby-version: .ruby-version
  55. bundler-cache: true
  56. - name: Run tests
  57. env:
  58. RAILS_ENV: test
  59. DATABASE_URL: mysql2://127.0.0.1:3306
  60. # REDIS_URL: redis://localhost:6379/0
  61. run: bin/rails db:test:prepare test