-
Notifications
You must be signed in to change notification settings - Fork 13.1k
chore(ci): reduce number of parallel jobs and improve container builds #37466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
43aa620
Improve dockerfiles build order and apply SSL patches
rodrigok af8f357
Remove build dependency of test-storybook
rodrigok a5b8f1d
Use mongodb and httpbin from compose in tests
rodrigok dd64bc9
Reduce number of CI jobs
rodrigok 10d1c08
Fix review from coderabbitai
rodrigok File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ on: | |
| transporter: | ||
| type: string | ||
| mongodb-version: | ||
| default: "['5.0', '8.2']" | ||
| default: "['8.2']" | ||
| required: false | ||
| type: string | ||
| release: | ||
|
|
@@ -41,6 +41,9 @@ on: | |
| type: | ||
| required: true | ||
| type: string | ||
| coverage: | ||
| required: false | ||
| type: string | ||
| db-watcher-disabled: | ||
| default: 'true' | ||
| required: false | ||
|
|
@@ -66,12 +69,16 @@ env: | |
| TOOL_NODE_FLAGS: ${{ vars.TOOL_NODE_FLAGS }} | ||
| LOWERCASE_REPOSITORY: ${{ inputs.lowercase-repo }} | ||
| DOCKER_TAG: ${{ inputs.gh-docker-tag }} | ||
| DOCKER_TAG_SUFFIX_ROCKETCHAT: '-cov' | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-24.04 | ||
|
|
||
| env: | ||
| # if building for production on develop branch or release, add suffix for coverage images | ||
| DOCKER_TAG_SUFFIX_ROCKETCHAT: ${{ inputs.coverage == matrix.mongodb-version && (github.event_name == 'release' || github.ref == 'refs/heads/develop') && '-cov' || '' }} | ||
| MONGODB_VERSION: ${{ matrix.mongodb-version }} | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
|
|
@@ -105,13 +112,6 @@ jobs: | |
| username: ${{ secrets.CR_USER }} | ||
| password: ${{ secrets.CR_PAT }} | ||
|
|
||
| - name: Launch MongoDB | ||
| uses: supercharge/[email protected] | ||
| with: | ||
| mongodb-image: mongodb/mongodb-community-server | ||
| mongodb-version: ${{ matrix.mongodb-version }}-ubi8 | ||
| mongodb-replica-set: rs0 | ||
|
|
||
| - uses: actions/checkout@v5 | ||
|
|
||
| - name: Setup NodeJS | ||
|
|
@@ -142,12 +142,9 @@ jobs: | |
| with: | ||
| CR_USER: ${{ secrets.CR_USER }} | ||
| CR_PAT: ${{ secrets.CR_PAT }} | ||
| node-version: ${{ inputs.node-version }} | ||
| # the same reason we need to rebuild the docker image at this point is the reason we dont want to publish it | ||
| publish-image: false | ||
| setup: false | ||
| service: 'rocketchat' | ||
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
|
||
| - name: Set DEBUG_LOG_LEVEL (debug enabled) | ||
| if: runner.debug == '1' | ||
|
|
@@ -156,58 +153,34 @@ jobs: | |
| - name: Start httpbin container and wait for it to be ready | ||
| if: inputs.type == 'api' | ||
| run: | | ||
| docker run -d -p 10000:80 --name httpbin-container kennethreitz/httpbin | ||
| i=0 | ||
| while [ $i -lt 10 ]; do | ||
| if curl -s -o /dev/null http://localhost:10000; then | ||
| echo "httpbin is running" | ||
| break | ||
| fi | ||
| i=$((i + 1)) | ||
| sleep 5 | ||
| done | ||
| if [ $i -eq 10 ]; then | ||
| echo "Failed to verify httpbin is running" | ||
| exit 1 | ||
| fi | ||
| docker compose -f docker-compose-ci.yml up -d httpbin | ||
|
|
||
| - name: Prepare code coverage directory | ||
| if: inputs.release == 'ee' | ||
| if: inputs.coverage == matrix.mongodb-version | ||
| run: | | ||
| mkdir -p /tmp/coverage | ||
| chmod 777 /tmp/coverage | ||
|
|
||
| - name: Start containers for CE | ||
| if: inputs.release == 'ce' | ||
| env: | ||
| MONGO_URL: 'mongodb://host.docker.internal:27017/rocketchat?replicaSet=rs0&directConnection=true' | ||
| run: | | ||
| # when we are testing CE, we only need to start the rocketchat container | ||
| DEBUG_LOG_LEVEL=${DEBUG_LOG_LEVEL:-0} docker compose -f docker-compose-ci.yml up -d rocketchat | ||
| DEBUG_LOG_LEVEL=${DEBUG_LOG_LEVEL:-0} docker compose -f docker-compose-ci.yml up -d rocketchat --wait | ||
|
|
||
| - name: Start containers for EE | ||
| if: inputs.release == 'ee' | ||
| env: | ||
| MONGO_URL: 'mongodb://host.docker.internal:27017/rocketchat?replicaSet=rs0&directConnection=true' | ||
| ENTERPRISE_LICENSE: ${{ inputs.enterprise-license }} | ||
| TRANSPORTER: ${{ inputs.transporter }} | ||
| COVERAGE_DIR: '/tmp/coverage' | ||
| COVERAGE_REPORTER: 'lcov' | ||
| DISABLE_DB_WATCHERS: ${{ inputs.db-watcher-disabled }} | ||
| run: | | ||
| DEBUG_LOG_LEVEL=${DEBUG_LOG_LEVEL:-0} docker compose -f docker-compose-ci.yml up -d | ||
| DEBUG_LOG_LEVEL=${DEBUG_LOG_LEVEL:-0} docker compose -f docker-compose-ci.yml up -d --wait | ||
|
|
||
| - uses: ./.github/actions/setup-playwright | ||
| if: inputs.type == 'ui' | ||
|
|
||
| - name: Wait for Rocket.Chat to start up | ||
| uses: cygnetdigital/[email protected] | ||
| with: | ||
| url: 'http://localhost:3000/health' | ||
| responseCode: '200' | ||
| timeout: 60000 | ||
| interval: 1000 | ||
|
|
||
| - name: Wait services to start up | ||
| if: inputs.release == 'ee' | ||
| run: | | ||
|
|
@@ -226,30 +199,15 @@ jobs: | |
| if: inputs.type == 'api' | ||
| working-directory: ./apps/meteor | ||
| env: | ||
| WEBHOOK_TEST_URL: 'http://host.docker.internal:10000' | ||
| WEBHOOK_TEST_URL: 'http://httpbin' | ||
| IS_EE: ${{ inputs.release == 'ee' && 'true' || '' }} | ||
| COVERAGE_DIR: '/tmp/coverage' | ||
| COVERAGE_REPORTER: 'lcovonly' | ||
| run: | | ||
| for i in $(seq 1 2); do | ||
| npm run testapi && s=0 && break || s=$? | ||
|
|
||
| docker compose -f ../../docker-compose-ci.yml logs --tail=100 | ||
|
|
||
| docker compose -f ../../docker-compose-ci.yml stop | ||
| set -o xtrace | ||
|
|
||
| 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' | ||
| npm run testapi | ||
|
|
||
| NOW=$(date "+%Y-%m-%dT%H:%M:%S.000Z") | ||
|
|
||
| docker compose -f ../../docker-compose-ci.yml restart | ||
|
|
||
| until echo "$(docker compose -f ../../docker-compose-ci.yml logs rocketchat --since $NOW)" | grep -q "SERVER RUNNING"; do | ||
| echo "Waiting Rocket.Chat to start up" | ||
| ((c++)) && ((c==10)) && exit 1 | ||
| sleep 10 | ||
| done; | ||
| done; | ||
| docker compose -f ../../docker-compose-ci.yml stop | ||
|
|
||
| ls -l $COVERAGE_DIR | ||
|
|
@@ -258,7 +216,7 @@ jobs: | |
| - name: E2E Test UI (${{ matrix.shard }}/${{ inputs.total-shard }}) | ||
| if: inputs.type == 'ui' | ||
| env: | ||
| E2E_COVERAGE: ${{ inputs.release == 'ee' && 'true' || '' }} | ||
| E2E_COVERAGE: ${{ inputs.coverage == matrix.mongodb-version && 'true' || '' }} | ||
| IS_EE: ${{ inputs.release == 'ee' && 'true' || '' }} | ||
| REPORTER_ROCKETCHAT_API_KEY: ${{ secrets.REPORTER_ROCKETCHAT_API_KEY }} | ||
| REPORTER_ROCKETCHAT_URL: ${{ secrets.REPORTER_ROCKETCHAT_URL }} | ||
|
|
@@ -289,28 +247,28 @@ jobs: | |
| include-hidden-files: true | ||
|
|
||
| - name: Show server logs if E2E test failed | ||
| if: failure() && inputs.release == 'ee' | ||
| run: docker compose -f docker-compose-ci.yml logs | ||
| if: failure() | ||
| 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 | ||
|
|
||
| - name: Show server logs if E2E test failed | ||
| if: failure() && inputs.release != 'ee' | ||
| run: docker compose -f docker-compose-ci.yml logs rocketchat | ||
| - name: Show mongo logs if E2E test failed | ||
| if: failure() | ||
| run: docker compose -f docker-compose-ci.yml logs mongo | ||
|
|
||
| - name: Extract e2e:ee:coverage | ||
| if: inputs.type == 'ui' && inputs.release == 'ee' | ||
| if: inputs.coverage == matrix.mongodb-version && inputs.type == 'ui' | ||
| working-directory: ./apps/meteor | ||
| run: yarn test:e2e:nyc | ||
|
|
||
| - uses: codecov/codecov-action@v3 | ||
| if: inputs.type == 'ui' && inputs.release == 'ee' | ||
| if: inputs.coverage == matrix.mongodb-version && inputs.type == 'ui' | ||
| with: | ||
| directory: ./apps/meteor | ||
| flags: e2e | ||
| verbose: true | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
|
|
||
| - uses: codecov/codecov-action@v3 | ||
| if: inputs.type == 'api' && inputs.release == 'ee' | ||
| if: inputs.coverage == matrix.mongodb-version && inputs.type == 'api' | ||
| with: | ||
| directory: /tmp/coverage | ||
| working-directory: . | ||
|
|
@@ -319,15 +277,15 @@ jobs: | |
| token: ${{ secrets.CODECOV_TOKEN }} | ||
|
|
||
| - name: Store e2e-api-ee-coverage | ||
| if: inputs.type == 'api' && inputs.release == 'ee' | ||
| if: inputs.coverage == matrix.mongodb-version && inputs.type == 'api' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: e2e-api-ee-coverage-${{ matrix.mongodb-version }}-${{ matrix.shard }} | ||
| path: /tmp/coverage | ||
| include-hidden-files: true | ||
|
|
||
| - name: Store e2e-ee-coverage | ||
| if: inputs.type == 'ui' && inputs.release == 'ee' | ||
| if: inputs.coverage == matrix.mongodb-version && inputs.type == 'ui' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: e2e-ee-coverage-${{ matrix.mongodb-version }}-${{ matrix.shard }} | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.