Remove docker build step in favor of using the default image
parent
0c3e710069
commit
2774b4ae81
|
@ -1,17 +0,0 @@
|
|||
ARG IMAGE
|
||||
FROM $IMAGE
|
||||
|
||||
LABEL "com.github.actions.name"="Unity - Test runner"
|
||||
LABEL "com.github.actions.description"="Run tests for any Unity project."
|
||||
LABEL "com.github.actions.icon"="box"
|
||||
LABEL "com.github.actions.color"="gray-dark"
|
||||
|
||||
LABEL "repository"="http://github.com/webbertakken/unity-actions"
|
||||
LABEL "homepage"="http://github.com/webbertakken/unity-actions"
|
||||
LABEL "maintainer"="Webber Takken <webber@takken.io>"
|
||||
|
||||
ADD steps /steps
|
||||
RUN chmod -R +x /steps
|
||||
ADD entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
@ -4,9 +4,9 @@
|
|||
# Run steps
|
||||
#
|
||||
|
||||
source /steps/activate.sh
|
||||
source /steps/run_tests.sh
|
||||
source /steps/return_license.sh
|
||||
source /github/action/steps/activate.sh
|
||||
source /github/action/steps/run_tests.sh
|
||||
source /github/action/steps/return_license.sh
|
||||
|
||||
#
|
||||
# Instructions for debugging
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@ import { Action, Docker, Input, ImageTag, Output } from './model';
|
|||
async function action() {
|
||||
Action.checkCompatibility();
|
||||
|
||||
const { dockerfile, workspace, actionFolder } = Action;
|
||||
const { workspace, actionFolder } = Action;
|
||||
const {
|
||||
unityVersion,
|
||||
customImage,
|
||||
|
@ -16,12 +16,10 @@ async function action() {
|
|||
} = Input.getFromUser();
|
||||
const baseImage = ImageTag.createForBase({ version: unityVersion, customImage });
|
||||
|
||||
// Build docker image
|
||||
const actionImage = await Docker.build({ path: actionFolder, dockerfile, baseImage });
|
||||
|
||||
// Run docker image
|
||||
await Docker.run(actionImage, {
|
||||
await Docker.run(baseImage, {
|
||||
workspace,
|
||||
actionFolder,
|
||||
unityVersion,
|
||||
projectPath,
|
||||
testMode,
|
||||
|
|
|
@ -29,10 +29,6 @@ class Action {
|
|||
return `${Action.rootFolder}/action`;
|
||||
}
|
||||
|
||||
static get dockerfile() {
|
||||
return `${Action.actionFolder}/Dockerfile`;
|
||||
}
|
||||
|
||||
static get workspace() {
|
||||
return process.env.GITHUB_WORKSPACE;
|
||||
}
|
||||
|
|
|
@ -26,11 +26,4 @@ describe('Action', () => {
|
|||
expect(path.basename(actionFolder)).toStrictEqual('action');
|
||||
expect(fs.existsSync(actionFolder)).toStrictEqual(true);
|
||||
});
|
||||
|
||||
it('returns the docker file', () => {
|
||||
const { dockerfile } = Action;
|
||||
|
||||
expect(path.basename(dockerfile)).toStrictEqual('Dockerfile');
|
||||
expect(fs.existsSync(dockerfile)).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,26 +1,11 @@
|
|||
import { exec } from '@actions/exec';
|
||||
import ImageTag from './image-tag';
|
||||
|
||||
class Docker {
|
||||
static async build(buildParameters, silent = false) {
|
||||
const { path, dockerfile, baseImage } = buildParameters;
|
||||
const { version } = baseImage;
|
||||
|
||||
const tag = ImageTag.createForAction(version);
|
||||
const command = `docker build ${path} \
|
||||
--file ${dockerfile} \
|
||||
--build-arg IMAGE=${baseImage} \
|
||||
--tag ${tag}`;
|
||||
|
||||
await exec(command, null, { silent });
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
static async run(image, parameters, silent = false) {
|
||||
const {
|
||||
unityVersion,
|
||||
workspace,
|
||||
actionFolder,
|
||||
projectPath,
|
||||
testMode,
|
||||
artifactsPath,
|
||||
|
@ -60,9 +45,11 @@ class Docker {
|
|||
--volume "/var/run/docker.sock":"/var/run/docker.sock" \
|
||||
--volume "/home/runner/work/_temp/_github_home":"/github/home" \
|
||||
--volume "/home/runner/work/_temp/_github_workflow":"/github/workflow" \
|
||||
--volume "${actionFolder}":"/github/action" \
|
||||
--volume "${workspace}":"/github/workspace" \
|
||||
--entrypoint="" \
|
||||
${useHostNetwork ? '--net=host' : ''} \
|
||||
${image}`;
|
||||
${image} /bin/bash -c "chmod -R +x /github/action && /github/action/entrypoint.sh"`;
|
||||
|
||||
await exec(command, null, { silent });
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
import Action from './action';
|
||||
import Docker from './docker';
|
||||
import ImageTag from './image-tag';
|
||||
|
||||
describe('Docker', () => {
|
||||
it('builds', async () => {
|
||||
const path = Action.actionFolder;
|
||||
const dockerfile = `${path}/Dockerfile`;
|
||||
const image = new ImageTag({
|
||||
repository: '',
|
||||
name: 'alpine',
|
||||
version: '3',
|
||||
});
|
||||
|
||||
const baseImage = {
|
||||
toString: () => image.toString().slice(0, image.toString().lastIndexOf('-base-0')),
|
||||
version: image.version,
|
||||
};
|
||||
|
||||
const tag = await Docker.build({ path, dockerfile, baseImage }, true);
|
||||
|
||||
expect(tag).toBeInstanceOf(ImageTag);
|
||||
expect(tag.toString()).toStrictEqual('unity-action:3-base-0');
|
||||
}, 240000);
|
||||
});
|
Loading…
Reference in New Issue