From 9e1309414c948290aefe15040190ed344e43f7d4 Mon Sep 17 00:00:00 2001 From: Ashish Keshan Date: Mon, 25 Mar 2024 15:57:20 -0400 Subject: [PATCH] wip changes --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ Makefile | 2 ++ hellofunc.c | 9 +++++++++ hellomake.c | 8 ++++++++ hellomake.h | 5 +++++ src/main.js | 7 +++++-- 6 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 Makefile create mode 100644 hellofunc.c create mode 100644 hellomake.c create mode 100644 hellomake.h diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e490856..131be20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,14 @@ jobs: input: "from stdin" expected-output: "from stdin" comparison-method: "contains" + - uses: ./ + id: make-test + with: + test-name: "make test" + setup-command: make + command: ./hellomake + expected-output: "Hello makefiles!" + comparison-method: "exact" - name: Decode and assert echo-test uses: actions/github-script@v6 with: @@ -55,3 +63,17 @@ jobs: json["tests"][0]["test_code"] != 'cat from stdin') { throw new Error(`Assertion failed. Expected 'expected value', but got '${decodedResult}'`); } + - name: Decode and assert make-test + uses: actions/github-script@v6 + with: + github-token: 123 + script: | + // Decode the Base64 output + const decodedResult = Buffer.from("${{ steps.make-test.outputs.result }}", 'base64').toString('utf8'); + console.log(`Decoded Result: ${decodedResult}`); + const json = JSON.parse(decodedResult) + if ( json["version"] != 1 && + json["status"] != "pass" && + json["tests"][0]["name"] != "echo test") { + throw new Error(`Assertion failed. Expected 'expected value', but got '${decodedResult}'`); + } diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..71a2ca9 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +hellomake: hellomake.c hellofunc.c + gcc -o hellomake hellomake.c hellofunc.c -I. diff --git a/hellofunc.c b/hellofunc.c new file mode 100644 index 0000000..356ffa7 --- /dev/null +++ b/hellofunc.c @@ -0,0 +1,9 @@ +#include +#include + +void myPrintHelloMake(void) { + + printf("Hello makefiles!\n"); + + return; +} diff --git a/hellomake.c b/hellomake.c new file mode 100644 index 0000000..3d673b7 --- /dev/null +++ b/hellomake.c @@ -0,0 +1,8 @@ +#include + +int main() { + // call a function in another file + myPrintHelloMake(); + + return(0); +} diff --git a/hellomake.h b/hellomake.h new file mode 100644 index 0000000..1c612f0 --- /dev/null +++ b/hellomake.h @@ -0,0 +1,5 @@ +/* +example include file +*/ + +void myPrintHelloMake(void); diff --git a/src/main.js b/src/main.js index ce5692a..09b5bb8 100644 --- a/src/main.js +++ b/src/main.js @@ -91,10 +91,13 @@ function run() { inputs = getInputs() if (inputs.setupCommand) { - spawn(inputs.setupCommand, { - shell: true, + console.log(inputs.setupCommand) + const val = execSync(inputs.setupCommand, { + timeout: inputs.timeout, + stdio: 'inherit', env, }) + // console.log(val.toString()) } const startTime = new Date()