Skip to content

FOUR-12445 Removal of Cypress from Core #5671

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 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 25 additions & 41 deletions .github/workflows/deploy-pm4.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: BUILD-PM4
on:
on:
#push:
# branches:
# - kr-github-actions
pull_request:
types: [opened, reopened, synchronize, edited, closed]
schedule:
- cron: '30 2 * * *' # every day at midnight
- cron: '30 2 * * *' # every day at midnight
#workflow_dispatch:
#pull_request:
# branches:
Expand All @@ -22,15 +22,15 @@ env:
#MY_GITHUB_TOKEN: ${{ secrets.GH_STATUS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
#GIT_TOKEN: ${{ secrets.MY_GH_TOKEN }}
OWNER: ${{ github.event.pull_request.head.repo.owner.login }}
OWNER: ${{ github.event.pull_request.head.repo.owner.login }}
#Other Parameters
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
aws-region: ${{ secrets.AWS_REGION }}
aws-url: ${{ secrets.AWS_URL }}
STM_TOKEN: ${{ secrets.STM_TOKEN }}
CI_PACKAGE_BRANCH: ${{github.event.pull_request.head.ref || 'develop' }}
CI_PROJECT: ${{github.event.pull_request.head.repo.name || 'processmaker' }}
CI_PROJECT: ${{github.event.pull_request.head.repo.name || 'processmaker' }}
CI_TEST: $CI_PROJECT
IMAGE_TAG1: $(echo "$CI_PROJECT-$CI_PACKAGE_BRANCH" | sed "s;/;-;g")
GITHUB_COMMENT: ${{ secrets.GH_COMMENT }}
Expand All @@ -45,11 +45,11 @@ concurrency:
cancel-in-progress: true
jobs:
job1:
name: build-stm-image
name: build-stm-image
if: github.event.action != 'closed'
runs-on: ${{ vars.RUNNER }}
steps:
- name: Export Params
runs-on: ${{ vars.RUNNER }}
steps:
- name: Export Params
run: |
echo "Env Check: CI_PROJECT: $CI_PROJECT CI_PACKAGE_BRANCH: $CI_PACKAGE_BRANCH CI_PR_BODY: $CI_PR_BODY BASE: $BASE"
echo "REPOSITORY=${{env.aws-url}}/enterprise" >> $GITHUB_ENV
Expand Down Expand Up @@ -82,34 +82,34 @@ jobs:
cd pm4-stm-docker
docker-compose build processmaker
docker push ${IMAGE}
job2:
name: deploy-stm
job2:
name: deploy-stm
if: github.event.action != 'closed'
needs: job1
runs-on: ${{ vars.RUNNER }}
container:
image: cimg/php:7.4
options: --user root
steps:
- name: Export Params
- name: Export Params
run: |
echo "Env Check: CI_PROJECT: $CI_PROJECT CI_PACKAGE_BRANCH: $CI_PACKAGE_BRANCH CI_PR_BODY: $CI_PR_BODY"
echo "REPOSITORY=${{env.aws-url}}/enterprise" >> $GITHUB_ENV
echo "TAG=${{env.IMAGE_TAG1}}" >> $GITHUB_ENV
echo "IMAGE_TAG=${{env.IMAGE_TAG1}}" >> $GITHUB_ENV
echo "IMAGE=${{env.aws-url}}/enterprise:${{env.IMAGE_TAG1}}" >> $GITHUB_ENV
echo "STM_TOKEN=${{env.STM_TOKEN}}" >> $GITHUB_ENV
echo "STM_TOKEN=${{env.STM_TOKEN}}" >> $GITHUB_ENV
- name: Clone Repo STM
run: |
git clone --depth 1 -b cicd "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-stm-docker.git" pm4-stm-docker
cd pm4-stm-docker
cd pm4-stm-docker
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ env.aws-access-key-id }}
aws-secret-access-key: ${{ env.aws-secret-access-key }}
aws-region: ${{ env.aws-region }}
- name: Login to Amazon ECR
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Deploy STM
Expand All @@ -124,27 +124,27 @@ jobs:
fi
echo "Instance URL: '${INSTANCE_URL}'"
echo "INSTANCE_URL=${INSTANCE_URL}" >> "$GITHUB_ENV"
- name: Publish the URL to the Github PR
- name: Publish the URL to the Github PR
if: success() || steps.stm.conclusion == 'success'
run: |
cd pm4-stm-docker
echo "Instance URL: '${INSTANCE_URL}'"
bash ./github_comment.sh "$PROJECT" "$pull_req_id"
job3:
job3:
name: run-phpunit
if: github.event.action != 'closed'
needs: job1
runs-on: ${{ vars.RUNNER }}
steps:
- name: Export Params
- name: Export Params
run: |
echo "REPOSITORY=${{env.aws-url}}/enterprise" >> $GITHUB_ENV
echo "TAG=${{env.IMAGE_TAG1}}" >> $GITHUB_ENV
echo "IMAGE=${{env.aws-url}}/enterprise:${{env.IMAGE_TAG1}}" >> $GITHUB_ENV
echo "IMAGE=${{env.aws-url}}/enterprise:${{env.IMAGE_TAG1}}" >> $GITHUB_ENV
- name: Clone Repo STM
run: |
git clone --depth 1 -b cicd "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-stm-docker.git" pm4-stm-docker
cd pm4-stm-docker
cd pm4-stm-docker
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
Expand All @@ -161,49 +161,33 @@ jobs:
docker-compose down -v
docker-compose build phpunit
docker-compose run phpunit
#job4:
#job4:
# name: run-benchmarks
# needs: job2
# runs-on: ${{ vars.RUNNER }}
# steps:
# - name: my-step
# run: |
# echo "Fifth Step"
#job5:
# name: run-cypress
# needs: job2
# runs-on: ${{ vars.RUNNER }}
# steps:
# - name: my-step
# run: |
# echo "fourth Step"
#job6:
# name: run-cypress-qa
# needs: job2
# runs-on: ${{ vars.RUNNER }}
# steps:
# - name: my-step
# run: |
# echo "Sixt Step"
job7:
job7:
name: Delete Instance
if: github.event.action == 'closed'
runs-on: ${{ vars.RUNNER }}
container:
image: cimg/php:7.4
options: --user root
steps:
- name: Export Params
- name: Export Params
run: |
echo "REPOSITORY=${{env.aws-url}}/enterprise" >> $GITHUB_ENV
echo "TAG=${{env.IMAGE_TAG1}}" >> $GITHUB_ENV
echo "IMAGE_TAG=${{env.IMAGE_TAG1}}" >> $GITHUB_ENV
echo "IMAGE=${{env.aws-url}}/enterprise:${{env.IMAGE_TAG1}}" >> $GITHUB_ENV
echo "STM_TOKEN=${{env.STM_TOKEN}}" >> $GITHUB_ENV
echo "STM_TOKEN=${{env.STM_TOKEN}}" >> $GITHUB_ENV
- name: Clone Repo STM
run: |
git clone --depth 1 -b cicd "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-stm-docker.git" pm4-stm-docker
cd pm4-stm-docker
cd pm4-stm-docker
- name: Delete Instance STM
run: |
mkdir -p /tmp/workspace
Expand Down
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@ npm.sh
laravel-echo-server.lock
public/.htaccess
coverage
cypress/screenshots
cypress/videos
cypress/downloads
.phpunit.result.cache
.php-cs-fixer.cache
.phpunit.result.cache
.editorconfig
resources/lang/de
resources/lang/es
resources/lang/fr
resources/lang/fr
28 changes: 0 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ https://docs.processmaker.com/

## Testing
All PRs for PM4 and it's packages should be accompanied by a test.
Ideally both a PHPUnit test and a Cypress end-to-end test, but should have at least one.

## CI/CD

Expand Down Expand Up @@ -132,33 +131,6 @@ phpunit vendor/processmaker/package-name/tests/...
*It is considered a best practice to write a failing test first.
Then, modify the code until the test passes*

### Cypress End-To-End Tests
All cypress tests should go in the cypress/integration folder (or a subfolder).

Package tests should go in cypress/integration inside the package repository.
If the folder does not exist in the repository, please create it.

To open the cypress ui, run
```
CYPRESS_BASE_URL=http://my-local-pm4 npm run e2e:open
```
To run in headless mode (same as the CI server), run
```
CYPRESS_BASE_URL=http://my-local-pm4 npm run e2e
```
To run a single test, run
```
CYPRESS_BASE_URL=http://my-local-pm4 npm run e2e -- --spec=cypress/integration/my-test.spec.js
```
Individual tests in packages must be run from core with
```
CYPRESS_BASE_URL=http://my-local-pm4 npm run e2e -- --spec=vendor/processmaker/package-name/cypress/integration/my-test.spec.js
```

Note
- CYPRESS_BASE_URL should be the same as APP_URL in your .env file
- Cypress tests should not depend on a clean database like PHPUnit has

## Development

#### System Requirements
Expand Down
11 changes: 0 additions & 11 deletions cypress.json

This file was deleted.

1 change: 0 additions & 1 deletion cypress/fixtures/screen_error_alert.json

This file was deleted.

52 changes: 0 additions & 52 deletions cypress/integration/admin/admin.spec.js

This file was deleted.

43 changes: 0 additions & 43 deletions cypress/integration/designer/designer.spec.js

This file was deleted.

Loading