Merge branch 'master' of https://github.com/webbertakken/unity-test-runner into wip/docker-migration

pull/77/head
BLaZeKiLL 2020-11-26 22:23:32 +05:30
commit d914a48096
5 changed files with 43 additions and 7 deletions

View File

@ -6,6 +6,28 @@ inputs:
required: false
default: '2019.2.11f1'
description: 'Version of unity to use for testing the project.'
customImage:
required: false
default: ''
description: 'Specific docker image that should be used for testing the project'
projectPath:
required: false
description: 'Path to the Unity project to be tested.'
testMode:
required: false
default: 'all'
description: 'The type of tests to be run by the test runner.'
artifactsPath:
required: false
default: 'artifacts'
description: 'Path where test artifacts should be stored.'
useNetworkHost:
required: false
default: false
description: 'Initialises Docker using the hosts network.'
customParameters:
required: false
description: 'Extra parameters to configure the Unity editor run.'
outputs:
artifactsPath:
description: 'Path where the artifacts are stored'

File diff suppressed because one or more lines are too long

View File

@ -7,13 +7,14 @@ async function action() {
const { dockerfile, workspace, actionFolder } = Action;
const {
unityVersion,
customImage,
projectPath,
testMode,
artifactsPath,
useHostNetwork,
customParameters,
} = Input.getFromUser();
const baseImage = ImageTag.createForBase(unityVersion);
const baseImage = ImageTag.createForBase({ version: unityVersion, customImage });
// Build docker image
const actionImage = await Docker.build({ path: actionFolder, dockerfile, baseImage });

View File

@ -1,10 +1,10 @@
import { trimStart } from 'lodash-es';
class ImageTag {
static createForBase(version) {
static createForBase({ version, customImage }) {
const repository = 'unityci';
const name = 'editor';
return new this({ repository, name, version });
return new this({ repository, name, version, customImage });
}
static createForAction(version) {
@ -13,12 +13,12 @@ class ImageTag {
return new this({ repository, name, version });
}
constructor({ repository = '', name, version }) {
constructor({ repository = '', name, version, customImage }) {
if (!ImageTag.versionPattern.test(version)) {
throw new Error(`Invalid version "${version}".`);
}
Object.assign(this, { repository, name, version });
Object.assign(this, { repository, name, version, customImage });
}
static get versionPattern() {
@ -34,6 +34,10 @@ class ImageTag {
}
toString() {
if (this.customImage && this.customImage !== '') {
return this.customImage;
}
return `${this.image}:${this.tag}-base-0`;
}
}

View File

@ -30,9 +30,18 @@ describe('UnityImageVersion', () => {
describe('toString', () => {
it('returns the correct version', () => {
const image = ImageTag.createForBase('2099.1.1111');
const image = ImageTag.createForBase({ version: '2099.1.1111' });
expect(image.toString()).toStrictEqual(`unityci/editor:2099.1.1111-base-0`);
});
it('returns customImage if given', () => {
const image = ImageTag.createForBase({
version: '2099.1.1111',
customImage: 'unityci/editor:2099.1.1111-base-0',
});
expect(image.toString()).toStrictEqual(image.customImage);
});
});
});