Skip to content

Commit 13565fc

Browse files
authored
Initial implementation (#2)
## what * Initial implementation of `wait-for-commit-status` action
1 parent 50bd2df commit 13565fc

File tree

423 files changed

+97107
-105
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

423 files changed

+97107
-105
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Test increased timeout
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+
- id: random
18+
shell: bash
19+
run: |-
20+
echo "password=$(echo $RANDOM | md5sum | head -c 20)" >> $GITHUB_OUTPUT
21+
echo "environment=$(echo $RANDOM | md5sum | head -c 20)" >> $GITHUB_OUTPUT
22+
23+
outputs:
24+
random: ${{ steps.random.outputs.password }}
25+
environment: ${{ steps.random.outputs.environment }}
26+
27+
set_status:
28+
runs-on: ubuntu-latest
29+
needs: [setup]
30+
steps:
31+
- name: Sleep for 10s
32+
uses: juliangruber/sleep-action@v2.0.0
33+
with:
34+
time: 70s
35+
36+
- name: Set status
37+
uses: myrotvorets/set-commit-status-action@master
38+
with:
39+
repo: ${{ github.repository }}
40+
sha: ${{ github.sha }}
41+
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
42+
status: success
43+
context: continuous-delivery/${{ needs.setup.outputs.environment }}.test-app
44+
45+
test:
46+
runs-on: ubuntu-latest
47+
continue-on-error: true
48+
needs: [setup]
49+
steps:
50+
- name: Checkout
51+
uses: actions/checkout@v3
52+
53+
- uses: ./
54+
id: current
55+
with:
56+
repository: ${{ github.repository }}
57+
sha: ${{ github.sha }}
58+
status: continuous-delivery/${{ needs.setup.outputs.environment }}.test-app
59+
expected_state: "success"
60+
token: ${{ github.token }}
61+
check-timeout: 120
62+
check-retry-count: 5
63+
check-retry-interval: 20
64+
65+
outputs:
66+
status: ${{ steps.current.outcome }}
67+
68+
assert:
69+
runs-on: ubuntu-latest
70+
needs: [test, set_status]
71+
steps:
72+
- uses: nick-fields/assert-action@v1
73+
with:
74+
expected: "success"
75+
actual: "${{ needs.test.outputs.status }}"
76+
77+
teardown:
78+
runs-on: ubuntu-latest
79+
needs: [assert]
80+
if: ${{ always() }}
81+
steps:
82+
- name: Tear down
83+
run: echo "Do Tear down"

.github/workflows/test-negative.yml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: Test example negative
1+
name: Test No status
22
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: {}
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: {}
88
workflow_dispatch: {}
99

1010
jobs:
@@ -14,30 +14,44 @@ jobs:
1414
- name: Setup
1515
run: echo "Do setup"
1616

17+
- id: random
18+
shell: bash
19+
run: |-
20+
echo "password=$(echo $RANDOM | md5sum | head -c 20)" >> $GITHUB_OUTPUT
21+
echo "environment=$(echo $RANDOM | md5sum | head -c 20)" >> $GITHUB_OUTPUT
22+
23+
outputs:
24+
random: ${{ steps.random.outputs.password }}
25+
environment: ${{ steps.random.outputs.environment }}
26+
1727
test:
1828
runs-on: ubuntu-latest
19-
needs: [setup]
2029
continue-on-error: true
30+
needs: [setup]
2131
steps:
2232
- name: Checkout
2333
uses: actions/checkout@v3
2434

2535
- uses: ./
2636
id: current
2737
with:
28-
param1: 'false'
38+
repository: ${{ github.repository }}
39+
sha: ${{ github.sha }}
40+
status: continuous-delivery/${{ needs.setup.outputs.environment }}.test-app
41+
expected_state: "success"
42+
token: ${{ github.token }}
2943

3044
outputs:
31-
result: "${{ steps.current.outputs.result1 }}"
45+
status: ${{ steps.current.outcome }}
3246

3347
assert:
3448
runs-on: ubuntu-latest
3549
needs: [test]
3650
steps:
3751
- uses: nick-fields/assert-action@v1
3852
with:
39-
expected: 'false'
40-
actual: "${{ needs.test.outputs.result }}"
53+
expected: "failure"
54+
actual: "${{ needs.test.outputs.status }}"
4155

4256
teardown:
4357
runs-on: ubuntu-latest

.github/workflows/test-positive.yml

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: Test example positive
1+
name: Test Positive
22
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: {}
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: {}
88
workflow_dispatch: {}
99

1010
jobs:
@@ -14,6 +14,35 @@ jobs:
1414
- name: Setup
1515
run: echo "Do setup"
1616

17+
- id: random
18+
shell: bash
19+
run: |-
20+
echo "password=$(echo $RANDOM | md5sum | head -c 20)" >> $GITHUB_OUTPUT
21+
echo "environment=$(echo $RANDOM | md5sum | head -c 20)" >> $GITHUB_OUTPUT
22+
23+
outputs:
24+
random: ${{ steps.random.outputs.password }}
25+
environment: ${{ steps.random.outputs.environment }}
26+
27+
28+
set_status:
29+
runs-on: ubuntu-latest
30+
needs: [setup]
31+
steps:
32+
- name: Sleep for 10s
33+
uses: juliangruber/sleep-action@v2.0.0
34+
with:
35+
time: 30s
36+
37+
- name: Set status
38+
uses: myrotvorets/set-commit-status-action@master
39+
with:
40+
repo: ${{ github.repository }}
41+
sha: ${{ github.sha }}
42+
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
43+
status: success
44+
context: continuous-delivery/${{ needs.setup.outputs.environment }}.test-app
45+
1746
test:
1847
runs-on: ubuntu-latest
1948
continue-on-error: true
@@ -25,19 +54,23 @@ jobs:
2554
- uses: ./
2655
id: current
2756
with:
28-
param1: 'true'
57+
repository: ${{ github.repository }}
58+
sha: ${{ github.sha }}
59+
status: continuous-delivery/${{ needs.setup.outputs.environment }}.test-app
60+
expected_state: "success"
61+
token: ${{ github.token }}
2962

3063
outputs:
31-
result: "${{ steps.current.outputs.result1 }}"
64+
status: ${{ steps.current.outcome }}
3265

3366
assert:
3467
runs-on: ubuntu-latest
35-
needs: [test]
68+
needs: [test, set_status]
3669
steps:
3770
- uses: nick-fields/assert-action@v1
3871
with:
39-
expected: 'true'
40-
actual: "${{ needs.test.outputs.result }}"
72+
expected: "success"
73+
actual: "${{ needs.test.outputs.status }}"
4174

4275
teardown:
4376
runs-on: ubuntu-latest
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Test wrong status
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+
- id: random
18+
shell: bash
19+
run: |-
20+
echo "password=$(echo $RANDOM | md5sum | head -c 20)" >> $GITHUB_OUTPUT
21+
echo "environment=$(echo $RANDOM | md5sum | head -c 20)" >> $GITHUB_OUTPUT
22+
23+
outputs:
24+
random: ${{ steps.random.outputs.password }}
25+
environment: ${{ steps.random.outputs.environment }}
26+
27+
28+
set_status:
29+
runs-on: ubuntu-latest
30+
needs: [setup]
31+
steps:
32+
- name: Sleep for 10s
33+
uses: juliangruber/sleep-action@v2.0.0
34+
with:
35+
time: 30s
36+
37+
- name: Set status
38+
uses: myrotvorets/set-commit-status-action@master
39+
with:
40+
repo: ${{ github.repository }}
41+
sha: ${{ github.sha }}
42+
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
43+
status: pending
44+
context: continuous-delivery/${{ needs.setup.outputs.environment }}.test-app
45+
46+
test:
47+
runs-on: ubuntu-latest
48+
continue-on-error: true
49+
needs: [setup]
50+
steps:
51+
- name: Checkout
52+
uses: actions/checkout@v3
53+
54+
- uses: ./
55+
id: current
56+
with:
57+
repository: ${{ github.repository }}
58+
sha: ${{ github.sha }}
59+
status: continuous-delivery/${{ needs.setup.outputs.environment }}.test-app
60+
expected_state: "success"
61+
token: ${{ github.token }}
62+
63+
outputs:
64+
status: ${{ steps.current.outcome }}
65+
66+
assert:
67+
runs-on: ubuntu-latest
68+
needs: [test, set_status]
69+
steps:
70+
- uses: nick-fields/assert-action@v1
71+
with:
72+
expected: "failure"
73+
actual: "${{ needs.test.outputs.status }}"
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"

0 commit comments

Comments
 (0)