mirror of
https://github.com/yeslayla/run-gut-tests-action.git
synced 2025-12-06 09:13:25 +01:00
Intial commit
This commit is contained in:
48
main.js
Normal file
48
main.js
Normal file
@@ -0,0 +1,48 @@
|
||||
const core = require('@actions/core');
|
||||
const fs = require('fs');
|
||||
const path = require('path')
|
||||
|
||||
// Setup Docker
|
||||
const Docker = require('dockerode');
|
||||
var docker = new Docker({socketPath: '/var/run/docker.sock'});
|
||||
|
||||
try {
|
||||
|
||||
// Get inputs
|
||||
var docker_image = core.getInput('containerImage');
|
||||
var work_dir = core.getInput('directory');
|
||||
|
||||
process.chdir(work_dir);
|
||||
|
||||
// Pull docker image for building
|
||||
console.log("Pulling build image...");
|
||||
docker.pull(docker_image, function(err, stream)
|
||||
{
|
||||
|
||||
docker.modem.followProgress(stream, onFinished, onProgress);
|
||||
|
||||
// Wait to run build until after pull complete
|
||||
function onFinished(err, output)
|
||||
{
|
||||
console.log("Starting image...")
|
||||
docker.run(docker_image, ['godot', '-d', '-s', '--path /builder', 'addons/gut/gut_cmdln.gd'], process.stdout,
|
||||
|
||||
// Mount working directory to `/builder`
|
||||
{ HostConfig: { Binds: [ process.cwd() + ":/builder" ] }},
|
||||
|
||||
function (err, data, container) {
|
||||
|
||||
if(err)
|
||||
{
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
function onProgress(event) {}
|
||||
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
Reference in New Issue
Block a user