diff options
author | Chocobozzz <me@florianbigard.com> | 2020-12-10 11:24:17 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-12-14 09:11:27 +0100 |
commit | 83ef31fe10061f0d3db0df1bc5e7f208972982eb (patch) | |
tree | 5d6878c5803e1181ad1a7749c62da56e6f8607e5 /shared/extra-utils/server | |
parent | 040d6896a3cd5622e78cccdedd8cce2afcf49a31 (diff) | |
download | PeerTube-83ef31fe10061f0d3db0df1bc5e7f208972982eb.tar.gz PeerTube-83ef31fe10061f0d3db0df1bc5e7f208972982eb.tar.zst PeerTube-83ef31fe10061f0d3db0df1bc5e7f208972982eb.zip |
Save logs on ci failure
Diffstat (limited to 'shared/extra-utils/server')
-rw-r--r-- | shared/extra-utils/server/servers.ts | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.ts index e88482e49..fe4ed3e48 100644 --- a/shared/extra-utils/server/servers.ts +++ b/shared/extra-utils/server/servers.ts | |||
@@ -2,11 +2,11 @@ | |||
2 | 2 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { ChildProcess, exec, fork } from 'child_process' | 4 | import { ChildProcess, exec, fork } from 'child_process' |
5 | import { copy, pathExists, readdir, readFile, remove } from 'fs-extra' | 5 | import { copy, ensureDir, pathExists, readdir, readFile, remove } from 'fs-extra' |
6 | import { join } from 'path' | 6 | import { join } from 'path' |
7 | import { randomInt } from '../../core-utils/miscs/miscs' | 7 | import { randomInt } from '../../core-utils/miscs/miscs' |
8 | import { VideoChannel } from '../../models/videos' | 8 | import { VideoChannel } from '../../models/videos' |
9 | import { buildServerDirectory, getFileSize, root, wait } from '../miscs/miscs' | 9 | import { buildServerDirectory, getFileSize, isGithubCI, root, wait } from '../miscs/miscs' |
10 | 10 | ||
11 | interface ServerInfo { | 11 | interface ServerInfo { |
12 | app: ChildProcess | 12 | app: ChildProcess |
@@ -298,11 +298,23 @@ function killallServers (servers: ServerInfo[]) { | |||
298 | } | 298 | } |
299 | } | 299 | } |
300 | 300 | ||
301 | function cleanupTests (servers: ServerInfo[]) { | 301 | async function cleanupTests (servers: ServerInfo[]) { |
302 | killallServers(servers) | 302 | killallServers(servers) |
303 | 303 | ||
304 | if (isGithubCI()) { | ||
305 | await ensureDir('artifacts') | ||
306 | } | ||
307 | |||
304 | const p: Promise<any>[] = [] | 308 | const p: Promise<any>[] = [] |
305 | for (const server of servers) { | 309 | for (const server of servers) { |
310 | if (isGithubCI()) { | ||
311 | const origin = await buildServerDirectory(server, 'logs/peertube.log') | ||
312 | const destname = `peertube-${server.internalServerNumber}.log` | ||
313 | console.log('Saving logs %s.', destname) | ||
314 | |||
315 | await copy(origin, join('artifacts', destname)) | ||
316 | } | ||
317 | |||
306 | if (server.parallel) { | 318 | if (server.parallel) { |
307 | p.push(flushTests(server.internalServerNumber)) | 319 | p.push(flushTests(server.internalServerNumber)) |
308 | } | 320 | } |