-
Notifications
You must be signed in to change notification settings - Fork 13.1k
chore(CI): improve workflow merging steps and parallelizing image build #37352
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
6 commits
Select commit
Hold shift + click to select a range
2b35471
chore: improve CI workflow merging steps and parallelizing image build
rodrigok 93b6e9a
Add cache for build steps
rodrigok 81cf787
Build monolith for coverage as well
rodrigok 9d821a6
fix: correct source hash extraction in CI workflow
ggazzo bc46e13
Cache livechat build separated
rodrigok e429ae8
Simplify packages tar
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,18 +13,10 @@ inputs: | |
| required: true | ||
| description: 'Deno version' | ||
| type: string | ||
| platform: | ||
| service: | ||
| required: false | ||
| description: 'Platform' | ||
| default: 'alpine' | ||
| build-containers: | ||
| required: false | ||
| description: 'Containers to build along with Rocket.Chat' | ||
| description: 'Container to build' | ||
| type: string | ||
| turbo-cache: | ||
| required: false | ||
| description: 'Enable turbo cache' | ||
| default: 'true' | ||
| publish-image: | ||
| required: false | ||
| description: 'Publish image' | ||
|
|
@@ -36,6 +28,10 @@ inputs: | |
| NPM_TOKEN: | ||
| required: false | ||
| description: 'NPM token' | ||
| type: | ||
| required: false | ||
| description: 'production or coverage' | ||
| default: 'production' | ||
|
|
||
| runs: | ||
| using: composite | ||
|
|
@@ -49,61 +45,55 @@ runs: | |
| username: ${{ inputs.CR_USER }} | ||
| password: ${{ inputs.CR_PAT }} | ||
|
|
||
| - name: Restore build | ||
| - name: Restore packages build | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: build | ||
| path: /tmp/build | ||
| name: packages-build | ||
| path: /tmp | ||
|
|
||
| - name: Unpack build | ||
| - name: Unpack packages build | ||
| shell: bash | ||
| run: | | ||
| cd /tmp/build | ||
| tar xzf Rocket.Chat.tar.gz | ||
| rm Rocket.Chat.tar.gz | ||
| tar -xzf /tmp/RocketChat-packages-build.tar.gz -C . | ||
|
|
||
| - uses: rharkor/[email protected] | ||
| # if we are testing a PR from a fork, we already called the turbo cache at this point, so it should be false | ||
| if: inputs.turbo-cache == 'true' | ||
|
|
||
| - name: Setup NodeJS | ||
| uses: ./.github/actions/setup-node | ||
| if: inputs.setup == 'true' | ||
| with: | ||
| node-version: ${{ inputs.node-version }} | ||
| deno-version: ${{ inputs.deno-version }} | ||
| cache-modules: true | ||
| install: true | ||
| NPM_TOKEN: ${{ inputs.NPM_TOKEN }} | ||
|
|
||
| - name: Restore turbo build | ||
| - name: Restore meteor build | ||
| if: inputs.service == 'rocketchat' | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: turbo-build | ||
| path: .turbo/cache | ||
| name: build-${{ inputs.type }} | ||
| path: /tmp/build | ||
|
|
||
| - run: yarn build | ||
| if: inputs.setup == 'true' | ||
| - name: Unpack meteor build | ||
| if: inputs.service == 'rocketchat' | ||
| shell: bash | ||
| run: | | ||
| cd /tmp/build | ||
| tar xzf Rocket.Chat.tar.gz | ||
| rm Rocket.Chat.tar.gz | ||
|
|
||
| - name: Build Docker images | ||
| shell: bash | ||
| run: | | ||
| args=(rocketchat ${{ inputs.build-containers }}) | ||
|
|
||
| export DENO_VERSION="${{ inputs.deno-version }}" | ||
|
|
||
| docker compose -f docker-compose-ci.yml build "${args[@]}" | ||
| docker compose -f docker-compose-ci.yml build ${{ inputs.service }} | ||
|
|
||
| - name: Publish Docker images to GitHub Container Registry | ||
| if: inputs.publish-image == 'true' && github.actor != 'dependabot[bot]' && (github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'release' || github.ref == 'refs/heads/develop') | ||
| shell: bash | ||
| run: | | ||
| args=(rocketchat ${{ inputs.build-containers }}) | ||
| set -o xtrace | ||
|
|
||
| # Get image name from docker-compose-ci.yml since rocketchat image is different from service name (rocket.chat) | ||
| IMAGE=$(docker compose -f docker-compose-ci.yml config --format json 2>/dev/null | jq -r --arg s "${{ inputs.service }}" '.services[$s].image') | ||
| IMAGE_NO_TAG=$(echo "$IMAGE" | sed 's/:.*$//') | ||
|
|
||
| docker tag ${IMAGE} ${IMAGE}-gha-run-${{ github.run_id }} | ||
|
|
||
| docker compose -f docker-compose-ci.yml push "${args[@]}" | ||
| docker push --all-tags ${IMAGE_NO_TAG} | ||
|
|
||
| - name: Clean up temporary files | ||
| if: inputs.service == 'rocketchat' | ||
| shell: bash | ||
| run: | | ||
| sudo rm -rf /tmp/bundle | ||
| sudo rm -rf /tmp/build | ||
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 |
|---|---|---|
|
|
@@ -41,19 +41,19 @@ jobs: | |
| install: true | ||
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
|
||
| # - name: Free disk space | ||
| # run: | | ||
| # sudo apt clean | ||
| # docker rmi $(docker image ls -aq) | ||
| # df -h | ||
|
|
||
| - uses: rharkor/[email protected] | ||
|
|
||
| - name: Restore turbo build | ||
| - name: Restore packages build | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: turbo-build | ||
| path: .turbo/cache | ||
| name: packages-build | ||
| path: /tmp | ||
|
|
||
| - name: Unpack packages build | ||
| shell: bash | ||
| run: | | ||
| tar -xzf /tmp/RocketChat-packages-build.tar.gz -C . | ||
|
|
||
| - name: Cache TypeCheck | ||
| uses: actions/cache@v4 | ||
| if: matrix.check == 'ts' | ||
|
|
||
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 |
|---|---|---|
|
|
@@ -12,12 +12,6 @@ on: | |
| lowercase-repo: | ||
| required: true | ||
| type: string | ||
| rc-dockerfile: | ||
| required: true | ||
| type: string | ||
| rc-docker-tag: | ||
| required: true | ||
| type: string | ||
| gh-docker-tag: | ||
| required: true | ||
| type: string | ||
|
|
@@ -72,21 +66,19 @@ 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: | ||
| RC_DOCKERFILE: ${{ inputs.rc-dockerfile }}.${{ (matrix.mongodb-version == '8.2' && 'debian' && false) || 'alpine' }} | ||
| RC_DOCKER_TAG: ${{ inputs.rc-docker-tag }}.${{ (matrix.mongodb-version == '8.2' && 'debian' && false) || 'alpine' }} | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| mongodb-version: ${{ fromJSON(inputs.mongodb-version) }} | ||
| shard: ${{ fromJSON(inputs.shard) }} | ||
|
|
||
| name: MongoDB ${{ matrix.mongodb-version }}${{ inputs.db-watcher-disabled == 'false' && ' [legacy watchers]' || '' }} (${{ matrix.shard }}/${{ inputs.total-shard }}) - ${{ (matrix.mongodb-version == '8.2' && 'Debian' && false) || 'Alpine (Official)' }} | ||
| name: MongoDB ${{ matrix.mongodb-version }}${{ inputs.db-watcher-disabled == 'false' && ' [legacy watchers]' || '' }} (${{ matrix.shard }}/${{ inputs.total-shard }}) | ||
|
|
||
| steps: | ||
| - name: Collect Workflow Telemetry | ||
|
|
@@ -133,13 +125,16 @@ jobs: | |
|
|
||
| - uses: rharkor/[email protected] | ||
|
|
||
| - name: Restore turbo build | ||
| - name: Restore packages build | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: turbo-build | ||
| path: .turbo/cache | ||
| name: packages-build | ||
| path: /tmp | ||
|
|
||
| - run: yarn build | ||
| - name: Unpack packages build | ||
| shell: bash | ||
| run: | | ||
| tar -xzf /tmp/RocketChat-packages-build.tar.gz -C . | ||
|
|
||
| # if we are testing a PR from a fork, we need to build the docker image at this point | ||
| - uses: ./.github/actions/build-docker | ||
|
|
@@ -148,11 +143,10 @@ jobs: | |
| CR_USER: ${{ secrets.CR_USER }} | ||
| CR_PAT: ${{ secrets.CR_PAT }} | ||
| node-version: ${{ inputs.node-version }} | ||
| # we already called the turbo cache at this point, so it should be false | ||
| turbo-cache: false | ||
| # 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) | ||
|
|
||
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 |
|---|---|---|
|
|
@@ -37,11 +37,16 @@ jobs: | |
|
|
||
| - uses: rharkor/[email protected] | ||
|
|
||
| - name: Restore turbo build | ||
| - name: Restore packages build | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: turbo-build | ||
| path: .turbo/cache | ||
| name: packages-build | ||
| path: /tmp | ||
|
|
||
| - name: Unpack packages build | ||
| shell: bash | ||
| run: | | ||
| tar -xzf /tmp/RocketChat-packages-build.tar.gz -C . | ||
|
|
||
| - uses: ./.github/actions/setup-playwright | ||
|
|
||
|
|
||
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.