Skip to content

Commit

Permalink
Add pipeline for this repo
Browse files Browse the repository at this point in the history
- Move build output to 'dist' folder
- Cleanup vite.config.ts
- Add miner-test-project
- Change doc to use this project
- Add playwright test
  • Loading branch information
ivy-lli committed Feb 19, 2025
1 parent b801a94 commit 4ff4a17
Show file tree
Hide file tree
Showing 67 changed files with 2,148 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
extends: ['./configs/base.eslintrc.json', './configs/warnings.eslintrc.json', './configs/errors.eslintrc.json'],
ignorePatterns: ['**/{css,node_modules,lib}'],
ignorePatterns: ['**/{css,node_modules,lib}', 'vite.config.ts', 'playwright.config.ts'],
parserOptions: {
tsconfigRootDir: __dirname,
project: 'tsconfig.json'
Expand Down
13 changes: 2 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,10 @@ pack

*.log

**/browser-app/**
!**/browser-app/package.json

*.vsix

**/electron-app/**
!**/electron-app/package.json

report.xml
eslint.xml
playwright-report/*
**/test-results/*
playwright-report


tsconfig.*tsbuildinfo
build/
dist/
2 changes: 1 addition & 1 deletion .ivy/raise-build-plugin-version.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

mvn --batch-mode versions:set-property versions:commit -f playwright/glsp-test-project/pom.xml -Dproperty=project.build.plugin.version -DnewVersion=${2} -DallowSnapshots=true
mvn --batch-mode versions:set-property versions:commit -f tests/miner-test-project/pom.xml -Dproperty=project.build.plugin.version -DnewVersion=${2} -DallowSnapshots=true
3 changes: 1 addition & 2 deletions .ivy/raise-deps.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/bin/bash
set -e

sed -i -E "s/(\"@axonivy[^\"]*\"): \"[^\"]*\"/\1: \"~${1/SNAPSHOT/next}\"/" packages/*/package.json
sed -i -E "s/(\"@axonivy[^\"]*\"): \"[^\"]*\"/\1: \"~${1/SNAPSHOT/next}\"/" integration/*/package.json
sed -i -E "s/(\"@axonivy[^\"]*\"): \"[^\"]*\"/\1: \"~${1/SNAPSHOT/next}\"/" package.json
npm run update:axonivy:next
if [ "$DRY_RUN" = false ]; then
npm install
Expand Down
4 changes: 1 addition & 3 deletions .ivy/raise-version.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/bin/bash
set -e

mvn --batch-mode -f integration/viewer/pom.xml versions:set versions:commit -DnewVersion=${1}
mvn --batch-mode -f playwright/glsp-test-project/pom.xml versions:set versions:commit -DnewVersion=${1}
mvn --batch-mode -f playwright/tests/screenshots/pom.xml versions:set versions:commit -DnewVersion=${1}
mvn --batch-mode -f tests/miner-test-project/pom.xml versions:set versions:commit -DnewVersion=${1}

npm install
yarn lerna version ${1/SNAPSHOT/next} --no-git-tag-version --no-push --ignore-scripts --exact --yes
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"name": "Launch Viewer (Chrome)",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000?server=localhost:8081&mode=viewer&app=designer&pmv=workflow-demos&file=/processes/Humantask/ProcurementRequestParallel.p.json",
"url": "http://localhost:3000?server=localhost:8081&mode=viewer&app=designer&pmv=miner-test-project&file=/processes/Humantask/ProcurementRequestParallel.p.json",
"presentation": {
"group": "4. Standalone",
"order": 1
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ However, it's of course also possible to use another text editor.

### Launch config prerequisites

Project [workflow-demos](https://market.axonivy.com/workflow-demo) is required to be running in a [designer](https://dev.axonivy.com/download) on port 8081.
Project [miner-test-project](./tests/miner-test-project/) is required to be running in a [Pro Designer](https://dev.axonivy.com/download) on port 8081.

---

Expand All @@ -32,19 +32,19 @@ npm run package

## Running the process miner in VS Code

To start the viewer, you can start the **Launch Viewer** config directly inside VS Code. For this to work, the project **workflow-demos** is required to be running in a designer on port 8081.
To start the viewer, you can start the **Launch Viewer** config directly inside VS Code. For this to work, the project **miner-test-project** is required to be running in a Pro Designer on port 8081.

## Running the process miner via commandline

To start the viewer via cli, you can run `npm run dev`.<br>
The viewer will now run at `http://localhost:3000`. To access it you can open the URL in a browser. Following url parameter are required to open the **workflow-demos** with the default mock-mining-data:
The viewer will now run at `http://localhost:3000`. To access it you can open the URL in a browser. Following url parameter are required to open the **miner-test-project** with the default mock-mining-data:

- server=localhost:8081
- app=designer
- pmv=workflow-demos
- pmv=miner-test-project
- file=/processes/Humantask/ProcurementRequestParallel.p.json

e.g. [`http://localhost:3000?server=localhost:8081&app=designer&pmv=workflow-demos&file=/processes/Humantask/ProcurementRequestParallel.p.json`](http://localhost:3000?server=localhost:8081&app=designer&pmv=workflow-demos&file=/processes/Humantask/ProcurementRequestParallel.p.json)
e.g. [`http://localhost:3000?server=localhost:8081&app=designer&pmv=miner-test-project&file=/processes/Humantask/ProcurementRequestParallel.p.json`](http://localhost:3000?server=localhost:8081&app=designer&pmv=miner-test-project&file=/processes/Humantask/ProcurementRequestParallel.p.json)

## Mining-Data

Expand Down Expand Up @@ -77,7 +77,7 @@ The process-miner-viewer can now be used in any dialog using an iframe:

```xhtml
<iframe
src="/designer/faces/view/DemoProject/process-miner.xhtml?server=localhost:8081&amp;app=designer&amp;pmv=workflow-demos&amp;file=/processes/Humantask/ProcurementRequestParallel.p.json&amp;miningUrl=#{resource['resources/mock.json']}"
src="/designer/faces/view/DemoProject/process-miner.xhtml?server=localhost:8081&amp;app=designer&amp;pmv=miner-test-project&amp;file=/processes/Humantask/ProcurementRequestParallel.p.json&amp;miningUrl=#{resource['resources/mock.json']}"
width="1000"
height="900"
></iframe>
Expand Down
2 changes: 2 additions & 0 deletions build/Dockerfile.node
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM node:22.14-bookworm
ENV CI=true
16 changes: 16 additions & 0 deletions build/Dockerfile.playwright
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM mcr.microsoft.com/playwright:v1.50.1-jammy

RUN apt-get update &&\
apt-get install software-properties-common -y &&\
apt-add-repository universe -y &&\
apt-get update &&\
apt-get install openjdk-21-jdk -y

ARG MAVEN_VERSION=3.9.8
ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries

RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
&& curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
&& tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
&& rm -f /tmp/apache-maven.tar.gz \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
57 changes: 57 additions & 0 deletions build/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
pipeline {
agent any

options {
buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '5'))
}

triggers {
cron '@midnight'
}

parameters {
string(name: 'engineSource', defaultValue: 'https://product.ivyteam.io/', description: 'Engine page url')
}

stages {
stage('Build') {
steps {
script {
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
docker.build('node', '-f build/Dockerfile.node .').inside {
// sh 'npm run update:axonivy:next'
sh 'npm run ci'
}
}
archiveArtifacts artifacts: 'dist', allowEmptyArchive: true

withChecks('ESLint') {
recordIssues enabledForFailure: true, publishAllIssues: true, aggregatingResults: true, tools: [esLint(pattern: 'eslint.xml')], qualityGates: [[threshold: 1, type: 'TOTAL', unstable: true]]
}
}
}
}
stage('Integration Tests') {
steps {
script {
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
docker.build('node-webtest', '-f build/Dockerfile.playwright .').inside {
dir ('tests/miner-test-project') {
maven cmd: "-ntp verify -Dengine.page.url=${params.engineSource}"
}
}
}
archiveArtifacts artifacts: 'test-results/**', allowEmptyArchive: true
withChecks('Integration WebTest') {
junit testDataPublishers: [[$class: 'StabilityTestDataPublisher']], testResults: 'report.xml'
}
}
}
}
}
post {
always {
discoverGitReferenceBuild()
}
}
}
64 changes: 64 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@
"node": ">=20.10.0"
},
"volta": {
"node": "20.15.0"
"node": "22.11.0"
},
"scripts": {
"ci": "npm install && npm run build && npm run package && npm run lint:ci && npm run test:ci",
"lint:ci": "npm run lint -- -o eslint.xml -f checkstyle",
"ci": "npm install && npm run type && npm run package && npm run lint:ci",
"clean": "rimraf lib build/* tsconfig.tsbuildinfo",
"lint": "eslint --ext .ts,.tsx ./src",
"lint:ci": "npm run lint -- -o eslint.xml -f checkstyle",
"type": "tsc",
"package": "vite build",
"dev": "vite",
"serve": "vite preview",
"webtest": "playwright test",
"update:axonivy:next": "npx --yes npm-check-updates @axonivy* -t patch -u"
},
"dependencies": {
Expand All @@ -36,6 +37,7 @@
"@types/node": "^20.10.5",
"@typescript-eslint/eslint-plugin": "^8.2.0",
"@typescript-eslint/parser": "^8.2.0",
"@playwright/test": "1.50.1",
"eslint": "^8.56.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.29.1",
Expand Down
21 changes: 21 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { devices, defineConfig } from '@playwright/test';

export default defineConfig({
timeout: 1000 * (process.env.CI ? 60 : 30),
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
reporter: process.env.CI ? [['./tests/custom-reporter.ts'], ['junit', { outputFile: 'report.xml' }], ['list']] : 'html',
use: {
actionTimeout: 0,
baseURL: process.env.CI ? 'http://localhost:4173' : 'http://localhost:3000',
trace: 'retain-on-failure',
headless: process.env.CI ? true : false
},
webServer: {
command: `npm run ${process.env.CI ? 'serve' : 'dev'}`,
url: process.env.CI ? 'http://localhost:4173' : 'http://localhost:3000',
reuseExistingServer: !process.env.CI
},
projects: [{ name: 'chrome', use: { ...devices['Desktop Chrome'] }, testDir: './tests/viewer' }]
});
Loading

0 comments on commit 4ff4a17

Please sign in to comment.