Skip to content
Snippets Groups Projects
Unverified Commit 44788877 authored by Guilherme Gazzo's avatar Guilherme Gazzo Committed by GitHub
Browse files

ci: fix external pull requests (#33063)

parent ec0cec69
No related branches found
No related tags found
No related merge requests found
...@@ -17,13 +17,25 @@ inputs: ...@@ -17,13 +17,25 @@ inputs:
required: false required: false
description: 'Containers to build along with Rocket.Chat' description: 'Containers to build along with Rocket.Chat'
type: string type: string
turbo-cache:
required: false
description: 'Enable turbo cache'
default: 'true'
publish-image:
required: false
description: 'Publish image'
default: 'true'
setup:
required: false
description: 'Setup node.js'
default: 'true'
runs: runs:
using: composite using: composite
steps: steps:
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
if: (github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'release' || github.ref == 'refs/heads/develop') if: inputs.publish-image == 'true' &&(github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'release' || github.ref == 'refs/heads/develop')
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
registry: ghcr.io registry: ghcr.io
...@@ -42,17 +54,20 @@ runs: ...@@ -42,17 +54,20 @@ runs:
cd /tmp/build cd /tmp/build
tar xzf Rocket.Chat.tar.gz tar xzf Rocket.Chat.tar.gz
rm Rocket.Chat.tar.gz rm Rocket.Chat.tar.gz
- uses: rharkor/caching-for-turbo@v1.5 - uses: rharkor/caching-for-turbo@v1.5
# 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 - name: Setup NodeJS
uses: ./.github/actions/setup-node uses: ./.github/actions/setup-node
if: inputs.setup == 'true'
with: with:
node-version: ${{ inputs.node-version }} node-version: ${{ inputs.node-version }}
cache-modules: true cache-modules: true
install: true install: true
- run: yarn build - run: yarn build
if: inputs.setup == 'true'
shell: bash shell: bash
- name: Build Docker images - name: Build Docker images
...@@ -63,9 +78,14 @@ runs: ...@@ -63,9 +78,14 @@ runs:
docker compose -f docker-compose-ci.yml build "${args[@]}" docker compose -f docker-compose-ci.yml build "${args[@]}"
- name: Publish Docker images to GitHub Container Registry - name: Publish Docker images to GitHub Container Registry
if: (github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'release' || github.ref == 'refs/heads/develop') if: inputs.publish-image == 'true' && (github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'release' || github.ref == 'refs/heads/develop')
shell: bash shell: bash
run: | run: |
args=(rocketchat ${{ inputs.build-containers }}) args=(rocketchat ${{ inputs.build-containers }})
docker compose -f docker-compose-ci.yml push "${args[@]}" docker compose -f docker-compose-ci.yml push "${args[@]}"
- name: Clean up temporary files
shell: bash
run: |
sudo rm -rf /tmp/bundle
...@@ -130,7 +130,9 @@ jobs: ...@@ -130,7 +130,9 @@ jobs:
node-version: ${{ inputs.node-version }} node-version: ${{ inputs.node-version }}
cache-modules: true cache-modules: true
install: true install: true
- uses: rharkor/caching-for-turbo@v1.5
- run: yarn build
# if we are testing a PR from a fork, we need to build the docker image at this point # if we are testing a PR from a fork, we need to build the docker image at this point
- uses: ./.github/actions/build-docker - uses: ./.github/actions/build-docker
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
...@@ -138,8 +140,11 @@ jobs: ...@@ -138,8 +140,11 @@ jobs:
CR_USER: ${{ secrets.CR_USER }} CR_USER: ${{ secrets.CR_USER }}
CR_PAT: ${{ secrets.CR_PAT }} CR_PAT: ${{ secrets.CR_PAT }}
node-version: ${{ inputs.node-version }} node-version: ${{ inputs.node-version }}
# we already called the turbo cache at this point, so it should be false
- uses: rharkor/caching-for-turbo@v1.5 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
- name: Start httpbin container and wait for it to be ready - name: Start httpbin container and wait for it to be ready
if: inputs.type == 'api' if: inputs.type == 'api'
...@@ -159,8 +164,6 @@ jobs: ...@@ -159,8 +164,6 @@ jobs:
exit 1 exit 1
fi fi
- run: yarn build
- name: Prepare code coverage directory - name: Prepare code coverage directory
if: inputs.release == 'ee' if: inputs.release == 'ee'
run: | run: |
...@@ -187,10 +190,6 @@ jobs: ...@@ -187,10 +190,6 @@ jobs:
run: | run: |
docker compose -f docker-compose-ci.yml up -d docker compose -f docker-compose-ci.yml up -d
- name: Clean up temporary files
run: |
sudo rm -rf /tmp/bundle
- name: Cache Playwright binaries - name: Cache Playwright binaries
if: inputs.type == 'ui' if: inputs.type == 'ui'
uses: actions/cache@v3 uses: actions/cache@v3
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment