Skip to content

Commit 35bd098

Browse files
authored
Initial implementation (#2)
1 parent 53f23a4 commit 35bd098

File tree

10 files changed

+419
-24
lines changed

10 files changed

+419
-24
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Test multiline
2+
on:
3+
# # Uncomment when test added first time to register workflow and comment it back after workflow would be registered
4+
# #
5+
# # Added pull_request to register workflow from the PR.
6+
# # Read more https://stackoverflow.com/questions/63362126/github-actions-how-to-run-a-workflow-created-on-a-non-master-branch-from-the-wo
7+
# pull_request: {}
8+
workflow_dispatch: {}
9+
10+
jobs:
11+
setup:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Setup
15+
run: echo "Do setup"
16+
17+
test:
18+
runs-on: ubuntu-latest
19+
continue-on-error: true
20+
needs: [setup]
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
25+
- uses: ./
26+
id: current
27+
with:
28+
query: .
29+
config: |
30+
test: |-
31+
foo"
32+
bar
33+
bar: |-
34+
type=sha
35+
type=schedule
36+
type=ref,event=branch
37+
type=ref,event=pr
38+
type=semver,pattern={{version}}
39+
type=semver,pattern={{major}}.{{minor}}
40+
type=semver,pattern={{major}}
41+
type=raw,value=latest,enable={{is_default_branch}}
42+
type=sha,format=long
43+
3474817879-59-1
44+
45+
outputs:
46+
test: "${{ steps.current.outputs.test }}"
47+
bar: "${{ steps.current.outputs.bar }}"
48+
49+
assert:
50+
runs-on: ubuntu-latest
51+
needs: [test]
52+
steps:
53+
- uses: nick-fields/assert-action@v1
54+
with:
55+
expected: |-
56+
foo"
57+
bar
58+
actual: "${{ needs.test.outputs.test }}"
59+
60+
- uses: nick-fields/assert-action@v1
61+
with:
62+
expected: |-
63+
type=sha
64+
type=schedule
65+
type=ref,event=branch
66+
type=ref,event=pr
67+
type=semver,pattern={{version}}
68+
type=semver,pattern={{major}}.{{minor}}
69+
type=semver,pattern={{major}}
70+
type=raw,value=latest,enable={{is_default_branch}}
71+
type=sha,format=long
72+
3474817879-59-1
73+
actual: "${{ needs.test.outputs.bar }}"
74+
75+
teardown:
76+
runs-on: ubuntu-latest
77+
needs: [assert]
78+
if: ${{ always() }}
79+
steps:
80+
- name: Tear down
81+
run: echo "Do Tear down"

.github/workflows/test-negative.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,35 @@ jobs:
2525
- uses: ./
2626
id: current
2727
with:
28-
param1: 'false'
28+
query: .foo
29+
config: |
30+
test: foo
31+
bar: bar
2932
3033
outputs:
31-
result: "${{ steps.current.outputs.result1 }}"
34+
result: ${{ steps.current.conclusion }}
35+
test: "${{ steps.current.outputs.test }}"
36+
bar: "${{ steps.current.outputs.bar }}"
3237

3338
assert:
3439
runs-on: ubuntu-latest
3540
needs: [test]
3641
steps:
3742
- uses: nick-fields/assert-action@v1
3843
with:
39-
expected: 'false'
44+
expected: 'failure'
4045
actual: "${{ needs.test.outputs.result }}"
4146

47+
- uses: nick-fields/assert-action@v1
48+
with:
49+
expected: ''
50+
actual: "${{ needs.test.outputs.test }}"
51+
52+
- uses: nick-fields/assert-action@v1
53+
with:
54+
expected: ''
55+
actual: "${{ needs.test.outputs.bar }}"
56+
4257
teardown:
4358
runs-on: ubuntu-latest
4459
needs: [assert]

.github/workflows/test-positive.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,28 @@ jobs:
2525
- uses: ./
2626
id: current
2727
with:
28-
param1: 'true'
28+
query: .
29+
config: |
30+
test: foo
31+
bar: bar
2932
3033
outputs:
31-
result: "${{ steps.current.outputs.result1 }}"
34+
test: "${{ steps.current.outputs.test }}"
35+
bar: "${{ steps.current.outputs.bar }}"
3236

3337
assert:
3438
runs-on: ubuntu-latest
3539
needs: [test]
3640
steps:
3741
- uses: nick-fields/assert-action@v1
3842
with:
39-
expected: 'true'
40-
actual: "${{ needs.test.outputs.result }}"
43+
expected: 'foo'
44+
actual: "${{ needs.test.outputs.test }}"
45+
46+
- uses: nick-fields/assert-action@v1
47+
with:
48+
expected: 'bar'
49+
actual: "${{ needs.test.outputs.bar }}"
4150

4251
teardown:
4352
runs-on: ubuntu-latest

.github/workflows/test-query-1.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Test query one
2+
on:
3+
# # Uncomment when test added first time to register workflow and comment it back after workflow would be registered
4+
# #
5+
# # Added pull_request to register workflow from the PR.
6+
# # Read more https://stackoverflow.com/questions/63362126/github-actions-how-to-run-a-workflow-created-on-a-non-master-branch-from-the-wo
7+
# pull_request: {}
8+
workflow_dispatch: {}
9+
10+
jobs:
11+
setup:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Setup
15+
run: echo "Do setup"
16+
17+
test:
18+
runs-on: ubuntu-latest
19+
continue-on-error: true
20+
needs: [setup]
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
25+
- uses: ./
26+
id: current
27+
with:
28+
query: .yes
29+
config: |
30+
yes:
31+
test: foo
32+
bar: bar
33+
no:
34+
test: bar
35+
bar: foo
36+
37+
outputs:
38+
test: "${{ steps.current.outputs.test }}"
39+
bar: "${{ steps.current.outputs.bar }}"
40+
41+
assert:
42+
runs-on: ubuntu-latest
43+
needs: [test]
44+
steps:
45+
- uses: nick-fields/assert-action@v1
46+
with:
47+
expected: 'foo'
48+
actual: "${{ needs.test.outputs.test }}"
49+
50+
- uses: nick-fields/assert-action@v1
51+
with:
52+
expected: 'bar'
53+
actual: "${{ needs.test.outputs.bar }}"
54+
55+
teardown:
56+
runs-on: ubuntu-latest
57+
needs: [assert]
58+
if: ${{ always() }}
59+
steps:
60+
- name: Tear down
61+
run: echo "Do Tear down"

.github/workflows/test-query-2.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Test query two
2+
on:
3+
# # Uncomment when test added first time to register workflow and comment it back after workflow would be registered
4+
# #
5+
# # Added pull_request to register workflow from the PR.
6+
# # Read more https://stackoverflow.com/questions/63362126/github-actions-how-to-run-a-workflow-created-on-a-non-master-branch-from-the-wo
7+
# pull_request: {}
8+
workflow_dispatch: {}
9+
10+
jobs:
11+
setup:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Setup
15+
run: echo "Do setup"
16+
17+
test:
18+
runs-on: ubuntu-latest
19+
continue-on-error: true
20+
needs: [setup]
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
25+
- uses: ./
26+
id: current
27+
with:
28+
query: .no
29+
config: |
30+
yes:
31+
test: foo
32+
bar: bar
33+
no:
34+
test: bar
35+
bar: foo
36+
outputs:
37+
test: "${{ steps.current.outputs.test }}"
38+
bar: "${{ steps.current.outputs.bar }}"
39+
40+
assert:
41+
runs-on: ubuntu-latest
42+
needs: [test]
43+
steps:
44+
- uses: nick-fields/assert-action@v1
45+
with:
46+
expected: 'bar'
47+
actual: "${{ needs.test.outputs.test }}"
48+
49+
- uses: nick-fields/assert-action@v1
50+
with:
51+
expected: 'foo'
52+
actual: "${{ needs.test.outputs.bar }}"
53+
54+
teardown:
55+
runs-on: ubuntu-latest
56+
needs: [assert]
57+
if: ${{ always() }}
58+
steps:
59+
- name: Tear down
60+
run: echo "Do Tear down"
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Test structured outputs
2+
on:
3+
# # Uncomment when test added first time to register workflow and comment it back after workflow would be registered
4+
# #
5+
# # Added pull_request to register workflow from the PR.
6+
# # Read more https://stackoverflow.com/questions/63362126/github-actions-how-to-run-a-workflow-created-on-a-non-master-branch-from-the-wo
7+
# pull_request: {}
8+
workflow_dispatch: {}
9+
10+
jobs:
11+
setup:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Setup
15+
run: echo "Do setup"
16+
17+
test:
18+
runs-on: ubuntu-latest
19+
continue-on-error: true
20+
needs: [setup]
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
25+
- uses: ./
26+
id: current
27+
with:
28+
query: .
29+
config: |
30+
test:
31+
foo:
32+
bar
33+
bar:
34+
test:
35+
foo
36+
37+
outputs:
38+
test: "${{ steps.current.outputs.test }}"
39+
bar: "${{ steps.current.outputs.bar }}"
40+
41+
assert:
42+
runs-on: ubuntu-latest
43+
needs: [test]
44+
steps:
45+
- uses: nick-fields/assert-action@v1
46+
with:
47+
expected: '{"foo":"bar"}'
48+
actual: "${{ needs.test.outputs.test }}"
49+
50+
- uses: nick-fields/assert-action@v1
51+
with:
52+
expected: '{"test":"foo"}'
53+
actual: "${{ needs.test.outputs.bar }}"
54+
55+
- uses: nick-fields/assert-action@v1
56+
with:
57+
expected: 'foo'
58+
actual: ${{ fromJSON(needs.test.outputs.bar).test }}
59+
60+
teardown:
61+
runs-on: ubuntu-latest
62+
needs: [assert]
63+
if: ${{ always() }}
64+
steps:
65+
- name: Tear down
66+
run: echo "Do Tear down"

0 commit comments

Comments
 (0)