From 2284f202070aa2e49156cc52b3b1596a7d5aadec Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 29 Jul 2019 11:59:29 +0200 Subject: Add gitlab ci support --- shared/extra-utils/miscs/miscs.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'shared/extra-utils/miscs/miscs.ts') diff --git a/shared/extra-utils/miscs/miscs.ts b/shared/extra-utils/miscs/miscs.ts index 42250886c..08f41a7e7 100644 --- a/shared/extra-utils/miscs/miscs.ts +++ b/shared/extra-utils/miscs/miscs.ts @@ -1,10 +1,10 @@ /* tslint:disable:no-unused-expression */ import * as chai from 'chai' -import { basename, isAbsolute, join, resolve } from 'path' +import { basename, dirname, isAbsolute, join, resolve } from 'path' import * as request from 'supertest' import * as WebTorrent from 'webtorrent' -import { pathExists, readFile } from 'fs-extra' +import { ensureDir, pathExists, readFile } from 'fs-extra' import * as ffmpeg from 'fluent-ffmpeg' const expect = chai.expect @@ -59,12 +59,12 @@ async function testImage (url: string, imageName: string, imagePath: string, ext expect(data.length).to.be.below(maxLength) } -function buildAbsoluteFixturePath (path: string, customTravisPath = false) { +function buildAbsoluteFixturePath (path: string, customCIPath = false) { if (isAbsolute(path)) { return path } - if (customTravisPath && process.env.TRAVIS) return join(process.env.HOME, 'fixtures', path) + if (customCIPath && process.env.GITLAB_CI) return join(root(), 'cached-fixtures', path) return join(root(), 'server', 'tests', 'fixtures', path) } @@ -72,6 +72,8 @@ function buildAbsoluteFixturePath (path: string, customTravisPath = false) { async function generateHighBitrateVideo () { const tempFixturePath = buildAbsoluteFixturePath('video_high_bitrate_1080p.mp4', true) + await ensureDir(dirname(tempFixturePath)) + const exists = await pathExists(tempFixturePath) if (!exists) { -- cgit v1.2.3