We use github actions cache to store jobstate for the previous runs. The default cache is invalidated incase the job fails. To support rerunning only failed tests, we use custom cache martijnhols/actions-cache@v3. Recently new changes into custome cache broke our workflow https://github.com/MartijnHols/actions-cache. Co-authored-by: Yatin <yatin.chaubal@gmail.com>
1533 lines
62 KiB
YAML
1533 lines
62 KiB
YAML
name: Appsmith External Integration Test Workflow
|
|
|
|
on:
|
|
# This workflow is only triggered by the ok to test command dispatch
|
|
repository_dispatch:
|
|
types: [ok-to-test-command]
|
|
|
|
jobs:
|
|
server-build:
|
|
runs-on: ubuntu-latest
|
|
if: |
|
|
github.event_name == 'repository_dispatch' &&
|
|
github.event.client_payload.slash_command.sha != '' &&
|
|
contains(github.event.client_payload.pull_request.head.sha, github.event.client_payload.slash_command.sha)
|
|
defaults:
|
|
run:
|
|
working-directory: app/server
|
|
shell: bash
|
|
|
|
# Service containers to run with this job. Required for running tests
|
|
services:
|
|
# Label used to access the service container
|
|
redis:
|
|
# Docker Hub image for Redis
|
|
image: redis
|
|
ports:
|
|
# Opens tcp port 6379 on the host and service container
|
|
- 6379:6379
|
|
|
|
steps:
|
|
# Check out merge commit
|
|
- name: Fork based /ok-to-test checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: "refs/pull/${{ github.event.client_payload.pull_request.number }}/merge"
|
|
|
|
# Timestamp will be used to create cache key
|
|
- id: timestamp
|
|
run: echo "::set-output name=timestamp::$(timestamp +'%Y-%m-%dT%H:%M:%S')"
|
|
|
|
# In case this is second attempt try restoring status of the prior attempt from cache
|
|
- name: Restore the previous run result
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/run_result
|
|
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}-
|
|
|
|
# Fetch prior run result
|
|
- name: Get the previous run result
|
|
id: run_result
|
|
run: cat ~/run_result 2>/dev/null || echo 'default'
|
|
|
|
# Incase of prior failure run the job
|
|
- if: steps.run_result.outputs.run_result != 'success'
|
|
run: echo "I'm alive!" && exit 0
|
|
# Setup Java
|
|
- name: Set up JDK 1.11
|
|
uses: actions/setup-java@v1
|
|
with:
|
|
java-version: "11.0.10"
|
|
|
|
# Retrieve maven dependencies from cache. After a successful run, these dependencies are cached again
|
|
- name: Cache maven dependencies
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
uses: actions/cache@v2
|
|
env:
|
|
cache-name: cache-maven-dependencies
|
|
with:
|
|
# maven dependencies are stored in `~/.m2` on Linux/macOS
|
|
path: ~/.m2
|
|
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
|
restore-keys: ${{ runner.os }}-m2
|
|
|
|
# Here, the GITHUB_REF is of type /refs/head/<branch_name>. We extract branch_name from this by removing the
|
|
# first 11 characters. This can be used to build images for several branches
|
|
# Since this is an unreleased build, we get the latest released version number, increment the minor number in it,
|
|
# append a `-SNAPSHOT` at it's end to prepare the snapshot version number. This is used as the project's version.
|
|
- name: Get the version to tag the Docker image
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
id: vars
|
|
run: |
|
|
# Since this is an unreleased build, we set the version to incremented version number with a
|
|
# `-SNAPSHOT` suffix.
|
|
latest_released_version="$(git tag --list 'v*' --sort=-version:refname | head -1)"
|
|
echo "latest_released_version = $latest_released_version"
|
|
next_version="$(echo "$latest_released_version" | awk -F. -v OFS=. '{ $NF++; print }')"
|
|
echo "next_version = $next_version"
|
|
echo ::set-output name=version::$next_version-SNAPSHOT
|
|
echo ::set-output name=tag::$(echo ${GITHUB_REF:11})
|
|
|
|
# Build and test the code
|
|
- name: Build and test
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
env:
|
|
APPSMITH_MONGODB_URI: "mongodb://localhost:27017/mobtools"
|
|
APPSMITH_CLOUD_SERVICES_BASE_URL: "https://release-cs.appsmith.com"
|
|
APPSMITH_REDIS_URL: "redis://127.0.0.1:6379"
|
|
APPSMITH_ENCRYPTION_PASSWORD: "password"
|
|
APPSMITH_ENCRYPTION_SALT: "salt"
|
|
APPSMITH_IS_SELF_HOSTED: false
|
|
APPSMITH_GIT_ROOT: "./container-volumes/git-storage"
|
|
run: |
|
|
./build.sh versions:set \
|
|
-DnewVersion=${{ steps.vars.outputs.version }} \
|
|
-DgenerateBackupPoms=false \
|
|
-DprocessAllModules=true
|
|
|
|
# Restore the previous built bundle if present. If not push the newly built into the cache
|
|
- name: Restore the previous bundle
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
app/server/dist/
|
|
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}
|
|
|
|
# Upload the build artifact so that it can be used by the test & deploy job in the workflow
|
|
- name: Upload server build bundle
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: build
|
|
path: app/server/dist/
|
|
|
|
# Set status = success
|
|
- run: echo "::set-output name=run_result::success" > ~/run_result
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'repository_dispatch' &&
|
|
github.event.client_payload.slash_command.sha != '' &&
|
|
contains(github.event.client_payload.pull_request.head.sha, github.event.client_payload.slash_command.sha)
|
|
defaults:
|
|
run:
|
|
working-directory: app/client
|
|
shell: bash
|
|
|
|
steps:
|
|
# Check out merge commit
|
|
- name: Fork based /ok-to-test checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: "refs/pull/${{ github.event.client_payload.pull_request.number }}/merge"
|
|
|
|
- name: Figure out the PR number
|
|
run: echo ${{ github.event.client_payload.pull_request.number }}
|
|
|
|
# Timestamp will be used to create cache key
|
|
- id: timestamp
|
|
run: echo "::set-output name=timestamp::$(timestamp +'%Y-%m-%dT%H:%M:%S')"
|
|
|
|
# In case this is second attempt try restoring status of the prior attempt from cache
|
|
- name: Restore the previous run result
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/run_result
|
|
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}-
|
|
|
|
# Fetch prior run result
|
|
- name: Get the previous run result
|
|
id: run_result
|
|
run: cat ~/run_result 2>/dev/null || echo 'default'
|
|
|
|
# Incase of prior failure run the job
|
|
- if: steps.run_result.outputs.run_result != 'success'
|
|
run: echo "I'm alive!" && exit 0
|
|
|
|
# Set status = success
|
|
- run: echo "::set-output name=run_result::success" > ~/run_result
|
|
|
|
# This step creates a comment on the PR with a link to this workflow run.
|
|
- name: Add a comment on the PR with link to workflow run
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
uses: peter-evans/create-or-update-comment@v1
|
|
with:
|
|
issue-number: ${{ github.event.client_payload.pull_request.number }}
|
|
body: |
|
|
Tests running at: <https://github.com/appsmithorg/appsmith/actions/runs/${{ github.run_id }}>.
|
|
Workflow: `${{ github.workflow }}`.
|
|
Commit: `${{ github.event.client_payload.slash_command.sha }}`.
|
|
PR: ${{ github.event.client_payload.pull_request.number }}.
|
|
|
|
- name: Use Node.js 14.15.4
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: "14.15.4"
|
|
|
|
- name: Get yarn cache directory path
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
id: yarn-dep-cache-dir-path
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
# Retrieve npm dependencies from cache. After a successful run, these dependencies are cached again
|
|
- name: Cache npm dependencies
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
id: yarn-dep-cache
|
|
uses: actions/cache@v2
|
|
env:
|
|
cache-name: cache-yarn-dependencies
|
|
with:
|
|
path: |
|
|
${{ steps.yarn-dep-cache-dir-path.outputs.dir }}
|
|
key: ${{ runner.os }}-yarn-dep-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-yarn-dep-
|
|
|
|
# Install all the dependencies
|
|
- name: Install dependencies
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
run: yarn install --frozen-lockfile
|
|
|
|
- name: Set the build environment based on the branch
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
id: vars
|
|
run: |
|
|
echo "::set-output name=REACT_APP_ENVIRONMENT::DEVELOPMENT"
|
|
if [[ "${{github.ref}}" == "refs/heads/master" ]]; then
|
|
echo "::set-output name=REACT_APP_ENVIRONMENT::PRODUCTION"
|
|
fi
|
|
if [[ "${{github.ref}}" == "refs/heads/release" ]]; then
|
|
echo "::set-output name=REACT_APP_ENVIRONMENT::STAGING"
|
|
fi
|
|
# Since this is an unreleased build, we set the version to incremented version number with
|
|
# a `-SNAPSHOT` suffix.
|
|
latest_released_version="$(git tag --list 'v*' --sort=-version:refname | head -1)"
|
|
echo "latest_released_version = $latest_released_version"
|
|
next_version="$(echo "$latest_released_version" | awk -F. -v OFS=. '{ $NF++; print }')"
|
|
echo "next_version = $next_version"
|
|
echo ::set-output name=version::$next_version-SNAPSHOT
|
|
|
|
- name: Run the jest tests
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
run: REACT_APP_ENVIRONMENT=${{steps.vars.outputs.REACT_APP_ENVIRONMENT}} yarn run test:unit
|
|
|
|
# We burn React environment & the Segment analytics key into the build itself.
|
|
# This is to ensure that we don't need to configure it in each installation
|
|
- name: Create the bundle
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
run: |
|
|
REACT_APP_ENVIRONMENT=${{steps.vars.outputs.REACT_APP_ENVIRONMENT}} \
|
|
REACT_APP_FUSIONCHARTS_LICENSE_KEY=${{ secrets.APPSMITH_FUSIONCHARTS_LICENSE_KEY }} \
|
|
REACT_APP_SEGMENT_CE_KEY=${{ secrets.APPSMITH_SEGMENT_CE_KEY }} \
|
|
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} \
|
|
REACT_APP_VERSION_ID=${{ steps.vars.outputs.version }} \
|
|
REACT_APP_VERSION_RELEASE_DATE=$(date -u '+%Y-%m-%dT%H:%M:%SZ') \
|
|
yarn build
|
|
|
|
# Restore the previous built bundle if present. If not push the newly built into the cache
|
|
- name: Restore the previous bundle
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
app/client/build/
|
|
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}
|
|
|
|
# Upload the build artifact so that it can be used by the test & deploy job in the workflow
|
|
- name: Upload react build bundle
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: build
|
|
path: app/client/build/
|
|
|
|
# Update check run called "build"
|
|
- name: Mark build job as complete
|
|
uses: actions/github-script@v1
|
|
id: update-check-run
|
|
if: ${{ always() }}
|
|
env:
|
|
run_id: ${{ github.run_id }}
|
|
repository: ${{ github.repository }}
|
|
number: ${{ github.event.client_payload.pull_request.number }}
|
|
job: ${{ github.job }}
|
|
# Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run
|
|
conclusion: ${{ job.status }}
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
const { data: pull } = await github.pulls.get({
|
|
...context.repo,
|
|
pull_number: process.env.number
|
|
});
|
|
const ref = pull.head.sha;
|
|
|
|
const { data: checks } = await github.checks.listForRef({
|
|
...context.repo,
|
|
ref
|
|
});
|
|
|
|
const check = checks.check_runs.filter(c => c.name === process.env.job);
|
|
|
|
if(check.length == 0) {
|
|
const head_sha = pull.head.sha;
|
|
const { data: completed_at } = await github.checks.create({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
head_sha: head_sha,
|
|
name: process.env.job,
|
|
status: 'completed',
|
|
conclusion: process.env.conclusion,
|
|
output: {
|
|
title: "Build client result for ok to test",
|
|
summary: "https://github.com/" + process.env.repository + "/actions/runs/" + process.env.run_id
|
|
}
|
|
});
|
|
|
|
return completed_at;
|
|
} else {
|
|
const { data: result } = await github.checks.update({
|
|
...context.repo,
|
|
check_run_id: check[0].id,
|
|
status: 'completed',
|
|
conclusion: process.env.conclusion,
|
|
output: {
|
|
title: "Build client result for ok to test",
|
|
summary: "https://github.com/" + process.env.repository + "/actions/runs/" + process.env.run_id
|
|
}
|
|
});
|
|
|
|
return result;
|
|
}
|
|
|
|
# Set status = success
|
|
- run: echo "::set-output name=run_result::success" > ~/run_result
|
|
|
|
buildRts:
|
|
defaults:
|
|
run:
|
|
working-directory: app/rts
|
|
runs-on: ubuntu-latest
|
|
# Only run this workflow for internally triggered events
|
|
if: github.event_name == 'repository_dispatch' &&
|
|
github.event.client_payload.slash_command.sha != '' &&
|
|
contains(github.event.client_payload.pull_request.head.sha, github.event.client_payload.slash_command.sha)
|
|
|
|
steps:
|
|
# Checkout the code
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
# Timestamp will be used to create cache key
|
|
- id: timestamp
|
|
run: echo "::set-output name=timestamp::$(timestamp +'%Y-%m-%dT%H:%M:%S')"
|
|
|
|
# In case this is second attempt try restoring status of the prior attempt from cache
|
|
- name: Restore the previous run result
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/run_result
|
|
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}-
|
|
|
|
# Fetch prior run result
|
|
- name: Get the previous run result
|
|
id: run_result
|
|
run: cat ~/run_result 2>/dev/null || echo 'default'
|
|
|
|
# Incase of prior failure run the job
|
|
- if: steps.run_result.outputs.run_result != 'success'
|
|
run: echo "I'm alive!" && exit 0
|
|
|
|
- name: Use Node.js 14.15.4
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: "14.15.4"
|
|
|
|
# Here, the GITHUB_REF is of type /refs/head/<branch_name>. We extract branch_name from this by removing the
|
|
# first 11 characters. This can be used to build images for several branches
|
|
# Since this is an unreleased build, we get the latest released version number, increment the minor number in it,
|
|
# append a `-SNAPSHOT` at it's end to prepare the snapshot version number. This is used as the project's version.
|
|
- name: Get the version to tag the Docker image
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
id: vars
|
|
run: |
|
|
# Since this is an unreleased build, we set the version to incremented version number with a
|
|
# `-SNAPSHOT` suffix.
|
|
latest_released_version="$(git tag --list 'v*' --sort=-version:refname | head -1)"
|
|
echo "latest_released_version = $latest_released_version"
|
|
next_version="$(echo "$latest_released_version" | awk -F. -v OFS=. '{ $NF++; print }')"
|
|
echo "next_version = $next_version"
|
|
echo ::set-output name=version::$next_version-SNAPSHOT
|
|
echo ::set-output name=tag::$(echo ${GITHUB_REF:11})
|
|
|
|
- name: Build
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
run: |
|
|
echo 'export const VERSION = "${{ steps.vars.outputs.version }}"' > src/version.js
|
|
./build.sh
|
|
ls -l dist
|
|
|
|
# Restore the previous built bundle if present. If not push the newly built into the cache
|
|
- name: Restore the previous bundle
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
app/rts/dist/
|
|
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}
|
|
|
|
# Restore the previous built bundle if present. If not push the newly built into the cache
|
|
- name: Restore the previous bundle
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
app/rts/node_modules/
|
|
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}
|
|
|
|
# Upload the build artifact so that it can be used by the test & deploy job in the workflow
|
|
- name: Upload server build bundle
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: rts-build
|
|
path: app/rts/dist/
|
|
|
|
- name: Upload RTS dependencies bundle
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: rts-build-deps
|
|
path: app/rts/node_modules/
|
|
|
|
fat-conatiner-test:
|
|
needs: [build, server-build, buildRts]
|
|
# Only run if the build step is successful
|
|
if: success()
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
strategy:
|
|
fail-fast: false
|
|
|
|
# Service containers to run with this job. Required for running tests
|
|
services:
|
|
# Label used to access the service container
|
|
redis:
|
|
# Docker Hub image for Redis
|
|
image: redis
|
|
ports:
|
|
# Opens tcp port 6379 on the host and service container
|
|
- 6379:6379
|
|
mongo:
|
|
image: mongo
|
|
ports:
|
|
- 27017:27017
|
|
|
|
steps:
|
|
# Check out merge commit
|
|
- name: Fork based /ok-to-test checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: "refs/pull/${{ github.event.client_payload.pull_request.number }}/merge"
|
|
|
|
# Timestamp will be used to create cache key
|
|
- id: timestamp
|
|
run: echo "::set-output name=timestamp::$(timestamp +'%Y-%m-%dT%H:%M:%S')"
|
|
|
|
# In case this is second attempt try restoring status of the prior attempt from cache
|
|
- name: Restore the previous run result
|
|
uses: martijnhols/actions-cache@v3.0.2
|
|
with:
|
|
path: |
|
|
~/run_result
|
|
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}-${{ matrix.job }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}-${{ matrix.job }}
|
|
|
|
# Fetch prior run result
|
|
- name: Get the previous run result
|
|
id: run_result
|
|
run: cat ~/run_result 2>/dev/null || echo 'default'
|
|
|
|
# In case this is second attempt try restoring failed tests
|
|
- name: Restore the previous failed combine result
|
|
if: steps.run_result.outputs.run_result == 'failedtest'
|
|
uses: martijnhols/actions-cache/restore@v3
|
|
with:
|
|
path: |
|
|
~/combined_failed_spec
|
|
key: ${{ github.run_id }}-"ui-test-result"-${{ steps.timestamp.outputs.timestamp }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}
|
|
|
|
# failed_spec_env will contain list of all failed specs
|
|
# We are using evnironment variable instead of regular to support multiline
|
|
- name: Get failed_spec
|
|
if: steps.run_result.outputs.run_result == 'failedtest'
|
|
run: |
|
|
failed_spec_env=$(cat ~/combined_failed_spec)
|
|
echo "failed_spec_env<<EOF" >> $GITHUB_ENV
|
|
echo "$failed_spec_env" >> $GITHUB_ENV
|
|
echo "EOF" >> $GITHUB_ENV
|
|
|
|
- if: steps.run_result.outputs.run_result != 'success' && steps.run_result.outputs.run_result != 'failedtest'
|
|
run: echo "Starting full run" && exit 0
|
|
|
|
- if: steps.run_result.outputs.run_result == 'failedtest'
|
|
run: echo "Rerunning failed tests" && exit 0
|
|
|
|
- name: cat run_result
|
|
run: echo ${{ steps.run_result.outputs.run_result }}
|
|
|
|
# Setup Java
|
|
- name: Set up JDK 1.11
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
uses: actions/setup-java@v1
|
|
with:
|
|
java-version: "11.0.10"
|
|
|
|
- name: Download the react build artifact
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: build
|
|
path: app/client/build
|
|
|
|
- name: Download the server build artifact
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: build
|
|
path: app/server/dist/
|
|
|
|
- name: Download the rts build artifact
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: rts-build
|
|
path: app/rts/dist/
|
|
|
|
- name: Download the rts build artifact
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: rts-build-deps
|
|
path: app/rts/node_modules/
|
|
|
|
- name: Build docker image
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
working-directory: "."
|
|
run: |
|
|
docker build -t fatcontainer .
|
|
|
|
- name: Load docker image
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
env:
|
|
APPSMITH_LICENSE_KEY: ${{ secrets.APPSMITH_LICENSE_KEY }}
|
|
working-directory: "."
|
|
run: |
|
|
mkdir -p fatcontainerlocal/stacks/configuration/
|
|
cd fatcontainerlocal
|
|
docker run -d --name appsmith -p 80:80 -p 9001:9001 \
|
|
-v "$PWD/stacks:/appsmith-stacks" -e APPSMITH_LICENSE_KEY=$APPSMITH_LICENSE_KEY \
|
|
fatcontainer
|
|
|
|
- name: Use Node.js 14.15.4
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: "14.15.4"
|
|
|
|
# Install all the dependencies
|
|
- name: Install dependencies
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
run: |
|
|
cd app/client
|
|
yarn install
|
|
|
|
- name: Setting up the cypress tests
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
shell: bash
|
|
env:
|
|
APPSMITH_SSL_CERTIFICATE: ${{ secrets.APPSMITH_SSL_CERTIFICATE }}
|
|
APPSMITH_SSL_KEY: ${{ secrets.APPSMITH_SSL_KEY }}
|
|
CYPRESS_URL: ${{ secrets.CYPRESS_URL }}
|
|
CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }}
|
|
CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }}
|
|
CYPRESS_TESTUSERNAME1: ${{ secrets.CYPRESS_TESTUSERNAME1 }}
|
|
CYPRESS_TESTPASSWORD1: ${{ secrets.CYPRESS_TESTPASSWORD1 }}
|
|
CYPRESS_TESTUSERNAME2: ${{ secrets.CYPRESS_TESTUSERNAME2 }}
|
|
CYPRESS_TESTPASSWORD2: ${{ secrets.CYPRESS_TESTPASSWORD1 }}
|
|
CYPRESS_S3_ACCESS_KEY: ${{ secrets.CYPRESS_S3_ACCESS_KEY }}
|
|
CYPRESS_S3_SECRET_KEY: ${{ secrets.CYPRESS_S3_SECRET_KEY }}
|
|
CYPRESS_GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.CYPRESS_GITHUB_PERSONAL_ACCESS_TOKEN }}
|
|
CYPRESS_TEST_GITHUB_USER_NAME: ${{ secrets.CYPRESS_TEST_GITHUB_USER_NAME }}
|
|
CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_ID: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_ID }}
|
|
CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET }}
|
|
CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_ID: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_ID }}
|
|
CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET }}
|
|
APPSMITH_DISABLE_TELEMETRY: true
|
|
APPSMITH_GOOGLE_MAPS_API_KEY: ${{ secrets.APPSMITH_GOOGLE_MAPS_API_KEY }}
|
|
POSTGRES_PASSWORD: postgres
|
|
run: |
|
|
cd app/client
|
|
chmod a+x ./cypress/setup-test-fat.sh
|
|
./cypress/setup-test-fat.sh
|
|
|
|
- name: Run the cypress test
|
|
if: steps.run_result.outputs.run_result != 'success' && steps.run_result.outputs.run_result != 'failedtest'
|
|
uses: cypress-io/github-action@v2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
|
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
|
|
CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }}
|
|
CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }}
|
|
CYPRESS_TESTUSERNAME1: ${{ secrets.CYPRESS_TESTUSERNAME1 }}
|
|
CYPRESS_TESTPASSWORD1: ${{ secrets.CYPRESS_TESTPASSWORD1 }}
|
|
CYPRESS_TESTUSERNAME2: ${{ secrets.CYPRESS_TESTUSERNAME2 }}
|
|
CYPRESS_TESTPASSWORD2: ${{ secrets.CYPRESS_TESTPASSWORD1 }}
|
|
CYPRESS_S3_ACCESS_KEY: ${{ secrets.CYPRESS_S3_ACCESS_KEY }}
|
|
CYPRESS_S3_SECRET_KEY: ${{ secrets.CYPRESS_S3_SECRET_KEY }}
|
|
CYPRESS_GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.CYPRESS_GITHUB_PERSONAL_ACCESS_TOKEN }}
|
|
CYPRESS_TEST_GITHUB_USER_NAME: ${{ secrets.CYPRESS_TEST_GITHUB_USER_NAME }}
|
|
CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_ID: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_ID }}
|
|
CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET }}
|
|
CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_ID: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_ID }}
|
|
CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET }}
|
|
APPSMITH_DISABLE_TELEMETRY: true
|
|
APPSMITH_GOOGLE_MAPS_API_KEY: ${{ secrets.APPSMITH_GOOGLE_MAPS_API_KEY }}
|
|
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
|
|
with:
|
|
browser: chrome
|
|
headless: true
|
|
record: true
|
|
install: false
|
|
parallel: true
|
|
config-file: cypress_fat.json
|
|
group: "Electrons on Github Action Fat Container"
|
|
spec: "cypress/integration/Smoke_TestSuite_Fat/**/*"
|
|
working-directory: app/client
|
|
# tag will be either "push" or "pull_request"
|
|
tag: ${{ github.event_name }}
|
|
env: "NODE_ENV=development"
|
|
|
|
# Incase of second attemtp only run failed specs
|
|
- name: Run the cypress test with failed tests
|
|
if: steps.run_result.outputs.run_result == 'failedtest'
|
|
uses: cypress-io/github-action@v2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
|
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
|
|
CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }}
|
|
CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }}
|
|
CYPRESS_TESTUSERNAME1: ${{ secrets.CYPRESS_TESTUSERNAME1 }}
|
|
CYPRESS_TESTPASSWORD1: ${{ secrets.CYPRESS_TESTPASSWORD1 }}
|
|
CYPRESS_TESTUSERNAME2: ${{ secrets.CYPRESS_TESTUSERNAME2 }}
|
|
CYPRESS_TESTPASSWORD2: ${{ secrets.CYPRESS_TESTPASSWORD1 }}
|
|
CYPRESS_S3_ACCESS_KEY: ${{ secrets.CYPRESS_S3_ACCESS_KEY }}
|
|
CYPRESS_S3_SECRET_KEY: ${{ secrets.CYPRESS_S3_SECRET_KEY }}
|
|
CYPRESS_GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.CYPRESS_GITHUB_PERSONAL_ACCESS_TOKEN }}
|
|
CYPRESS_TEST_GITHUB_USER_NAME: ${{ secrets.CYPRESS_TEST_GITHUB_USER_NAME }}
|
|
CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_ID: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_ID }}
|
|
CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET }}
|
|
CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_ID: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_ID }}
|
|
CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET }}
|
|
APPSMITH_DISABLE_TELEMETRY: true
|
|
APPSMITH_GOOGLE_MAPS_API_KEY: ${{ secrets.APPSMITH_GOOGLE_MAPS_API_KEY }}
|
|
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
|
|
with:
|
|
browser: chrome
|
|
headless: true
|
|
record: true
|
|
install: false
|
|
parallel: true
|
|
config-file: cypress_fat.json
|
|
group: "Electrons on Github Action"
|
|
spec: ${{ env.failed_spec_env }}
|
|
working-directory: app/client
|
|
# tag will be either "push" or "pull_request"
|
|
tag: ${{ github.event_name }}
|
|
env: "NODE_ENV=development"
|
|
|
|
# Set status = failedtest
|
|
- name: Set fail if there are test failures
|
|
if: failure()
|
|
run: echo "::set-output name=run_result::failedtest" > ~/run_result
|
|
|
|
# Create a directory ~/failed_spec and add a dummy file
|
|
# This will ensure upload and download steps are successfull
|
|
- name: Create direcotrs for failed tests
|
|
if: always()
|
|
run: |
|
|
mkdir -p ~/failed_spec
|
|
echo "empty" >> ~/failed_spec/dummy-${{ matrix.job }}
|
|
|
|
# add list failed tests to a file
|
|
- name: Incase of test failures copy them to a file
|
|
if: failure()
|
|
run: |
|
|
cd ${{ github.workspace }}/app/client/cypress/
|
|
find screenshots -type d|grep -i spec |sed 's/screenshots/cypress\/integration/g' > ~/failed_spec/failed_spec-${{ matrix.job }}
|
|
|
|
# Upload failed test list using common path for all matrix job
|
|
- name: Upload failed test list artifact
|
|
if: always()
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: failed-spec
|
|
path: ~/failed_spec
|
|
|
|
# Force store previous run result to cache
|
|
- name: Store the previous run result
|
|
if: failure()
|
|
uses: martijnhols/actions-cache/save@v3
|
|
with:
|
|
path: |
|
|
~/run_result
|
|
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}-${{ matrix.job }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}-${{ matrix.job }}
|
|
|
|
# Force store previous failed test list to cache
|
|
- name: Store the previous failed test result
|
|
if: failure()
|
|
uses: martijnhols/actions-cache/save@v3
|
|
with:
|
|
path: |
|
|
~/failed_spec
|
|
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}-${{ matrix.job }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}-${{ matrix.job }}
|
|
|
|
# Upload the screenshots as artifacts if there's a failure
|
|
- uses: actions/upload-artifact@v1
|
|
if: failure()
|
|
with:
|
|
name: cypress-screenshots-${{ matrix.job }}
|
|
path: app/client/cypress/screenshots/
|
|
|
|
- name: Restore the previous bundle
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
app/client/cypress/snapshots/
|
|
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}-${{ matrix.job }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}-${{ matrix.job }}
|
|
|
|
# Upload the snapshots as artifacts for layout validation
|
|
- uses: actions/upload-artifact@v1
|
|
with:
|
|
name: cypress-snapshots-visualRegression
|
|
path: app/client/cypress/snapshots/
|
|
|
|
# Upload the log artifact so that it can be used by the test & deploy job in the workflow
|
|
- name: Upload server logs bundle on failure
|
|
uses: actions/upload-artifact@v2
|
|
if: failure()
|
|
with:
|
|
name: server-logs-${{ matrix.job }}
|
|
path: app/server/server-logs.log
|
|
|
|
# Set status = success
|
|
- run: echo "::set-output name=run_result::success" > ~/run_result
|
|
|
|
ui-test:
|
|
needs: [build, server-build]
|
|
# Only run if the build step is successful
|
|
if: success()
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: app/client
|
|
shell: bash
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
job: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
|
|
|
|
# Service containers to run with this job. Required for running tests
|
|
services:
|
|
# Label used to access the service container
|
|
redis:
|
|
# Docker Hub image for Redis
|
|
image: redis
|
|
ports:
|
|
# Opens tcp port 6379 on the host and service container
|
|
- 6379:6379
|
|
mongo:
|
|
image: mongo
|
|
ports:
|
|
- 27017:27017
|
|
|
|
steps:
|
|
# Check out merge commit
|
|
- name: Fork based /ok-to-test checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: "refs/pull/${{ github.event.client_payload.pull_request.number }}/merge"
|
|
|
|
# Timestamp will be used to create cache key
|
|
- id: timestamp
|
|
run: echo "::set-output name=timestamp::$(timestamp +'%Y-%m-%dT%H:%M:%S')"
|
|
|
|
# In case this is second attempt try restoring status of the prior attempt from cache
|
|
- name: Restore the previous run result
|
|
uses: martijnhols/actions-cache@v3.0.2
|
|
with:
|
|
path: |
|
|
~/run_result
|
|
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}-${{ matrix.job }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}-${{ matrix.job }}
|
|
|
|
# Fetch prior run result
|
|
- name: Get the previous run result
|
|
id: run_result
|
|
run: cat ~/run_result 2>/dev/null || echo 'default'
|
|
|
|
# In case this is second attempt try restoring failed tests
|
|
- name: Restore the previous failed combine result
|
|
if: steps.run_result.outputs.run_result == 'failedtest'
|
|
uses: martijnhols/actions-cache/restore@v3
|
|
with:
|
|
path: |
|
|
~/combined_failed_spec
|
|
key: ${{ github.run_id }}-"ui-test-result"-${{ steps.timestamp.outputs.timestamp }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}
|
|
|
|
# failed_spec_env will contain list of all failed specs
|
|
# We are using evnironment variable instead of regular to support multiline
|
|
- name: Get failed_spec
|
|
if: steps.run_result.outputs.run_result == 'failedtest'
|
|
run: |
|
|
failed_spec_env=$(cat ~/combined_failed_spec)
|
|
echo "failed_spec_env<<EOF" >> $GITHUB_ENV
|
|
echo "$failed_spec_env" >> $GITHUB_ENV
|
|
echo "EOF" >> $GITHUB_ENV
|
|
|
|
- if: steps.run_result.outputs.run_result != 'success' && steps.run_result.outputs.run_result != 'failedtest'
|
|
run: echo "Starting full run" && exit 0
|
|
|
|
- if: steps.run_result.outputs.run_result == 'failedtest'
|
|
run: echo "Rerunning failed tests" && exit 0
|
|
|
|
- name: cat run_result
|
|
run: echo ${{ steps.run_result.outputs.run_result }}
|
|
|
|
- name: Use Node.js 14.15.4
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: "14.15.4"
|
|
|
|
- name: Get yarn cache directory path
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
id: yarn-dep-cache-dir-path
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
# Retrieve npm dependencies from cache. After a successful run, these dependencies are cached again
|
|
- name: Cache npm dependencies
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
id: yarn-dep-cache
|
|
uses: actions/cache@v2
|
|
env:
|
|
cache-name: cache-yarn-dependencies
|
|
with:
|
|
path: |
|
|
${{ steps.yarn-dep-cache-dir-path.outputs.dir }}
|
|
key: ${{ runner.os }}-yarn-dep-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-yarn-dep-
|
|
|
|
# Install all the dependencies
|
|
- name: Install dependencies
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
run: yarn install --frozen-lockfile
|
|
|
|
- name: Download the react build artifact
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: build
|
|
path: app/client/build
|
|
|
|
- name: Download the server build artifact
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: build
|
|
path: app/server/dist
|
|
|
|
# Start server
|
|
- name: start server
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
working-directory: app/server
|
|
env:
|
|
APPSMITH_MONGODB_URI: "mongodb://localhost:27017/mobtools"
|
|
APPSMITH_REDIS_URL: "redis://127.0.0.1:6379"
|
|
APPSMITH_ENCRYPTION_PASSWORD: "password"
|
|
APPSMITH_ENCRYPTION_SALT: "salt"
|
|
APPSMITH_IS_SELF_HOSTED: false
|
|
APPSMITH_CLOUD_SERVICES_BASE_URL: https://release-cs.appsmith.com
|
|
APPSMITH_CLOUD_SERVICES_USERNAME: ""
|
|
APPSMITH_CLOUD_SERVICES_PASSWORD: ""
|
|
APPSMITH_GIT_ROOT: "./container-volumes/git-storage"
|
|
run: |
|
|
ls -l
|
|
ls -l scripts/
|
|
ls -l dist/
|
|
# Run the server in the background and redirect logs to a log file
|
|
./scripts/start-dev-server.sh &> server-logs.log &
|
|
|
|
- name: Wait for 30 seconds for server to start
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
run: |
|
|
sleep 30s
|
|
|
|
- name: Exit if Server hasnt started
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
run: |
|
|
if [[ `ps -ef | grep "server-1.0-SNAPSHOT" | grep java |wc -l` == 0 ]]; then
|
|
echo "Server Not Started";
|
|
exit 1;
|
|
else
|
|
echo "Server Found";
|
|
fi
|
|
|
|
- name: Installing Yarn serve
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
run: |
|
|
yarn global add serve
|
|
echo "$(yarn global bin)" >> $GITHUB_PATH
|
|
|
|
- name: Setting up the cypress tests
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
shell: bash
|
|
env:
|
|
APPSMITH_SSL_CERTIFICATE: ${{ secrets.APPSMITH_SSL_CERTIFICATE }}
|
|
APPSMITH_SSL_KEY: ${{ secrets.APPSMITH_SSL_KEY }}
|
|
CYPRESS_URL: ${{ secrets.CYPRESS_URL }}
|
|
CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }}
|
|
CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }}
|
|
CYPRESS_TESTUSERNAME1: ${{ secrets.CYPRESS_TESTUSERNAME1 }}
|
|
CYPRESS_TESTPASSWORD1: ${{ secrets.CYPRESS_TESTPASSWORD1 }}
|
|
CYPRESS_TESTUSERNAME2: ${{ secrets.CYPRESS_TESTUSERNAME2 }}
|
|
CYPRESS_TESTPASSWORD2: ${{ secrets.CYPRESS_TESTPASSWORD1 }}
|
|
CYPRESS_S3_ACCESS_KEY: ${{ secrets.CYPRESS_S3_ACCESS_KEY }}
|
|
CYPRESS_S3_SECRET_KEY: ${{ secrets.CYPRESS_S3_SECRET_KEY }}
|
|
CYPRESS_GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.CYPRESS_GITHUB_PERSONAL_ACCESS_TOKEN }}
|
|
CYPRESS_TEST_GITHUB_USER_NAME: ${{ secrets.CYPRESS_TEST_GITHUB_USER_NAME }}
|
|
CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_ID: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_ID }}
|
|
CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET }}
|
|
CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_ID: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_ID }}
|
|
CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET }}
|
|
APPSMITH_DISABLE_TELEMETRY: true
|
|
APPSMITH_GOOGLE_MAPS_API_KEY: ${{ secrets.APPSMITH_GOOGLE_MAPS_API_KEY }}
|
|
POSTGRES_PASSWORD: postgres
|
|
run: |
|
|
./cypress/setup-test.sh
|
|
|
|
- name: Run the cypress test
|
|
if: steps.run_result.outputs.run_result != 'success' && steps.run_result.outputs.run_result != 'failedtest'
|
|
uses: cypress-io/github-action@v2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
|
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
|
|
CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }}
|
|
CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }}
|
|
CYPRESS_TESTUSERNAME1: ${{ secrets.CYPRESS_TESTUSERNAME1 }}
|
|
CYPRESS_TESTPASSWORD1: ${{ secrets.CYPRESS_TESTPASSWORD1 }}
|
|
CYPRESS_TESTUSERNAME2: ${{ secrets.CYPRESS_TESTUSERNAME2 }}
|
|
CYPRESS_TESTPASSWORD2: ${{ secrets.CYPRESS_TESTPASSWORD1 }}
|
|
CYPRESS_S3_ACCESS_KEY: ${{ secrets.CYPRESS_S3_ACCESS_KEY }}
|
|
CYPRESS_S3_SECRET_KEY: ${{ secrets.CYPRESS_S3_SECRET_KEY }}
|
|
CYPRESS_GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.CYPRESS_GITHUB_PERSONAL_ACCESS_TOKEN }}
|
|
CYPRESS_TEST_GITHUB_USER_NAME: ${{ secrets.CYPRESS_TEST_GITHUB_USER_NAME }}
|
|
CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_ID: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_ID }}
|
|
CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET }}
|
|
CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_ID: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_ID }}
|
|
CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET }}
|
|
APPSMITH_DISABLE_TELEMETRY: true
|
|
APPSMITH_GOOGLE_MAPS_API_KEY: ${{ secrets.APPSMITH_GOOGLE_MAPS_API_KEY }}
|
|
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
|
|
with:
|
|
browser: chrome
|
|
headless: true
|
|
record: true
|
|
install: false
|
|
parallel: true
|
|
group: "Electrons on Github Action"
|
|
spec: "cypress/integration/Smoke_TestSuite/**/*"
|
|
working-directory: app/client
|
|
# tag will be either "push" or "pull_request"
|
|
tag: ${{ github.event_name }}
|
|
env: "NODE_ENV=development"
|
|
|
|
# Incase of second attemtp only run failed specs
|
|
- name: Run the cypress test with failed tests
|
|
if: steps.run_result.outputs.run_result == 'failedtest'
|
|
uses: cypress-io/github-action@v2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
|
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
|
|
CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }}
|
|
CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }}
|
|
CYPRESS_TESTUSERNAME1: ${{ secrets.CYPRESS_TESTUSERNAME1 }}
|
|
CYPRESS_TESTPASSWORD1: ${{ secrets.CYPRESS_TESTPASSWORD1 }}
|
|
CYPRESS_TESTUSERNAME2: ${{ secrets.CYPRESS_TESTUSERNAME2 }}
|
|
CYPRESS_TESTPASSWORD2: ${{ secrets.CYPRESS_TESTPASSWORD1 }}
|
|
CYPRESS_S3_ACCESS_KEY: ${{ secrets.CYPRESS_S3_ACCESS_KEY }}
|
|
CYPRESS_S3_SECRET_KEY: ${{ secrets.CYPRESS_S3_SECRET_KEY }}
|
|
CYPRESS_GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.CYPRESS_GITHUB_PERSONAL_ACCESS_TOKEN }}
|
|
CYPRESS_TEST_GITHUB_USER_NAME: ${{ secrets.CYPRESS_TEST_GITHUB_USER_NAME }}
|
|
CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_ID: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_ID }}
|
|
CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET }}
|
|
CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_ID: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_ID }}
|
|
CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET }}
|
|
APPSMITH_DISABLE_TELEMETRY: true
|
|
APPSMITH_GOOGLE_MAPS_API_KEY: ${{ secrets.APPSMITH_GOOGLE_MAPS_API_KEY }}
|
|
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
|
|
with:
|
|
browser: chrome
|
|
headless: true
|
|
record: true
|
|
install: false
|
|
parallel: true
|
|
group: "Electrons on Github Action"
|
|
spec: ${{ env.failed_spec_env }}
|
|
working-directory: app/client
|
|
# tag will be either "push" or "pull_request"
|
|
tag: ${{ github.event_name }}
|
|
env: "NODE_ENV=development"
|
|
|
|
# Set status = failedtest
|
|
- name: Set fail if there are test failures
|
|
if: failure()
|
|
run: echo "::set-output name=run_result::failedtest" > ~/run_result
|
|
|
|
# Create a directory ~/failed_spec and add a dummy file
|
|
# This will ensure upload and download steps are successfull
|
|
- name: Create direcotrs for failed tests
|
|
if: always()
|
|
run: |
|
|
mkdir -p ~/failed_spec
|
|
echo "empty" >> ~/failed_spec/dummy-${{ matrix.job }}
|
|
|
|
# add list failed tests to a file
|
|
- name: Incase of test failures copy them to a file
|
|
if: failure()
|
|
run: |
|
|
cd ${{ github.workspace }}/app/client/cypress/
|
|
find screenshots -type d|grep -i spec |sed 's/screenshots/cypress\/integration/g' > ~/failed_spec/failed_spec-${{ matrix.job }}
|
|
|
|
# Upload failed test list using common path for all matrix job
|
|
- name: Upload failed test list artifact
|
|
if: always()
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: failed-spec
|
|
path: ~/failed_spec
|
|
|
|
# Force store previous run result to cache
|
|
- name: Store the previous run result
|
|
if: failure()
|
|
uses: martijnhols/actions-cache/save@v3
|
|
with:
|
|
path: |
|
|
~/run_result
|
|
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}-${{ matrix.job }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}-${{ matrix.job }}
|
|
|
|
# Force store previous failed test list to cache
|
|
- name: Store the previous failed test result
|
|
if: failure()
|
|
uses: martijnhols/actions-cache/save@v3
|
|
with:
|
|
path: |
|
|
~/failed_spec
|
|
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}-${{ matrix.job }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}-${{ matrix.job }}
|
|
|
|
- name: Restore the previous bundle
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
app/client/cypress/snapshots/
|
|
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}-${{ matrix.job }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}-${{ matrix.job }}
|
|
|
|
# Upload the screenshots as artifacts if there's a failure
|
|
- uses: actions/upload-artifact@v1
|
|
if: failure()
|
|
with:
|
|
name: cypress-screenshots-${{ matrix.job }}
|
|
path: app/client/cypress/screenshots/
|
|
|
|
# Upload the log artifact so that it can be used by the test & deploy job in the workflow
|
|
- name: Upload server logs bundle on failure
|
|
uses: actions/upload-artifact@v2
|
|
if: failure()
|
|
with:
|
|
name: server-logs-${{ matrix.job }}
|
|
path: app/server/server-logs.log
|
|
|
|
# Set status = success
|
|
- run: echo "::set-output name=run_result::success" > ~/run_result
|
|
|
|
ui-test-result:
|
|
needs: [ui-test, fat-conatiner-test]
|
|
# Only run if the ui-test with matrices step is successful
|
|
if: always()
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- name: Dump the client payload context
|
|
env:
|
|
PAYLOAD_CONTEXT: ${{ toJson(github.event.client_payload) }}
|
|
run: echo "$PAYLOAD_CONTEXT"
|
|
|
|
# Download failed_spec list for all jobs
|
|
- uses: actions/download-artifact@v2
|
|
if: needs.ui-test.result
|
|
id: download
|
|
with:
|
|
name: failed-spec
|
|
path: ~/failed_spec
|
|
|
|
# Incase for any uti-test job failure, create combined failed spec
|
|
- name: "combine all specs"
|
|
if: needs.ui-test.result != 'success'
|
|
run: cat ~/failed_spec/failed_spec* >> ~/combined_failed_spec
|
|
|
|
# Force save the failed spec list into a cache
|
|
- name: Store the combined run result
|
|
if: needs.ui-test.result
|
|
uses: martijnhols/actions-cache/save@v3
|
|
with:
|
|
path: |
|
|
~/combined_failed_spec
|
|
key: ${{ github.run_id }}-"ui-test-result"-${{ steps.timestamp.outputs.timestamp }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}
|
|
|
|
# Upload combined failed spec list to a file
|
|
# This is done for debugging.
|
|
- name: upload combined failed spec
|
|
if: needs.ui-test.result
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: combined_failed_spec
|
|
path: ~/combined_failed_spec
|
|
|
|
# Update check run called "ui-test-result"
|
|
- name: Mark ui-test-result job as complete
|
|
uses: actions/github-script@v1
|
|
id: update-check-run
|
|
if: ${{ always() }}
|
|
env:
|
|
run_id: ${{ github.run_id }}
|
|
repository: ${{ github.repository }}
|
|
number: ${{ github.event.client_payload.pull_request.number }}
|
|
job: ${{ github.job }}
|
|
# Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run
|
|
conclusion: ${{ job.status }}
|
|
matrix_result: ${{ toJson(needs.ui-test) }}
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
const { data: pull } = await github.pulls.get({
|
|
...context.repo,
|
|
pull_number: process.env.number
|
|
});
|
|
const ref = pull.head.sha;
|
|
|
|
const { data: checks } = await github.checks.listForRef({
|
|
...context.repo,
|
|
ref
|
|
});
|
|
|
|
const check = checks.check_runs.filter(c => c.name === process.env.job);
|
|
|
|
if(check.length == 0) {
|
|
const head_sha = pull.head.sha;
|
|
const { data: completed_at } = await github.checks.create({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
head_sha: head_sha,
|
|
name: process.env.job,
|
|
status: 'completed',
|
|
conclusion: JSON.parse(process.env.matrix_result).result,
|
|
output: {
|
|
title: "Integration tests result for ok to test",
|
|
summary: "https://github.com/" + process.env.repository + "/actions/runs/" + process.env.run_id
|
|
}
|
|
});
|
|
|
|
return completed_at;
|
|
} else {
|
|
try {
|
|
const { data: result } = await github.checks.update({
|
|
...context.repo,
|
|
check_run_id: check[0].id,
|
|
status: 'completed',
|
|
conclusion: JSON.parse(process.env.matrix_result).result,
|
|
output: {
|
|
title: "Integration tests result for ok to test",
|
|
summary: "https://github.com/" + process.env.repository + "/actions/runs/" + process.env.run_id
|
|
}
|
|
});
|
|
} catch(e) {
|
|
console.error({ error: e.message });
|
|
}
|
|
|
|
console.log({ result });
|
|
return result;
|
|
}
|
|
|
|
- name: Dump the client payload context
|
|
env:
|
|
PAYLOAD_CONTEXT: ${{ toJson(github.event.client_payload) }}
|
|
run: echo "$PAYLOAD_CONTEXT"
|
|
|
|
package:
|
|
needs: [ui-test, fat-conatiner-test]
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: app/client
|
|
# Run this job only if all the previous steps are a success and the reference if the release or master branch
|
|
if: success() && (github.ref == 'refs/heads/release' || github.ref == 'refs/heads/release-frozen' || github.ref == 'refs/heads/master')
|
|
|
|
steps:
|
|
# Update check run called "package"
|
|
- name: Mark package job as complete
|
|
uses: actions/github-script@v1
|
|
id: update-check-run
|
|
if: ${{ always() }}
|
|
env:
|
|
run_id: ${{ github.run_id }}
|
|
repository: ${{ github.repository }}
|
|
number: ${{ github.event.client_payload.pull_request.number }}
|
|
job: ${{ github.job }}
|
|
# Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run
|
|
conclusion: ${{ job.status }}
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
const { data: pull } = await github.pulls.get({
|
|
...context.repo,
|
|
pull_number: process.env.number
|
|
});
|
|
const ref = pull.head.sha;
|
|
|
|
const { data: checks } = await github.checks.listForRef({
|
|
...context.repo,
|
|
ref
|
|
});
|
|
|
|
const check = checks.check_runs.filter(c => c.name === process.env.job);
|
|
|
|
if(check.length == 0) {
|
|
const head_sha = pull.head.sha;
|
|
const { data: completed_at } = await github.checks.create({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
head_sha: head_sha,
|
|
name: process.env.job,
|
|
status: 'completed',
|
|
conclusion: process.env.conclusion,
|
|
output: {
|
|
title: "Package result for ok to test",
|
|
summary: "https://github.com/" + process.env.repository + "/actions/runs/" + process.env.run_id
|
|
}
|
|
});
|
|
|
|
return completed_at;
|
|
} else {
|
|
const { data: result } = await github.checks.update({
|
|
...context.repo,
|
|
check_run_id: check[0].id,
|
|
status: 'completed',
|
|
conclusion: process.env.conclusion,
|
|
output: {
|
|
title: "Package result for ok to test",
|
|
summary: "https://github.com/" + process.env.repository + "/actions/runs/" + process.env.run_id
|
|
}
|
|
});
|
|
|
|
return result;
|
|
}
|
|
perf-test:
|
|
needs: [build, server-build]
|
|
# Only run if the build step is successful
|
|
if: success()
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
machine: [ubuntu-latest,buildjet-4vcpu-ubuntu-2004]
|
|
runs-on: ${{ matrix.machine }}
|
|
defaults:
|
|
run:
|
|
working-directory: app/client
|
|
shell: bash
|
|
|
|
# Service containers to run with this job. Required for running tests
|
|
services:
|
|
# Label used to access the service container
|
|
redis:
|
|
# Docker Hub image for Redis
|
|
image: redis
|
|
ports:
|
|
# Opens tcp port 6379 on the host and service container
|
|
- 6379:6379
|
|
mongo:
|
|
image: mongo
|
|
ports:
|
|
- 27017:27017
|
|
|
|
steps:
|
|
# Check out merge commitGIT BRANCH
|
|
- name: Fork based /ok-to-test-perf checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: "refs/pull/${{ github.event.client_payload.pull_request.number }}/merge"
|
|
|
|
# Timestamp will be used to create cache key
|
|
- id: timestamp
|
|
run: echo "::set-output name=timestamp::$(timestamp +'%Y-%m-%dT%H:%M:%S')"
|
|
|
|
# In case this is second attempt try restoring status of the prior attempt from cache
|
|
- name: Restore the previous run result
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/run_result
|
|
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}-
|
|
|
|
# Fetch prior run result
|
|
- name: Get the previous run result
|
|
id: run_result
|
|
run: cat ~/run_result 2>/dev/null || echo 'default'
|
|
|
|
# Incase of prior failure run the job
|
|
- if: steps.run_result.outputs.run_result != 'success'
|
|
run: echo "I'm alive!" && exit 0
|
|
|
|
# Set status = success
|
|
- run: echo "::set-output name=run_result::success" > ~/run_result
|
|
|
|
- name: Use Node.js 14.15.4
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: "14.15.4"
|
|
|
|
- name: Get yarn cache directory path
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
id: yarn-dep-cache-dir-path
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
# Retrieve npm dependencies from cache. After a successful run, these dependencies are cached again
|
|
- name: Cache npm dependencies
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
id: yarn-dep-cache
|
|
uses: actions/cache@v2
|
|
env:
|
|
cache-name: cache-yarn-dependencies
|
|
with:
|
|
path: |
|
|
${{ steps.yarn-dep-cache-dir-path.outputs.dir }}
|
|
key: ${{ runner.os }}-yarn-dep-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-yarn-dep-
|
|
|
|
# Install all the dependencies
|
|
- name: Install dependencies
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
run: yarn install --frozen-lockfile
|
|
|
|
- name: Download the react build artifact
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: build
|
|
path: app/client/build
|
|
|
|
- name: Download the server build artifact
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: build
|
|
path: app/server/dist
|
|
|
|
# Start server
|
|
- name: start server
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
working-directory: app/server
|
|
env:
|
|
APPSMITH_MONGODB_URI: "mongodb://localhost:27017/mobtools"
|
|
APPSMITH_REDIS_URL: "redis://127.0.0.1:6379"
|
|
APPSMITH_ENCRYPTION_PASSWORD: "password"
|
|
APPSMITH_ENCRYPTION_SALT: "salt"
|
|
APPSMITH_IS_SELF_HOSTED: false
|
|
APPSMITH_CLOUD_SERVICES_BASE_URL: https://release-cs.appsmith.com
|
|
APPSMITH_CLOUD_SERVICES_USERNAME: ""
|
|
APPSMITH_CLOUD_SERVICES_PASSWORD: ""
|
|
APPSMITH_GIT_ROOT: "./container-volumes/git-storage"
|
|
run: |
|
|
ls -l
|
|
ls -l scripts/
|
|
ls -l dist/
|
|
# Run the server in the background and redirect logs to a log file
|
|
./scripts/start-dev-server.sh &> server-logs.log &
|
|
|
|
- name: Wait for 30 seconds for server to start
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
run: |
|
|
sleep 30s
|
|
|
|
- name: Exit if Server hasnt started
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
run: |
|
|
if [[ `ps -ef | grep "server-1.0-SNAPSHOT" | grep java |wc -l` == 0 ]]; then
|
|
echo "Server Not Started";
|
|
exit 1;
|
|
else
|
|
echo "Server Found";
|
|
fi
|
|
|
|
- name: Installing Yarn serve
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
run: |
|
|
yarn global add serve
|
|
echo "$(yarn global bin)" >> $GITHUB_PATH
|
|
|
|
- name: Setting up the perf tests
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
shell: bash
|
|
env:
|
|
APPSMITH_SSL_CERTIFICATE: ${{ secrets.APPSMITH_SSL_CERTIFICATE }}
|
|
APPSMITH_SSL_KEY: ${{ secrets.APPSMITH_SSL_KEY }}
|
|
CYPRESS_URL: ${{ secrets.CYPRESS_URL }}
|
|
CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }}
|
|
CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }}
|
|
CYPRESS_TESTUSERNAME1: ${{ secrets.CYPRESS_TESTUSERNAME1 }}
|
|
CYPRESS_TESTPASSWORD1: ${{ secrets.CYPRESS_TESTPASSWORD1 }}
|
|
CYPRESS_TESTUSERNAME2: ${{ secrets.CYPRESS_TESTUSERNAME2 }}
|
|
CYPRESS_TESTPASSWORD2: ${{ secrets.CYPRESS_TESTPASSWORD1 }}
|
|
CYPRESS_S3_ACCESS_KEY: ${{ secrets.CYPRESS_S3_ACCESS_KEY }}
|
|
CYPRESS_S3_SECRET_KEY: ${{ secrets.CYPRESS_S3_SECRET_KEY }}
|
|
CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_ID: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_ID }}
|
|
CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET }}
|
|
CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_ID: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_ID }}
|
|
CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET: ${{ secrets.CYPRESS_APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET }}
|
|
APPSMITH_DISABLE_TELEMETRY: true
|
|
APPSMITH_GOOGLE_MAPS_API_KEY: ${{ secrets.APPSMITH_GOOGLE_MAPS_API_KEY }}
|
|
POSTGRES_PASSWORD: postgres
|
|
run: |
|
|
./cypress/setup-test.sh
|
|
|
|
- name: Installing performance tests dependencies
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
working-directory: app/client/perf
|
|
shell: bash
|
|
run: yarn install --frozen-lockfile
|
|
|
|
- name: Change test script permissions
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
working-directory: app/client/perf
|
|
run: chmod +x ./start-test.sh
|
|
|
|
- name: Run performance tests
|
|
if: steps.run_result.outputs.run_result != 'success'
|
|
working-directory: app/client/perf
|
|
shell: bash
|
|
env:
|
|
APPSMITH_SSL_CERTIFICATE: ${{ secrets.APPSMITH_SSL_CERTIFICATE }}
|
|
APPSMITH_SSL_KEY: ${{ secrets.APPSMITH_SSL_KEY }}
|
|
CYPRESS_TESTUSERNAME1: ${{ secrets.CYPRESS_TESTUSERNAME9 }}
|
|
CYPRESS_TESTPASSWORD1: ${{ secrets.CYPRESS_TESTPASSWORD9 }}
|
|
APPSMITH_PERF_SUPABASE_SECRET: ${{ secrets.APPSMITH_PERF_SUPABASE_SECRET }}
|
|
APPSMITH_DISABLE_TELEMETRY: true
|
|
POSTGRES_PASSWORD: postgres
|
|
NODE_TLS_REJECT_UNAUTHORIZED: "0"
|
|
MACHINE: ${{matrix.machine}}
|
|
run: ./start-test.sh
|
|
|
|
# Restore the previous built bundle if present. If not push the newly built into the cache
|
|
- name: Restore the previous bundle
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
app/client/perf/traces
|
|
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
|
|
restore-keys: |
|
|
${{ github.run_id }}-${{ github.job }}
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: performance-summaries
|
|
path: app/client/perf/traces
|
|
|
|
- name: Read summary file
|
|
id: read_summary
|
|
uses: andstor/file-reader-action@v1
|
|
with:
|
|
path: app/client/perf/traces/reports/summary.md
|
|
|
|
- name: Add a comment with the results on the PR with link to workflow run
|
|
uses: peter-evans/create-or-update-comment@v1
|
|
with:
|
|
issue-number: ${{ github.event.client_payload.pull_request.number }}
|
|
body: |
|
|
UI Performance test run logs and artifacts: <https://github.com/appsmithorg/appsmith/actions/runs/${{ github.run_id }}>.
|
|
Commit: `${{ github.event.client_payload.slash_command.sha }}`.
|
|
Results: ${{ steps.read_summary.outputs.contents }}
|
|
|
|
# Set status = success
|
|
- run: echo "::set-output name=run_result::success" > ~/run_result
|