Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
83 changes: 83 additions & 0 deletions .github/workflows/test-increased-wait-time.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Test increased timeout
on:
# # Uncomment when test added first time to register workflow and comment it back after workflow would be registered
# #
# # Added pull_request to register workflow from the PR.
# # Read more https://stackoverflow.com/questions/63362126/github-actions-how-to-run-a-workflow-created-on-a-non-master-branch-from-the-wo
# pull_request: {}
workflow_dispatch: {}

jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Setup
run: echo "Do setup"

- id: random
shell: bash
run: |-
echo "password=$(echo $RANDOM | md5sum | head -c 20)" >> $GITHUB_OUTPUT
echo "environment=$(echo $RANDOM | md5sum | head -c 20)" >> $GITHUB_OUTPUT

outputs:
random: ${{ steps.random.outputs.password }}
environment: ${{ steps.random.outputs.environment }}

set_status:
runs-on: ubuntu-latest
needs: [setup]
steps:
- name: Sleep for 10s
uses: juliangruber/sleep-action@v2.0.0
with:
time: 70s

- name: Set status
uses: myrotvorets/set-commit-status-action@master
with:
repo: ${{ github.repository }}
sha: ${{ github.sha }}
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
status: success
context: continuous-delivery/${{ needs.setup.outputs.environment }}.test-app

test:
runs-on: ubuntu-latest
continue-on-error: true
needs: [setup]
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: ./
id: current
with:
repository: ${{ github.repository }}
sha: ${{ github.sha }}
status: continuous-delivery/${{ needs.setup.outputs.environment }}.test-app
expected_state: "success"
token: ${{ github.token }}
check-timeout: 120
check-retry-count: 5
check-retry-interval: 20

outputs:
status: ${{ steps.current.outcome }}

assert:
runs-on: ubuntu-latest
needs: [test, set_status]
steps:
- uses: nick-fields/assert-action@v1
with:
expected: "success"
actual: "${{ needs.test.outputs.status }}"

teardown:
runs-on: ubuntu-latest
needs: [assert]
if: ${{ always() }}
steps:
- name: Tear down
run: echo "Do Tear down"
36 changes: 25 additions & 11 deletions .github/workflows/test-negative.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Test example negative
name: Test No status
on:
# # Uncomment when test added first time to register workflow and comment it back after workflow would be registered
# #
# # Added pull_request to register workflow from the PR.
# # Read more https://stackoverflow.com/questions/63362126/github-actions-how-to-run-a-workflow-created-on-a-non-master-branch-from-the-wo
# pull_request: {}
# # Uncomment when test added first time to register workflow and comment it back after workflow would be registered
# #
# # Added pull_request to register workflow from the PR.
# # Read more https://stackoverflow.com/questions/63362126/github-actions-how-to-run-a-workflow-created-on-a-non-master-branch-from-the-wo
# pull_request: {}
workflow_dispatch: {}

jobs:
Expand All @@ -14,30 +14,44 @@ jobs:
- name: Setup
run: echo "Do setup"

- id: random
shell: bash
run: |-
echo "password=$(echo $RANDOM | md5sum | head -c 20)" >> $GITHUB_OUTPUT
echo "environment=$(echo $RANDOM | md5sum | head -c 20)" >> $GITHUB_OUTPUT

outputs:
random: ${{ steps.random.outputs.password }}
environment: ${{ steps.random.outputs.environment }}

test:
runs-on: ubuntu-latest
needs: [setup]
continue-on-error: true
needs: [setup]
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: ./
id: current
with:
param1: 'false'
repository: ${{ github.repository }}
sha: ${{ github.sha }}
status: continuous-delivery/${{ needs.setup.outputs.environment }}.test-app
expected_state: "success"
token: ${{ github.token }}

outputs:
result: "${{ steps.current.outputs.result1 }}"
status: ${{ steps.current.outcome }}

assert:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: nick-fields/assert-action@v1
with:
expected: 'false'
actual: "${{ needs.test.outputs.result }}"
expected: "failure"
actual: "${{ needs.test.outputs.status }}"

teardown:
runs-on: ubuntu-latest
Expand Down
55 changes: 44 additions & 11 deletions .github/workflows/test-positive.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Test example positive
name: Test Positive
on:
# # Uncomment when test added first time to register workflow and comment it back after workflow would be registered
# #
# # Added pull_request to register workflow from the PR.
# # Read more https://stackoverflow.com/questions/63362126/github-actions-how-to-run-a-workflow-created-on-a-non-master-branch-from-the-wo
# pull_request: {}
# # Uncomment when test added first time to register workflow and comment it back after workflow would be registered
# #
# # Added pull_request to register workflow from the PR.
# # Read more https://stackoverflow.com/questions/63362126/github-actions-how-to-run-a-workflow-created-on-a-non-master-branch-from-the-wo
# pull_request: {}
workflow_dispatch: {}

jobs:
Expand All @@ -14,6 +14,35 @@ jobs:
- name: Setup
run: echo "Do setup"

- id: random
shell: bash
run: |-
echo "password=$(echo $RANDOM | md5sum | head -c 20)" >> $GITHUB_OUTPUT
echo "environment=$(echo $RANDOM | md5sum | head -c 20)" >> $GITHUB_OUTPUT

outputs:
random: ${{ steps.random.outputs.password }}
environment: ${{ steps.random.outputs.environment }}


set_status:
runs-on: ubuntu-latest
needs: [setup]
steps:
- name: Sleep for 10s
uses: juliangruber/sleep-action@v2.0.0
with:
time: 30s

- name: Set status
uses: myrotvorets/set-commit-status-action@master
with:
repo: ${{ github.repository }}
sha: ${{ github.sha }}
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
status: success
context: continuous-delivery/${{ needs.setup.outputs.environment }}.test-app

test:
runs-on: ubuntu-latest
continue-on-error: true
Expand All @@ -25,19 +54,23 @@ jobs:
- uses: ./
id: current
with:
param1: 'true'
repository: ${{ github.repository }}
sha: ${{ github.sha }}
status: continuous-delivery/${{ needs.setup.outputs.environment }}.test-app
expected_state: "success"
token: ${{ github.token }}

outputs:
result: "${{ steps.current.outputs.result1 }}"
status: ${{ steps.current.outcome }}

assert:
runs-on: ubuntu-latest
needs: [test]
needs: [test, set_status]
steps:
- uses: nick-fields/assert-action@v1
with:
expected: 'true'
actual: "${{ needs.test.outputs.result }}"
expected: "success"
actual: "${{ needs.test.outputs.status }}"

teardown:
runs-on: ubuntu-latest
Expand Down
81 changes: 81 additions & 0 deletions .github/workflows/test-wrong-status.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Test wrong status
on:
# # Uncomment when test added first time to register workflow and comment it back after workflow would be registered
# #
# # Added pull_request to register workflow from the PR.
# # Read more https://stackoverflow.com/questions/63362126/github-actions-how-to-run-a-workflow-created-on-a-non-master-branch-from-the-wo
# pull_request: {}
workflow_dispatch: {}

jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Setup
run: echo "Do setup"

- id: random
shell: bash
run: |-
echo "password=$(echo $RANDOM | md5sum | head -c 20)" >> $GITHUB_OUTPUT
echo "environment=$(echo $RANDOM | md5sum | head -c 20)" >> $GITHUB_OUTPUT

outputs:
random: ${{ steps.random.outputs.password }}
environment: ${{ steps.random.outputs.environment }}


set_status:
runs-on: ubuntu-latest
needs: [setup]
steps:
- name: Sleep for 10s
uses: juliangruber/sleep-action@v2.0.0
with:
time: 30s

- name: Set status
uses: myrotvorets/set-commit-status-action@master
with:
repo: ${{ github.repository }}
sha: ${{ github.sha }}
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
status: pending
context: continuous-delivery/${{ needs.setup.outputs.environment }}.test-app

test:
runs-on: ubuntu-latest
continue-on-error: true
needs: [setup]
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: ./
id: current
with:
repository: ${{ github.repository }}
sha: ${{ github.sha }}
status: continuous-delivery/${{ needs.setup.outputs.environment }}.test-app
expected_state: "success"
token: ${{ github.token }}

outputs:
status: ${{ steps.current.outcome }}

assert:
runs-on: ubuntu-latest
needs: [test, set_status]
steps:
- uses: nick-fields/assert-action@v1
with:
expected: "failure"
actual: "${{ needs.test.outputs.status }}"

teardown:
runs-on: ubuntu-latest
needs: [assert]
if: ${{ always() }}
steps:
- name: Tear down
run: echo "Do Tear down"
Loading