Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try spawn instead of execSync #20

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -55,3 +63,17 @@ jobs:
json["tests"][0]["test_code"] != 'cat <stdin>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}'`);
}
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
hellomake: hellomake.c hellofunc.c
gcc -o hellomake hellomake.c hellofunc.c -I.
9 changes: 9 additions & 0 deletions hellofunc.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <stdio.h>
#include <hellomake.h>

void myPrintHelloMake(void) {

printf("Hello makefiles!\n");

return;
}
8 changes: 8 additions & 0 deletions hellomake.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <hellomake.h>

int main() {
// call a function in another file
myPrintHelloMake();

return(0);
}
5 changes: 5 additions & 0 deletions hellomake.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
example include file
*/

void myPrintHelloMake(void);
8 changes: 5 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const {execSync} = require('child_process')
const core = require('@actions/core')
const {spawn} = require('child_process')

const env = {
PATH: process.env.PATH,
Expand Down Expand Up @@ -90,12 +91,13 @@ function run() {
inputs = getInputs()

if (inputs.setupCommand) {
execSync(inputs.setupCommand, {
console.log(inputs.setupCommand)
const val = execSync(inputs.setupCommand, {
timeout: inputs.timeout,
stdio: 'ignore',
stdio: 'inherit',
env,

})
// console.log(val.toString())
}

const startTime = new Date()
Expand Down
Loading