mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-09 09:20:54 +00:00
Enable cpu profiling for ui tests (#9149)
Some checks are pending
CI / test (push) Blocked by required conditions
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / uitest-workspaces (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
Some checks are pending
CI / test (push) Blocked by required conditions
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / uitest-workspaces (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
d5919f3de9
commit
51cc82b175
50
.github/workflows/main.yml
vendored
50
.github/workflows/main.yml
vendored
@ -261,26 +261,26 @@ jobs:
|
||||
run: |
|
||||
cd ./tests/sanity
|
||||
node ../../common/scripts/install-run-rushx.js ci
|
||||
# - name: Start profiling
|
||||
# run: |
|
||||
# cd ./tests
|
||||
# ./profile-start.sh
|
||||
- name: Start profiling
|
||||
run: |
|
||||
cd ./tests
|
||||
./profile-start.sh
|
||||
- name: Run UI tests
|
||||
run: |
|
||||
cd ./tests/sanity
|
||||
node ../../common/scripts/install-run-rushx.js uitest
|
||||
# - name: Download profile
|
||||
# run: |
|
||||
# cd ./tests
|
||||
# ./profile-download.sh
|
||||
# npm install -g cpupro
|
||||
# ./profile-generate.sh
|
||||
# - name: Upload profiling results
|
||||
# if: always()
|
||||
# uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: profiling
|
||||
# path: ./tests/profiles
|
||||
- name: Download profile
|
||||
run: |
|
||||
cd ./tests
|
||||
./profile-download.sh
|
||||
npm install -g cpupro
|
||||
./profile-generate.sh
|
||||
- name: Upload profiling results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: profiling
|
||||
path: ./tests/profiles
|
||||
- name: 'Store docker logs'
|
||||
if: always()
|
||||
run: |
|
||||
@ -390,10 +390,26 @@ jobs:
|
||||
run: |
|
||||
cd ./tests/sanity
|
||||
node ../../common/scripts/install-run-rushx.js ci
|
||||
- name: Start profiling
|
||||
run: |
|
||||
cd ./tests
|
||||
./profile-start.sh
|
||||
- name: Run UI tests
|
||||
run: |
|
||||
cd ./tests/sanity
|
||||
node ../../common/scripts/install-run-rushx.js uitest
|
||||
- name: Download profile
|
||||
run: |
|
||||
cd ./tests
|
||||
./profile-download.sh
|
||||
npm install -g cpupro
|
||||
./profile-generate.sh
|
||||
- name: Upload profiling results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: profiling-pg
|
||||
path: ./tests/profiles
|
||||
- name: 'Store docker logs'
|
||||
if: always()
|
||||
run: |
|
||||
@ -589,7 +605,7 @@ jobs:
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Configure docker
|
||||
uses: crazy-max/ghaction-setup-docker@v3
|
||||
uses: docker/setup-docker-action@v4
|
||||
with:
|
||||
daemon-config: |
|
||||
{
|
||||
|
@ -110,6 +110,9 @@ import { performGmailAccountMigrations } from './gmail'
|
||||
import { getToolToken, getWorkspace, getWorkspaceTransactorEndpoint } from './utils'
|
||||
|
||||
import { createRestClient } from '@hcengineering/api-client'
|
||||
import { mkdir, writeFile } from 'fs/promises'
|
||||
import { basename, dirname } from 'path'
|
||||
import { existsSync } from 'fs'
|
||||
|
||||
const colorConstants = {
|
||||
colorRed: '\u001b[31m',
|
||||
@ -1682,6 +1685,33 @@ export function devTool (
|
||||
)
|
||||
})
|
||||
})
|
||||
program
|
||||
.command('profile <endpoint> <mode>')
|
||||
.description('Enable or disable profiling')
|
||||
.option('-o, --output <output>', 'Output file', 'profile.cpuprofile')
|
||||
.action(async (endpoint: string, mode: string, opt: { output: string }) => {
|
||||
const token = generateToken(systemAccountUuid, '' as WorkspaceUuid, { admin: 'true' })
|
||||
if (mode === 'start') {
|
||||
await fetch(`${endpoint}/api/v1/manage?token=${token}&operation=profile-start`, {
|
||||
method: 'PUT'
|
||||
})
|
||||
} else {
|
||||
const resp = await fetch(`${endpoint}/api/v1/manage?token=${token}&operation=profile-stop`, {
|
||||
method: 'PUT'
|
||||
})
|
||||
if (resp.ok) {
|
||||
const bdir = dirname(opt.output)
|
||||
if (!existsSync(bdir)) {
|
||||
await mkdir(bdir, { recursive: true })
|
||||
}
|
||||
const bytes = await resp.arrayBuffer()
|
||||
console.log('writing to', opt.output)
|
||||
await writeFile(opt.output, new Uint8Array(bytes))
|
||||
} else {
|
||||
console.error('failed to stop profile', resp.headers)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
program
|
||||
.command('generate-persons <workspace>')
|
||||
|
@ -1,5 +1,3 @@
|
||||
echo "Downloading profile"
|
||||
token=$(./tool.sh generate-token --admin anticrm@hc.engineering sanity-ws)
|
||||
current=$(date +%Y%m%d%H%M%S)
|
||||
mkdir -p ./profiles
|
||||
curl -X PUT "http://localhost:3334/api/v1/manage?token=${token}&operation=profile-stop" -o "./profiles/profile-${current}".cpuprofile
|
||||
./tool.sh profile http://localhost:3334 stop -o "./profiles/profile-${current}".cpuprofile
|
||||
|
@ -1,3 +1,2 @@
|
||||
echo "Start profiling on server"
|
||||
token=$(./tool.sh generate-token --admin anticrm@hc.engineering sanity-ws)
|
||||
curl -X PUT "http://localhost:3334/api/v1/manage?token=${token}&operation=profile-start"
|
||||
./tool.sh profile http://localhost:3334 start
|
||||
|
@ -1,5 +1,3 @@
|
||||
echo "Downloading profile"
|
||||
token=$(./tool.sh generate-token --admin anticrm@hc.engineering sanity-ws)
|
||||
current=$(date +%Y%m%d%H%M%S)
|
||||
mkdir -p ./profiles
|
||||
curl -X PUT "http://huly.local:3334/api/v1/manage?token=${token}&operation=profile-stop" -o "./profiles/profile-${current}".cpuprofile
|
||||
./tool.sh profile http://localhost:3335 stop -o "./profiles/profile-${current}".cpuprofile
|
||||
|
@ -1,3 +1,2 @@
|
||||
echo "Start profiling on server"
|
||||
token=$(./tool.sh generate-token --admin anticrm@hc.engineering sanity-ws)
|
||||
curl -X PUT "http://huly.local:3334/api/v1/manage?token=${token}&operation=profile-start"
|
||||
./tool-europe.sh profile http://localhost:3335 start
|
||||
|
Loading…
Reference in New Issue
Block a user