test-ruby.yml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  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. - '3.0'
  105. - '3.1'
  106. - '.ruby-version'
  107. ci_job:
  108. - 1
  109. - 2
  110. - 3
  111. - 4
  112. steps:
  113. - uses: actions/checkout@v4
  114. - uses: actions/download-artifact@v3
  115. with:
  116. path: './public'
  117. name: ${{ github.sha }}
  118. - name: Update package index
  119. run: sudo apt-get update
  120. - name: Install native Ruby dependencies
  121. run: sudo apt-get install -y libicu-dev libidn11-dev
  122. - name: Install additional system dependencies
  123. run: sudo apt-get install -y ffmpeg imagemagick libpam-dev
  124. - name: Set up bundler cache
  125. uses: ruby/setup-ruby@v1
  126. with:
  127. ruby-version: ${{ matrix.ruby-version}}
  128. bundler-cache: true
  129. - name: Load database schema
  130. run: './bin/rails db:create db:schema:load db:seed'
  131. - run: bundle exec rake rspec_chunked
  132. test-e2e:
  133. name: End to End testing
  134. runs-on: ubuntu-latest
  135. needs:
  136. - build
  137. services:
  138. postgres:
  139. image: postgres:14-alpine
  140. env:
  141. POSTGRES_PASSWORD: postgres
  142. POSTGRES_USER: postgres
  143. options: >-
  144. --health-cmd pg_isready
  145. --health-interval 10s
  146. --health-timeout 5s
  147. --health-retries 5
  148. ports:
  149. - 5432:5432
  150. redis:
  151. image: redis:7-alpine
  152. options: >-
  153. --health-cmd "redis-cli ping"
  154. --health-interval 10s
  155. --health-timeout 5s
  156. --health-retries 5
  157. ports:
  158. - 6379:6379
  159. env:
  160. DB_HOST: localhost
  161. DB_USER: postgres
  162. DB_PASS: postgres
  163. DISABLE_SIMPLECOV: true
  164. RAILS_ENV: test
  165. BUNDLE_WITH: test
  166. strategy:
  167. fail-fast: false
  168. matrix:
  169. ruby-version:
  170. - '3.0'
  171. - '3.1'
  172. - '.ruby-version'
  173. steps:
  174. - uses: actions/checkout@v4
  175. - uses: actions/download-artifact@v3
  176. with:
  177. path: './public'
  178. name: ${{ github.sha }}
  179. - name: Update package index
  180. run: sudo apt-get update
  181. - name: Set up Node.js
  182. uses: actions/setup-node@v3
  183. with:
  184. cache: yarn
  185. node-version-file: '.nvmrc'
  186. - name: Install native Ruby dependencies
  187. run: sudo apt-get install -y libicu-dev libidn11-dev
  188. - name: Install additional system dependencies
  189. run: sudo apt-get install -y ffmpeg imagemagick
  190. - name: Set up bundler cache
  191. uses: ruby/setup-ruby@v1
  192. with:
  193. ruby-version: ${{ matrix.ruby-version}}
  194. bundler-cache: true
  195. - run: yarn --frozen-lockfile
  196. - name: Load database schema
  197. run: './bin/rails db:create db:schema:load db:seed'
  198. - run: bundle exec rake spec:system
  199. - name: Archive logs
  200. uses: actions/upload-artifact@v3
  201. if: failure()
  202. with:
  203. name: e2e-logs-${{ matrix.ruby-version }}
  204. path: log/
  205. - name: Archive test screenshots
  206. uses: actions/upload-artifact@v3
  207. if: failure()
  208. with:
  209. name: e2e-screenshots
  210. path: tmp/screenshots/
  211. test-search:
  212. name: Testing search
  213. runs-on: ubuntu-latest
  214. needs:
  215. - build
  216. services:
  217. postgres:
  218. image: postgres:14-alpine
  219. env:
  220. POSTGRES_PASSWORD: postgres
  221. POSTGRES_USER: postgres
  222. options: >-
  223. --health-cmd pg_isready
  224. --health-interval 10s
  225. --health-timeout 5s
  226. --health-retries 5
  227. ports:
  228. - 5432:5432
  229. redis:
  230. image: redis:7-alpine
  231. options: >-
  232. --health-cmd "redis-cli ping"
  233. --health-interval 10s
  234. --health-timeout 5s
  235. --health-retries 5
  236. ports:
  237. - 6379:6379
  238. elasticsearch:
  239. image: docker.elastic.co/elasticsearch/elasticsearch:7.17.13
  240. env:
  241. discovery.type: single-node
  242. xpack.security.enabled: false
  243. options: >-
  244. --health-cmd "curl http://localhost:9200/_cluster/health"
  245. --health-interval 10s
  246. --health-timeout 5s
  247. --health-retries 10
  248. ports:
  249. - 9200:9200
  250. env:
  251. DB_HOST: localhost
  252. DB_USER: postgres
  253. DB_PASS: postgres
  254. DISABLE_SIMPLECOV: true
  255. RAILS_ENV: test
  256. BUNDLE_WITH: test
  257. ES_ENABLED: true
  258. ES_HOST: localhost
  259. ES_PORT: 9200
  260. strategy:
  261. fail-fast: false
  262. matrix:
  263. ruby-version:
  264. - '3.0'
  265. - '3.1'
  266. - '.ruby-version'
  267. steps:
  268. - uses: actions/checkout@v4
  269. - uses: actions/download-artifact@v3
  270. with:
  271. path: './public'
  272. name: ${{ github.sha }}
  273. - name: Update package index
  274. run: sudo apt-get update
  275. - name: Set up Node.js
  276. uses: actions/setup-node@v3
  277. with:
  278. cache: yarn
  279. node-version-file: '.nvmrc'
  280. - name: Install native Ruby dependencies
  281. run: sudo apt-get install -y libicu-dev libidn11-dev
  282. - name: Install additional system dependencies
  283. run: sudo apt-get install -y ffmpeg imagemagick
  284. - name: Set up bundler cache
  285. uses: ruby/setup-ruby@v1
  286. with:
  287. ruby-version: ${{ matrix.ruby-version}}
  288. bundler-cache: true
  289. - run: yarn --frozen-lockfile
  290. - name: Load database schema
  291. run: './bin/rails db:create db:schema:load db:seed'
  292. - run: bundle exec rake spec:search
  293. - name: Archive logs
  294. uses: actions/upload-artifact@v3
  295. if: failure()
  296. with:
  297. name: test-search-logs-${{ matrix.ruby-version }}
  298. path: log/
  299. - name: Archive test screenshots
  300. uses: actions/upload-artifact@v3
  301. if: failure()
  302. with:
  303. name: test-search-screenshots
  304. path: tmp/screenshots/