Update mock-server, upload ci logs on failure
This commit is contained in:
parent
21db47c423
commit
1d89ffcc2d
10 changed files with 83 additions and 10 deletions
12
.github/workflows/benchmark.yml
vendored
12
.github/workflows/benchmark.yml
vendored
|
@ -13,6 +13,7 @@ jobs:
|
|||
linux:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository == 'signalapp/Signal-Desktop-Private' }}
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- name: Get system specs
|
||||
|
@ -62,6 +63,7 @@ jobs:
|
|||
NODE_ENV: production
|
||||
RUN_COUNT: 10
|
||||
ELECTRON_ENABLE_STACK_DUMPING: on
|
||||
ARTIFACTS_DIR: artifacts/startup
|
||||
|
||||
- name: Run send benchmarks
|
||||
run: |
|
||||
|
@ -74,6 +76,7 @@ jobs:
|
|||
NODE_ENV: production
|
||||
RUN_COUNT: 100
|
||||
ELECTRON_ENABLE_STACK_DUMPING: on
|
||||
ARTIFACTS_DIR: artifacts/send
|
||||
|
||||
- name: Run group send benchmarks
|
||||
run: |
|
||||
|
@ -87,6 +90,7 @@ jobs:
|
|||
NODE_ENV: production
|
||||
RUN_COUNT: 100
|
||||
ELECTRON_ENABLE_STACK_DUMPING: on
|
||||
ARTIFACTS_DIR: artifacts/group-send
|
||||
|
||||
- name: Run conversation open benchmarks
|
||||
run: |
|
||||
|
@ -100,6 +104,14 @@ jobs:
|
|||
NODE_ENV: production
|
||||
RUN_COUNT: 100
|
||||
ELECTRON_ENABLE_STACK_DUMPING: on
|
||||
ARTIFACTS_DIR: artifacts/convo-open
|
||||
|
||||
- name: Upload benchmark logs on failure
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: logs
|
||||
path: artifacts
|
||||
|
||||
- name: Clone benchmark repo
|
||||
uses: actions/checkout@v2
|
||||
|
|
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
|
@ -12,6 +12,7 @@ on:
|
|||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- run: lsb_release -a
|
||||
|
@ -42,6 +43,7 @@ jobs:
|
|||
needs: lint
|
||||
runs-on: macos-11.0
|
||||
if: github.ref == 'refs/heads/development' || github.ref == 'refs/heads/master'
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- run: uname -a
|
||||
|
@ -70,6 +72,7 @@ jobs:
|
|||
run: yarn electron:install-app-deps
|
||||
- run: yarn test-node
|
||||
- run: yarn test-electron
|
||||
timeout-minutes: 5
|
||||
- run: yarn test-release
|
||||
env:
|
||||
NODE_ENV: production
|
||||
|
@ -77,6 +80,7 @@ jobs:
|
|||
linux:
|
||||
needs: lint
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- run: lsb_release -a
|
||||
|
@ -105,6 +109,7 @@ jobs:
|
|||
DISABLE_INSPECT_FUSE: on
|
||||
- run: xvfb-run --auto-servernum yarn test-node
|
||||
- run: xvfb-run --auto-servernum yarn test-electron
|
||||
timeout-minutes: 5
|
||||
env:
|
||||
LANG: en_US
|
||||
LANGUAGE: en_US
|
||||
|
@ -114,7 +119,8 @@ jobs:
|
|||
|
||||
windows:
|
||||
needs: lint
|
||||
runs-on: windows-latest
|
||||
runs-on: windows-2019
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- run: systeminfo
|
||||
|
@ -146,6 +152,7 @@ jobs:
|
|||
env:
|
||||
DISABLE_INSPECT_FUSE: on
|
||||
- run: yarn test-electron
|
||||
timeout-minutes: 5
|
||||
- run: yarn test-release
|
||||
env:
|
||||
SIGNAL_ENV: production
|
||||
|
@ -154,6 +161,7 @@ jobs:
|
|||
needs: lint
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository == 'signalapp/Signal-Desktop-Private' }}
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- name: Get system specs
|
||||
|
|
|
@ -185,7 +185,7 @@
|
|||
"@babel/preset-typescript": "7.16.0",
|
||||
"@chanzuckerberg/axe-storybook-testing": "3.0.2",
|
||||
"@electron/fuses": "1.5.0",
|
||||
"@signalapp/mock-server": "1.1.0",
|
||||
"@signalapp/mock-server": "1.1.1",
|
||||
"@storybook/addon-actions": "5.1.11",
|
||||
"@storybook/addon-knobs": "5.1.11",
|
||||
"@storybook/addons": "5.1.11",
|
||||
|
|
|
@ -4,7 +4,14 @@
|
|||
|
||||
import type { PrimaryDevice } from '@signalapp/mock-server';
|
||||
|
||||
import { Bootstrap, debug, stats, RUN_COUNT, DISCARD_COUNT } from './fixtures';
|
||||
import {
|
||||
Bootstrap,
|
||||
debug,
|
||||
saveLogs,
|
||||
stats,
|
||||
RUN_COUNT,
|
||||
DISCARD_COUNT,
|
||||
} from './fixtures';
|
||||
|
||||
const CONVERSATION_SIZE = 1000; // messages
|
||||
const DELAY = 50; // milliseconds
|
||||
|
@ -94,6 +101,9 @@ const DELAY = 50; // milliseconds
|
|||
};
|
||||
|
||||
await Promise.all([sendQueue(), measure()]);
|
||||
} catch (error) {
|
||||
await saveLogs(bootstrap);
|
||||
throw error;
|
||||
} finally {
|
||||
await app.close();
|
||||
await bootstrap.teardown();
|
||||
|
|
|
@ -3,10 +3,14 @@
|
|||
/* eslint-disable no-await-in-loop, no-console */
|
||||
|
||||
import createDebug from 'debug';
|
||||
import fs from 'fs/promises';
|
||||
import path from 'path';
|
||||
|
||||
import { Bootstrap } from '../bootstrap';
|
||||
|
||||
export const debug = createDebug('mock:benchmarks');
|
||||
|
||||
export { Bootstrap } from '../bootstrap';
|
||||
export { Bootstrap };
|
||||
export { App } from '../playwright';
|
||||
|
||||
export type StatsType = {
|
||||
|
@ -59,6 +63,19 @@ export function stats(
|
|||
return result;
|
||||
}
|
||||
|
||||
export async function saveLogs(bootstrap: Bootstrap): Promise<void> {
|
||||
const { ARTIFACTS_DIR } = process.env;
|
||||
if (!ARTIFACTS_DIR) {
|
||||
console.error('Not saving logs. Please set ARTIFACTS_DIR env variable');
|
||||
return;
|
||||
}
|
||||
|
||||
await fs.mkdir(ARTIFACTS_DIR, { recursive: true });
|
||||
|
||||
const { logsDir } = bootstrap;
|
||||
await fs.rename(logsDir, path.join(ARTIFACTS_DIR, 'logs'));
|
||||
}
|
||||
|
||||
// Can happen if electron exits prematurely
|
||||
process.on('unhandledRejection', reason => {
|
||||
console.error('Unhandled rejection:');
|
||||
|
|
|
@ -12,6 +12,7 @@ import {
|
|||
import {
|
||||
Bootstrap,
|
||||
debug,
|
||||
saveLogs,
|
||||
stats,
|
||||
RUN_COUNT,
|
||||
GROUP_SIZE,
|
||||
|
@ -177,6 +178,9 @@ const LAST_MESSAGE = 'start sending messages now';
|
|||
}
|
||||
|
||||
console.log('stats info=%j', { delta: stats(deltaList, [99, 99.8]) });
|
||||
} catch (error) {
|
||||
await saveLogs(bootstrap);
|
||||
throw error;
|
||||
} finally {
|
||||
await app.close();
|
||||
await bootstrap.teardown();
|
||||
|
|
|
@ -6,7 +6,14 @@ import assert from 'assert';
|
|||
|
||||
import { ReceiptType } from '@signalapp/mock-server';
|
||||
|
||||
import { Bootstrap, debug, stats, RUN_COUNT, DISCARD_COUNT } from './fixtures';
|
||||
import {
|
||||
Bootstrap,
|
||||
debug,
|
||||
saveLogs,
|
||||
stats,
|
||||
RUN_COUNT,
|
||||
DISCARD_COUNT,
|
||||
} from './fixtures';
|
||||
|
||||
const CONVERSATION_SIZE = 500; // messages
|
||||
|
||||
|
@ -128,6 +135,9 @@ const LAST_MESSAGE = 'start sending messages now';
|
|||
}
|
||||
|
||||
console.log('stats info=%j', { delta: stats(deltaList, [99, 99.8]) });
|
||||
} catch (error) {
|
||||
await saveLogs(bootstrap);
|
||||
throw error;
|
||||
} finally {
|
||||
await app.close();
|
||||
await bootstrap.teardown();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import { ReceiptType } from '@signalapp/mock-server';
|
||||
|
||||
import { debug, Bootstrap, stats, RUN_COUNT } from './fixtures';
|
||||
import { debug, Bootstrap, saveLogs, stats, RUN_COUNT } from './fixtures';
|
||||
|
||||
const MESSAGE_BATCH_SIZE = 1000; // messages
|
||||
|
||||
|
@ -127,6 +127,9 @@ const ENABLE_RECEIPTS = Boolean(process.env.ENABLE_RECEIPTS);
|
|||
if (messagesPerSec.length !== 0) {
|
||||
console.log('stats info=%j', { messagesPerSec: stats(messagesPerSec) });
|
||||
}
|
||||
} catch (error) {
|
||||
await saveLogs(bootstrap);
|
||||
throw error;
|
||||
} finally {
|
||||
await bootstrap.teardown();
|
||||
}
|
||||
|
|
|
@ -148,6 +148,15 @@ export class Bootstrap {
|
|||
debug('setting storage path=%j', this.storagePath);
|
||||
}
|
||||
|
||||
public get logsDir(): string {
|
||||
assert(
|
||||
this.storagePath !== undefined,
|
||||
'Bootstrap has to be initialized first, see: bootstrap.init()'
|
||||
);
|
||||
|
||||
return path.join(this.storagePath, 'logs');
|
||||
}
|
||||
|
||||
public async teardown(): Promise<void> {
|
||||
debug('tearing down');
|
||||
|
||||
|
|
|
@ -1349,10 +1349,10 @@
|
|||
"@react-spring/shared" "~9.4.0"
|
||||
"@react-spring/types" "~9.4.0"
|
||||
|
||||
"@signalapp/mock-server@1.1.0":
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@signalapp/mock-server/-/mock-server-1.1.0.tgz#1b6ca0f4c89fb2f0b803af06bb6571780edebf10"
|
||||
integrity sha512-dsrxPhvbNM5kdaGzQSwLc2jgDNkNi93DvccWwSl8P28Wfir/1IVt+8/9alaTen0xr0UBbscfreZ2sJ8junNLjA==
|
||||
"@signalapp/mock-server@1.1.1":
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@signalapp/mock-server/-/mock-server-1.1.1.tgz#b290feeb107a3d644851708ff31bb4cd9733aa87"
|
||||
integrity sha512-bk+fMFwRtwE4zbhryIhqPoumXX1L91kJQbHjfl2i4If47LDM9ik44vVGblIqO7l8Wf1nKDD/tTemZU5w69f5qA==
|
||||
dependencies:
|
||||
"@signalapp/signal-client" "0.12.1"
|
||||
debug "^4.3.2"
|
||||
|
|
Loading…
Reference in a new issue