test-ruby.yml 3.5 KB

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