Skip to content

Commit

Permalink
action: Add timeout before running tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
adambirds committed Apr 10, 2023
1 parent ef6e96b commit b6d5f4c
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const core = require("@actions/core");
const compose = require("docker-compose");
const utils = require("./utils");
const path = require("path");
//const path = require("path");

try {
const composeFiles = utils.parseComposeFiles(
Expand Down Expand Up @@ -33,19 +33,26 @@ try {

const testContainer = core.getInput("test-container");
const testCommand = core.getInput("test-command");

console.log("testContainer", testContainer);
console.log("testCommand", testCommand);

if (testCommand && testContainer) {
const test = compose.exec(testContainer, testCommand, {
cwd: path.join(__dirname),
config: composeFiles,
});

test
.then(() => {
console.log("tests passed");
})
.catch((err) => {
core.setFailed(`tests failed ${JSON.stringify(err)}`);
setTimeout(() => {
const test = compose.exec(testContainer, testCommand, {
config: composeFiles,
});

test
.then(() => {
console.log("tests passed");
})
.catch((err) => {
console.log(err.out);
console.log(err.err);
core.setFailed(`tests failed ${JSON.stringify(err)}`);
});
}, 10000);
}
})
.catch((err) => {
Expand Down

0 comments on commit b6d5f4c

Please sign in to comment.