mirror of https://github.com/Chocobozzz/PeerTube
Save logs on ci failure
parent
040d6896a3
commit
83ef31fe10
|
@ -105,4 +105,5 @@ jobs:
|
||||||
if: failure()
|
if: failure()
|
||||||
with:
|
with:
|
||||||
name: test-storages-${{ matrix.test_suite }}
|
name: test-storages-${{ matrix.test_suite }}
|
||||||
path: test*/logs/*
|
path: artifacts
|
||||||
|
retention-days: 7
|
||||||
|
|
|
@ -64,6 +64,10 @@ async function testImage (url: string, imageName: string, imagePath: string, ext
|
||||||
expect(data.length).to.be.below(maxLength, "the generated image is way larger than the recorded fixture")
|
expect(data.length).to.be.below(maxLength, "the generated image is way larger than the recorded fixture")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isGithubCI () {
|
||||||
|
return !!process.env.GITHUB_WORKSPACE
|
||||||
|
}
|
||||||
|
|
||||||
function buildAbsoluteFixturePath (path: string, customCIPath = false) {
|
function buildAbsoluteFixturePath (path: string, customCIPath = false) {
|
||||||
if (isAbsolute(path)) return path
|
if (isAbsolute(path)) return path
|
||||||
|
|
||||||
|
@ -151,6 +155,7 @@ export {
|
||||||
getFileSize,
|
getFileSize,
|
||||||
immutableAssign,
|
immutableAssign,
|
||||||
testImage,
|
testImage,
|
||||||
|
isGithubCI,
|
||||||
buildAbsoluteFixturePath,
|
buildAbsoluteFixturePath,
|
||||||
root,
|
root,
|
||||||
generateHighBitrateVideo,
|
generateHighBitrateVideo,
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
import { ChildProcess, exec, fork } from 'child_process'
|
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 { join } from 'path'
|
||||||
import { randomInt } from '../../core-utils/miscs/miscs'
|
import { randomInt } from '../../core-utils/miscs/miscs'
|
||||||
import { VideoChannel } from '../../models/videos'
|
import { VideoChannel } from '../../models/videos'
|
||||||
import { buildServerDirectory, getFileSize, root, wait } from '../miscs/miscs'
|
import { buildServerDirectory, getFileSize, isGithubCI, root, wait } from '../miscs/miscs'
|
||||||
|
|
||||||
interface ServerInfo {
|
interface ServerInfo {
|
||||||
app: ChildProcess
|
app: ChildProcess
|
||||||
|
@ -298,11 +298,23 @@ function killallServers (servers: ServerInfo[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanupTests (servers: ServerInfo[]) {
|
async function cleanupTests (servers: ServerInfo[]) {
|
||||||
killallServers(servers)
|
killallServers(servers)
|
||||||
|
|
||||||
|
if (isGithubCI()) {
|
||||||
|
await ensureDir('artifacts')
|
||||||
|
}
|
||||||
|
|
||||||
const p: Promise<any>[] = []
|
const p: Promise<any>[] = []
|
||||||
for (const server of servers) {
|
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) {
|
if (server.parallel) {
|
||||||
p.push(flushTests(server.internalServerNumber))
|
p.push(flushTests(server.internalServerNumber))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue