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 ++++++---- shared/extra-utils/miscs/sql.ts | 3 +-- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'shared/extra-utils/miscs') 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) { diff --git a/shared/extra-utils/miscs/sql.ts b/shared/extra-utils/miscs/sql.ts index 1961a8762..dfe840d8c 100644 --- a/shared/extra-utils/miscs/sql.ts +++ b/shared/extra-utils/miscs/sql.ts @@ -1,6 +1,5 @@ import { QueryTypes, Sequelize } from 'sequelize' import { ServerInfo } from '../server/servers' -import { PluginType } from '../../models/plugins/plugin.type' let sequelizes: { [ id: number ]: Sequelize } = {} @@ -10,7 +9,7 @@ function getSequelize (internalServerNumber: number) { const dbname = 'peertube_test' + internalServerNumber const username = 'peertube' const password = 'peertube' - const host = 'localhost' + const host = process.env.GITLAB_CI ? 'postgres' : 'localhost' const port = 5432 const seq = new Sequelize(dbname, username, password, { -- cgit v1.2.3