X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fextra-utils%2Fserver%2Fservers.ts;h=fe4ed3e485691d5523655845e3101cfed4a65fcc;hb=c9bc850e93295661e743255b8623ac8e2a95c391;hp=e88482e49c1cf125a734c649d0e8c8a061d4bbcf;hpb=a59f210ff3a4cc87dd19aeaaf0f43f63a8310791;p=github%2FChocobozzz%2FPeerTube.git 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 @@ import { expect } from 'chai' import { ChildProcess, exec, fork } from 'child_process' -import { copy, pathExists, readdir, readFile, remove } from 'fs-extra' +import { copy, ensureDir, pathExists, readdir, readFile, remove } from 'fs-extra' import { join } from 'path' import { randomInt } from '../../core-utils/miscs/miscs' import { VideoChannel } from '../../models/videos' -import { buildServerDirectory, getFileSize, root, wait } from '../miscs/miscs' +import { buildServerDirectory, getFileSize, isGithubCI, root, wait } from '../miscs/miscs' interface ServerInfo { app: ChildProcess @@ -298,11 +298,23 @@ function killallServers (servers: ServerInfo[]) { } } -function cleanupTests (servers: ServerInfo[]) { +async function cleanupTests (servers: ServerInfo[]) { killallServers(servers) + if (isGithubCI()) { + await ensureDir('artifacts') + } + const p: Promise[] = [] for (const server of servers) { + if (isGithubCI()) { + const origin = await buildServerDirectory(server, 'logs/peertube.log') + const destname = `peertube-${server.internalServerNumber}.log` + console.log('Saving logs %s.', destname) + + await copy(origin, join('artifacts', destname)) + } + if (server.parallel) { p.push(flushTests(server.internalServerNumber)) }