-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (55 loc) · 2.06 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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}'`);
}