try spawn instead of execSync #93
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push] | |
jobs: | |
integration: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: npm ci | |
- run: npm run build | |
- uses: ./ | |
id: echo-test | |
with: | |
test-name: "echo test" | |
setup-command: "echo 'Getting Setup'" | |
command: "echo 'Hello, World'" | |
expected-output: "Hello, World" | |
comparison-method: "contains" | |
- uses: ./ | |
id: cat-test | |
with: | |
test-name: "cat test" | |
setup-command: "echo 'Getting Setup'" | |
command: "cat" | |
input: "from stdin" | |
expected-output: "from stdin" | |
comparison-method: "contains" | |
- name: Decode and assert echo-test | |
uses: actions/github-script@v6 | |
with: | |
github-token: 123 | |
script: | | |
// Decode the Base64 output | |
const decodedResult = Buffer.from("${{ steps.echo-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}'`); | |
} | |
- name: Decode and assert cat-test | |
uses: actions/github-script@v6 | |
with: | |
github-token: 123 | |
script: | | |
// Decode the Base64 output | |
const decodedResult = Buffer.from("${{ steps.cat-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"] != "cat test" && | |
json["tests"][0]["test_code"] != 'cat <stdin>from stdin') { | |
throw new Error(`Assertion failed. Expected 'expected value', but got '${decodedResult}'`); | |
} |