Skip to content

PATCH: AR-3095 Handle failed Image Attachment pipes #24

PATCH: AR-3095 Handle failed Image Attachment pipes

PATCH: AR-3095 Handle failed Image Attachment pipes #24

Workflow file for this run

name: CI
on:
release:
types: [published]
pull_request:
branches: '**'
push:
branches: '**'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
TOOL_NODE_FLAGS: ${{ vars.TOOL_NODE_FLAGS }}
jobs:
release-versions:
name: ⚙️ Variables Setup
runs-on: ubuntu-latest
outputs:
release: ${{ steps.by-tag.outputs.release }}
latest-release: ${{ steps.latest.outputs.latest-release }}
docker-tag: ${{ steps.docker.outputs.docker-tag }}
gh-docker-tag: ${{ steps.docker.outputs.gh-docker-tag }}
lowercase-repo: ${{ steps.var.outputs.lowercase-repo }}
rc-dockerfile: '${{ github.workspace }}/apps/meteor/.docker/Dockerfile'
rc-docker-tag: '${{ steps.docker.outputs.gh-docker-tag }}.official'
rc-dockerfile-alpine: '${{ github.workspace }}/apps/meteor/.docker/Dockerfile.alpine'
rc-docker-tag-alpine: '${{ steps.docker.outputs.gh-docker-tag }}.alpine'
node-version: ${{ steps.var.outputs.node-version }}
# this is 100% intentional, secrets are not available for forks, so ee-tests will always fail
# to avoid this, we are using a dummy license, expiring at 2024-06-30
enterprise-license: WMa5i+/t/LZbYOj8u3XUkivRhWBtWO6ycUjaZoVAw2DxMfdyBIAa2gMMI4x7Z2BrTZIZhFEImfOxcXcgD0QbXHGBJaMI+eYG+eofnVWi2VA7RWbpvWTULgPFgyJ4UEFeCOzVjcBLTQbmMSam3u0RlekWJkfAO0KnmLtsaEYNNA2rz1U+CLI/CdNGfdqrBu5PZZbGkH0KEzyIZMaykOjzvX+C6vd7fRxh23HecwhkBbqE8eQsCBt2ad0qC4MoVXsDaSOmSzGW+aXjuXt/9zjvrLlsmWQTSlkrEHdNkdywm0UkGxqz3+CP99n0WggUBioUiChjMuNMoceWvDvmxYP9Ml2NpYU7SnfhjmMFyXOah8ofzv8w509Y7XODvQBz+iB4Co9YnF3vT96HDDQyAV5t4jATE+0t37EAXmwjTi3qqyP7DLGK/revl+mlcwJ5kS4zZBsm1E4519FkXQOZSyWRnPdjqvh4mCLqoispZ49wKvklDvjPxCSP9us6cVXLDg7NTJr/4pfxLPOkvv7qCgugDvlDx17bXpQFPSDxmpw66FLzvb5Id0dkWjOzrRYSXb0bFWoUQjtHFzmcpFkyVhOKrQ9zA9+Zm7vXmU9Y2l2dK79EloOuHMSYAqsPEag8GMW6vI/cT4iIjHGGDePKnD0HblvTEKzql11cfT/abf2IiaY=
steps:
- uses: Bhacaz/checkout-files@v2
with:
files: package.json
branch: ${{ github.ref }}
- id: var
run: |
LOWERCASE_REPOSITORY=$(echo "${{ github.repository_owner }}" | tr "[:upper:]" "[:lower:]")
echo "LOWERCASE_REPOSITORY: ${LOWERCASE_REPOSITORY}"
echo "lowercase-repo=${LOWERCASE_REPOSITORY}" >> $GITHUB_OUTPUT
NODE_VERSION=$(node -p "require('./package.json').engines.node")
echo "NODE_VERSION: ${NODE_VERSION}"
echo "node-version=${NODE_VERSION}" >> $GITHUB_OUTPUT
- id: by-tag
run: |
if echo "$GITHUB_REF_NAME" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$' ; then
RELEASE="latest"
elif echo "$GITHUB_REF_NAME" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$' ; then
RELEASE="release-candidate"
fi
echo "RELEASE: ${RELEASE}"
echo "release=${RELEASE}" >> $GITHUB_OUTPUT
- id: latest
run: |
LATEST_RELEASE="$(
git -c 'versionsort.suffix=-' ls-remote -t --exit-code --refs --sort=-v:refname "https://github.com/$GITHUB_REPOSITORY" '*' |
awk -F/ '$NF !~ /rc|beta/ { print $NF; exit }'
)"
echo "LATEST_RELEASE: ${LATEST_RELEASE}"
echo "latest-release=${LATEST_RELEASE}" >> $GITHUB_OUTPUT
- id: docker
run: |
if [[ '${{ github.event_name }}' == 'pull_request' ]]; then
DOCKER_TAG="pr-${{ github.event.number }}"
else
DOCKER_TAG="gh-${{ github.run_id }}"
fi
echo "DOCKER_TAG: ${DOCKER_TAG}"
echo "gh-docker-tag=${DOCKER_TAG}" >> $GITHUB_OUTPUT
build:
name: 📦 Build
needs: [release-versions]
runs-on: ubuntu-20.04
steps:
- name: Github Info
run: |
echo "GITHUB_ACTION: $GITHUB_ACTION"
echo "GITHUB_ACTOR: $GITHUB_ACTOR"
echo "GITHUB_REF: $GITHUB_REF"
echo "GITHUB_HEAD_REF: $GITHUB_HEAD_REF"
echo "GITHUB_BASE_REF: $GITHUB_BASE_REF"
echo "github.event_name: ${{ github.event_name }}"
cat $GITHUB_EVENT_PATH
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 4
- uses: actions/checkout@v3
- name: Setup NodeJS
uses: ./.github/actions/setup-node
with:
node-version: ${{ needs.release-versions.outputs.node-version }}
cache-modules: true
install: true
# - name: Free disk space
# run: |
# sudo apt clean
# docker rmi $(docker image ls -aq)
# df -h
- name: Cache vite
uses: actions/cache@v3
with:
path: ./node_modules/.vite
key: vite-local-cache-${{ runner.OS }}-${{ hashFiles('package.json') }}
restore-keys: |
vite-local-cache-${{ runner.os }}-
- name: Cache meteor local
uses: actions/cache@v3
with:
path: ./apps/meteor/.meteor/local
key: meteor-local-cache-${{ runner.OS }}-${{ hashFiles('apps/meteor/.meteor/versions') }}
restore-keys: |
meteor-local-cache-${{ runner.os }}-
- name: Cache meteor
uses: actions/cache@v3
with:
path: ~/.meteor
key: meteor-cache-${{ runner.OS }}-${{ hashFiles('apps/meteor/.meteor/release') }}
restore-keys: |
meteor-cache-${{ runner.os }}-
- name: Install Meteor
run: |
# Restore bin from cache
set +e
METEOR_SYMLINK_TARGET=$(readlink ~/.meteor/meteor)
METEOR_TOOL_DIRECTORY=$(dirname "$METEOR_SYMLINK_TARGET")
set -e
LAUNCHER=$HOME/.meteor/$METEOR_TOOL_DIRECTORY/scripts/admin/launch-meteor
if [ -e $LAUNCHER ]
then
echo "Cached Meteor bin found, restoring it"
sudo cp "$LAUNCHER" "/usr/local/bin/meteor"
else
echo "No cached Meteor bin found."
fi
# only install meteor if bin isn't found
command -v meteor >/dev/null 2>&1 || curl https://install.meteor.com | sed s/--progress-bar/-sL/g | /bin/sh
- name: Versions
run: |
npm --versions
yarn -v
node -v
meteor --version
meteor npm --versions
meteor node -v
git version
- uses: dtinth/setup-github-actions-caching-for-turbo@v1
- name: Translation check
run: yarn turbo run translation-check
- name: Reset Meteor
if: true # To be safe, let's _always_ reset this and regenerate
working-directory: ./apps/meteor
run: meteor reset
- name: Build Rocket.Chat From Pull Request
if: startsWith(github.ref, 'refs/pull/') == true
env:
METEOR_PROFILE: 1000
run: yarn build:ci -- --directory /tmp/dist
- name: Build Rocket.Chat
if: startsWith(github.ref, 'refs/pull/') != true
run: yarn build:ci -- --directory /tmp/dist
- name: Prepare build
run: |
cd /tmp/dist
tar czf /tmp/Rocket.Chat.tar.gz bundle
- name: Store build
uses: actions/upload-artifact@v3
with:
name: build
path: /tmp/Rocket.Chat.tar.gz
checks:
needs: [release-versions]
name: 🔎 Code Check
uses: ./.github/workflows/ci-code-check.yml
with:
node-version: ${{ needs.release-versions.outputs.node-version }}
test-unit:
name: 🔨 Test Unit
needs: [checks, build, release-versions]
uses: ./.github/workflows/ci-test-unit.yml
with:
node-version: ${{ needs.release-versions.outputs.node-version }}
test-api:
name: 🔨 Test API (CE)
needs: [checks, build, release-versions]
uses: ./.github/workflows/ci-test-e2e.yml
with:
type: api
release: ce
publish-container: true
node-version: ${{ needs.release-versions.outputs.node-version }}
lowercase-repo: ${{ needs.release-versions.outputs.lowercase-repo }}
rc-dockerfile: ${{ needs.release-versions.outputs.rc-dockerfile }}
rc-docker-tag: ${{ needs.release-versions.outputs.rc-docker-tag }}
rc-dockerfile-alpine: ${{ needs.release-versions.outputs.rc-dockerfile-alpine }}
rc-docker-tag-alpine: ${{ needs.release-versions.outputs.rc-docker-tag-alpine }}
gh-docker-tag: ${{ needs.release-versions.outputs.gh-docker-tag }}
secrets:
CR_USER: ${{ secrets.CR_USER }}
CR_PAT: ${{ secrets.CR_PAT }}
test-ui:
name: 🔨 Test UI (CE)
needs: [checks, build, release-versions]
uses: ./.github/workflows/ci-test-e2e.yml
with:
type: ui
release: ce
transporter: 'nats://nats:4222'
enterprise-license: ${{ needs.release-versions.outputs.enterprise-license }}
shard: '[1, 2, 3, 4]'
total-shard: 4
node-version: ${{ needs.release-versions.outputs.node-version }}
lowercase-repo: ${{ needs.release-versions.outputs.lowercase-repo }}
rc-dockerfile: ${{ needs.release-versions.outputs.rc-dockerfile }}
rc-docker-tag: ${{ needs.release-versions.outputs.rc-docker-tag }}
rc-dockerfile-alpine: ${{ needs.release-versions.outputs.rc-dockerfile-alpine }}
rc-docker-tag-alpine: ${{ needs.release-versions.outputs.rc-docker-tag-alpine }}
gh-docker-tag: ${{ needs.release-versions.outputs.gh-docker-tag }}
secrets:
CR_USER: ${{ secrets.CR_USER }}
CR_PAT: ${{ secrets.CR_PAT }}
QASE_API_TOKEN: ${{ secrets.QASE_API_TOKEN }}
REPORTER_ROCKETCHAT_API_KEY: ${{ secrets.REPORTER_ROCKETCHAT_API_KEY }}
REPORTER_ROCKETCHAT_URL: ${{ secrets.REPORTER_ROCKETCHAT_URL }}
test-api-ee:
name: 🔨 Test API (EE)
needs: [checks, build, release-versions]
uses: ./.github/workflows/ci-test-e2e.yml
with:
type: api
release: ee
transporter: 'nats://nats:4222'
enterprise-license: ${{ needs.release-versions.outputs.enterprise-license }}
publish-container: true
mongodb-version: "['4.4']"
node-version: ${{ needs.release-versions.outputs.node-version }}
lowercase-repo: ${{ needs.release-versions.outputs.lowercase-repo }}
rc-dockerfile: ${{ needs.release-versions.outputs.rc-dockerfile }}
rc-docker-tag: ${{ needs.release-versions.outputs.rc-docker-tag }}
rc-dockerfile-alpine: ${{ needs.release-versions.outputs.rc-dockerfile-alpine }}
rc-docker-tag-alpine: ${{ needs.release-versions.outputs.rc-docker-tag-alpine }}
gh-docker-tag: ${{ needs.release-versions.outputs.gh-docker-tag }}
secrets:
CR_USER: ${{ secrets.CR_USER }}
CR_PAT: ${{ secrets.CR_PAT }}
test-ui-ee:
name: 🔨 Test UI (EE)
needs: [checks, build, release-versions]
uses: ./.github/workflows/ci-test-e2e.yml
with:
type: ui
release: ee
transporter: 'nats://nats:4222'
enterprise-license: ${{ needs.release-versions.outputs.enterprise-license }}
shard: '[1, 2, 3, 4, 5]'
total-shard: 5
mongodb-version: "['4.4']"
node-version: ${{ needs.release-versions.outputs.node-version }}
lowercase-repo: ${{ needs.release-versions.outputs.lowercase-repo }}
rc-dockerfile: ${{ needs.release-versions.outputs.rc-dockerfile }}
rc-docker-tag: ${{ needs.release-versions.outputs.rc-docker-tag }}
rc-dockerfile-alpine: ${{ needs.release-versions.outputs.rc-dockerfile-alpine }}
rc-docker-tag-alpine: ${{ needs.release-versions.outputs.rc-docker-tag-alpine }}
gh-docker-tag: ${{ needs.release-versions.outputs.gh-docker-tag }}
secrets:
CR_USER: ${{ secrets.CR_USER }}
CR_PAT: ${{ secrets.CR_PAT }}
QASE_API_TOKEN: ${{ secrets.QASE_API_TOKEN }}
REPORTER_ROCKETCHAT_API_KEY: ${{ secrets.REPORTER_ROCKETCHAT_API_KEY }}
REPORTER_ROCKETCHAT_URL: ${{ secrets.REPORTER_ROCKETCHAT_URL }}
tests-done:
name: ✅ Tests Done
runs-on: ubuntu-20.04
needs: [checks, test-unit, test-api, test-ui, test-api-ee, test-ui-ee]
steps:
- name: Test finish aggregation
run: |
echo finished
deploy:
name: 🚀 Copy to S3 # The actual deployment to our servers is done via Jenkins
runs-on: ubuntu-20.04
needs: [build, release-versions]
steps:
- uses: actions/checkout@v3
- name: Restore build
uses: actions/download-artifact@v3
with:
name: build
path: /tmp/build
- name: Publish assets
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_USER_GITHUB_ROCKETCHAT_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_USER_GITHUB_ROCKETCHAT_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-west-2
run: |
REPO_VERSION=$(node -p "require('./package.json').version")
if [[ '${{ github.event_name }}' = 'release' ]]; then
GIT_TAG="${GITHUB_REF#*tags/}"
GIT_BRANCH=""
ARTIFACT_NAME="${REPO_VERSION}"
RC_VERSION=$GIT_TAG
if [[ '${{ needs.release-versions.outputs.release }}' = 'release-candidate' ]]; then
SNAP_CHANNEL=candidate
RC_RELEASE=candidate
elif [[ '${{ needs.release-versions.outputs.release }}' = 'latest' ]]; then
SNAP_CHANNEL=stable
RC_RELEASE=stable
fi
else
GIT_TAG=""
GIT_BRANCH="${GITHUB_REF#*heads/}"
ARTIFACT_NAME="${REPO_VERSION}.$GITHUB_SHA"
RC_VERSION="${REPO_VERSION}"
SNAP_CHANNEL=edge
RC_RELEASE=develop
fi;
ROCKET_DEPLOY_DIR="/tmp/deploy"
FILENAME="$ROCKET_DEPLOY_DIR/rocket.chat-$ARTIFACT_NAME.tgz";
FILENAME_LATEST="$ROCKET_DEPLOY_DIR/rocket.chat-latest.tgz";
mkdir -p $ROCKET_DEPLOY_DIR
ln -s /tmp/build/Rocket.Chat.tar.gz "$FILENAME"
ln -s /tmp/build/Rocket.Chat.tar.gz "$FILENAME_LATEST"
aws s3 cp $ROCKET_DEPLOY_DIR/ s3://seekingalpha-rocketchat-builds/ --recursive