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.

141 lines
3.2 KiB

  1. name: Ruby Testing
  2. on:
  3. push:
  4. branches-ignore:
  5. - 'dependabot/**'
  6. pull_request:
  7. env:
  8. BUNDLE_CLEAN: true
  9. BUNDLE_FROZEN: true
  10. BUNDLE_WITHOUT: 'development production'
  11. concurrency:
  12. group: ${{ github.workflow }}-${{ github.ref }}
  13. cancel-in-progress: true
  14. jobs:
  15. build:
  16. runs-on: ubuntu-latest
  17. env:
  18. RAILS_ENV: test
  19. steps:
  20. - uses: actions/checkout@v3
  21. - name: Set up Node.js
  22. uses: actions/setup-node@v3
  23. with:
  24. cache: yarn
  25. node-version-file: '.nvmrc'
  26. - name: Install native Ruby dependencies
  27. run: sudo apt-get install -y libicu-dev libidn11-dev
  28. - name: Set up bundler cache
  29. uses: ruby/setup-ruby@v1
  30. with:
  31. ruby-version: .ruby-version
  32. bundler-cache: true
  33. - run: yarn --frozen-lockfile --production
  34. - name: Precompile assets
  35. # Previously had set this, but it's not supported
  36. # export NODE_OPTIONS=--openssl-legacy-provider
  37. run: |-
  38. ./bin/rails assets:precompile
  39. - uses: actions/upload-artifact@v3
  40. with:
  41. path: |-
  42. ./public/assets
  43. ./public/packs-test
  44. name: ${{ github.sha }}
  45. retention-days: 0
  46. test:
  47. runs-on: ubuntu-latest
  48. needs:
  49. - build
  50. services:
  51. postgres:
  52. image: postgres:14-alpine
  53. env:
  54. POSTGRES_PASSWORD: postgres
  55. POSTGRES_USER: postgres
  56. options: >-
  57. --health-cmd pg_isready
  58. --health-interval 10s
  59. --health-timeout 5s
  60. --health-retries 5
  61. ports:
  62. - 5432:5432
  63. redis:
  64. image: redis:7-alpine
  65. options: >-
  66. --health-cmd "redis-cli ping"
  67. --health-interval 10s
  68. --health-timeout 5s
  69. --health-retries 5
  70. ports:
  71. - 6379:6379
  72. env:
  73. DB_HOST: localhost
  74. DB_USER: postgres
  75. DB_PASS: postgres
  76. DISABLE_SIMPLECOV: true
  77. RAILS_ENV: test
  78. ALLOW_NOPAM: true
  79. PAM_ENABLED: true
  80. PAM_DEFAULT_SERVICE: pam_test
  81. PAM_CONTROLLED_SERVICE: pam_test_controlled
  82. BUNDLE_WITH: 'pam_authentication'
  83. CI_JOBS: ${{ matrix.ci_job }}/4
  84. strategy:
  85. fail-fast: false
  86. matrix:
  87. ruby-version:
  88. - '2.7'
  89. - '3.0'
  90. - '3.1'
  91. - '.ruby-version'
  92. ci_job:
  93. - 1
  94. - 2
  95. - 3
  96. - 4
  97. steps:
  98. - uses: actions/checkout@v3
  99. - uses: actions/download-artifact@v3
  100. with:
  101. path: './public'
  102. name: ${{ github.sha }}
  103. - name: Install native Ruby dependencies
  104. run: sudo apt-get install -y libicu-dev libidn11-dev
  105. - name: Install additional system dependencies
  106. run: sudo apt-get install -y ffmpeg imagemagick libpam-dev
  107. - name: Set up bundler cache
  108. uses: ruby/setup-ruby@v1
  109. with:
  110. ruby-version: ${{ matrix.ruby-version}}
  111. bundler-cache: true
  112. - name: Update system gems
  113. if: matrix.ruby-version == '2.7'
  114. run: gem update --system
  115. - name: Load database schema
  116. run: './bin/rails db:create db:schema:load db:seed'
  117. - run: bundle exec rake rspec_chunked