2020 transporter :
2121 type : string
2222 mongodb-version :
23- default : " ['5.0', ' 8.2']"
23+ default : " ['8.2']"
2424 required : false
2525 type : string
2626 release :
4141 type :
4242 required : true
4343 type : string
44+ coverage :
45+ required : false
46+ type : string
4447 db-watcher-disabled :
4548 default : ' true'
4649 required : false
6669 TOOL_NODE_FLAGS : ${{ vars.TOOL_NODE_FLAGS }}
6770 LOWERCASE_REPOSITORY : ${{ inputs.lowercase-repo }}
6871 DOCKER_TAG : ${{ inputs.gh-docker-tag }}
69- DOCKER_TAG_SUFFIX_ROCKETCHAT : ' -cov'
7072
7173jobs :
7274 test :
7375 runs-on : ubuntu-24.04
7476
77+ env :
78+ # if building for production on develop branch or release, add suffix for coverage images
79+ DOCKER_TAG_SUFFIX_ROCKETCHAT : ${{ inputs.coverage == matrix.mongodb-version && (github.event_name == 'release' || github.ref == 'refs/heads/develop') && '-cov' || '' }}
80+ MONGODB_VERSION : ${{ matrix.mongodb-version }}
81+
7582 strategy :
7683 fail-fast : false
7784 matrix :
@@ -105,13 +112,6 @@ jobs:
105112 username : ${{ secrets.CR_USER }}
106113 password : ${{ secrets.CR_PAT }}
107114
108- - name : Launch MongoDB
109- uses : supercharge/mongodb-github-action@1.12.0
110- with :
111- mongodb-image : mongodb/mongodb-community-server
112- mongodb-version : ${{ matrix.mongodb-version }}-ubi8
113- mongodb-replica-set : rs0
114-
115115 - uses : actions/checkout@v5
116116
117117 - name : Setup NodeJS
@@ -142,12 +142,9 @@ jobs:
142142 with :
143143 CR_USER : ${{ secrets.CR_USER }}
144144 CR_PAT : ${{ secrets.CR_PAT }}
145- node-version : ${{ inputs.node-version }}
146145 # the same reason we need to rebuild the docker image at this point is the reason we dont want to publish it
147146 publish-image : false
148- setup : false
149147 service : ' rocketchat'
150- NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
151148
152149 - name : Set DEBUG_LOG_LEVEL (debug enabled)
153150 if : runner.debug == '1'
@@ -156,58 +153,34 @@ jobs:
156153 - name : Start httpbin container and wait for it to be ready
157154 if : inputs.type == 'api'
158155 run : |
159- docker run -d -p 10000:80 --name httpbin-container kennethreitz/httpbin
160- i=0
161- while [ $i -lt 10 ]; do
162- if curl -s -o /dev/null http://localhost:10000; then
163- echo "httpbin is running"
164- break
165- fi
166- i=$((i + 1))
167- sleep 5
168- done
169- if [ $i -eq 10 ]; then
170- echo "Failed to verify httpbin is running"
171- exit 1
172- fi
156+ docker compose -f docker-compose-ci.yml up -d httpbin
173157
174158 - name : Prepare code coverage directory
175- if : inputs.release == 'ee'
159+ if : inputs.coverage == matrix.mongodb-version
176160 run : |
177161 mkdir -p /tmp/coverage
178162 chmod 777 /tmp/coverage
179163
180164 - name : Start containers for CE
181165 if : inputs.release == 'ce'
182- env :
183- MONGO_URL : ' mongodb://host.docker.internal:27017/rocketchat?replicaSet=rs0&directConnection=true'
184166 run : |
185167 # when we are testing CE, we only need to start the rocketchat container
186- DEBUG_LOG_LEVEL=${DEBUG_LOG_LEVEL:-0} docker compose -f docker-compose-ci.yml up -d rocketchat
168+ DEBUG_LOG_LEVEL=${DEBUG_LOG_LEVEL:-0} docker compose -f docker-compose-ci.yml up -d rocketchat --wait
187169
188170 - name : Start containers for EE
189171 if : inputs.release == 'ee'
190172 env :
191- MONGO_URL : ' mongodb://host.docker.internal:27017/rocketchat?replicaSet=rs0&directConnection=true'
192173 ENTERPRISE_LICENSE : ${{ inputs.enterprise-license }}
193174 TRANSPORTER : ${{ inputs.transporter }}
194175 COVERAGE_DIR : ' /tmp/coverage'
195176 COVERAGE_REPORTER : ' lcov'
196177 DISABLE_DB_WATCHERS : ${{ inputs.db-watcher-disabled }}
197178 run : |
198- DEBUG_LOG_LEVEL=${DEBUG_LOG_LEVEL:-0} docker compose -f docker-compose-ci.yml up -d
179+ DEBUG_LOG_LEVEL=${DEBUG_LOG_LEVEL:-0} docker compose -f docker-compose-ci.yml up -d --wait
199180
200181 - uses : ./.github/actions/setup-playwright
201182 if : inputs.type == 'ui'
202183
203- - name : Wait for Rocket.Chat to start up
204- uses : cygnetdigital/wait_for_response@v2.0.0
205- with :
206- url : ' http://localhost:3000/health'
207- responseCode : ' 200'
208- timeout : 60000
209- interval : 1000
210-
211184 - name : Wait services to start up
212185 if : inputs.release == 'ee'
213186 run : |
@@ -226,30 +199,15 @@ jobs:
226199 if : inputs.type == 'api'
227200 working-directory : ./apps/meteor
228201 env :
229- WEBHOOK_TEST_URL : ' http://host.docker.internal:10000 '
202+ WEBHOOK_TEST_URL : ' http://httpbin '
230203 IS_EE : ${{ inputs.release == 'ee' && 'true' || '' }}
231204 COVERAGE_DIR : ' /tmp/coverage'
232205 COVERAGE_REPORTER : ' lcovonly'
233206 run : |
234- for i in $(seq 1 2); do
235- npm run testapi && s=0 && break || s=$?
236-
237- docker compose -f ../../docker-compose-ci.yml logs --tail=100
238-
239- docker compose -f ../../docker-compose-ci.yml stop
207+ set -o xtrace
240208
241- docker exec mongodb bash -c 'if command -v mongosh ; then mongosh --eval "use rocketchat" --eval "db.dropDatabase()" rocketchat; else mongo rocketchat --eval "db.dropDatabase()"; fi'
209+ npm run testapi
242210
243- NOW=$(date "+%Y-%m-%dT%H:%M:%S.000Z")
244-
245- docker compose -f ../../docker-compose-ci.yml restart
246-
247- until echo "$(docker compose -f ../../docker-compose-ci.yml logs rocketchat --since $NOW)" | grep -q "SERVER RUNNING"; do
248- echo "Waiting Rocket.Chat to start up"
249- ((c++)) && ((c==10)) && exit 1
250- sleep 10
251- done;
252- done;
253211 docker compose -f ../../docker-compose-ci.yml stop
254212
255213 ls -l $COVERAGE_DIR
@@ -258,7 +216,7 @@ jobs:
258216 - name : E2E Test UI (${{ matrix.shard }}/${{ inputs.total-shard }})
259217 if : inputs.type == 'ui'
260218 env :
261- E2E_COVERAGE : ${{ inputs.release == 'ee' && 'true' || '' }}
219+ E2E_COVERAGE : ${{ inputs.coverage == matrix.mongodb-version && 'true' || '' }}
262220 IS_EE : ${{ inputs.release == 'ee' && 'true' || '' }}
263221 REPORTER_ROCKETCHAT_API_KEY : ${{ secrets.REPORTER_ROCKETCHAT_API_KEY }}
264222 REPORTER_ROCKETCHAT_URL : ${{ secrets.REPORTER_ROCKETCHAT_URL }}
@@ -289,28 +247,28 @@ jobs:
289247 include-hidden-files : true
290248
291249 - name : Show server logs if E2E test failed
292- if : failure() && inputs.release == 'ee'
293- run : docker compose -f docker-compose-ci.yml logs
250+ if : failure()
251+ run : docker compose -f docker-compose-ci.yml logs rocketchat authorization-service queue-worker-service ddp-streamer-service account-service presence-service stream-hub-service omnichannel-transcript-service
294252
295- - name : Show server logs if E2E test failed
296- if : failure() && inputs.release != 'ee'
297- run : docker compose -f docker-compose-ci.yml logs rocketchat
253+ - name : Show mongo logs if E2E test failed
254+ if : failure()
255+ run : docker compose -f docker-compose-ci.yml logs mongo
298256
299257 - name : Extract e2e:ee:coverage
300- if : inputs.type == 'ui' && inputs.release == 'ee '
258+ if : inputs.coverage == matrix.mongodb-version && inputs.type == 'ui '
301259 working-directory : ./apps/meteor
302260 run : yarn test:e2e:nyc
303261
304262 - uses : codecov/codecov-action@v3
305- if : inputs.type == 'ui' && inputs.release == 'ee '
263+ if : inputs.coverage == matrix.mongodb-version && inputs.type == 'ui '
306264 with :
307265 directory : ./apps/meteor
308266 flags : e2e
309267 verbose : true
310268 token : ${{ secrets.CODECOV_TOKEN }}
311269
312270 - uses : codecov/codecov-action@v3
313- if : inputs.type == 'api' && inputs.release == 'ee '
271+ if : inputs.coverage == matrix.mongodb-version && inputs.type == 'api '
314272 with :
315273 directory : /tmp/coverage
316274 working-directory : .
@@ -319,15 +277,15 @@ jobs:
319277 token : ${{ secrets.CODECOV_TOKEN }}
320278
321279 - name : Store e2e-api-ee-coverage
322- if : inputs.type == 'api' && inputs.release == 'ee '
280+ if : inputs.coverage == matrix.mongodb-version && inputs.type == 'api '
323281 uses : actions/upload-artifact@v4
324282 with :
325283 name : e2e-api-ee-coverage-${{ matrix.mongodb-version }}-${{ matrix.shard }}
326284 path : /tmp/coverage
327285 include-hidden-files : true
328286
329287 - name : Store e2e-ee-coverage
330- if : inputs.type == 'ui' && inputs.release == 'ee '
288+ if : inputs.coverage == matrix.mongodb-version && inputs.type == 'ui '
331289 uses : actions/upload-artifact@v4
332290 with :
333291 name : e2e-ee-coverage-${{ matrix.mongodb-version }}-${{ matrix.shard }}
0 commit comments