mirror of
https://code.forgejo.org/actions/setup-forgejo
synced 2025-06-08 03:58:19 +02:00
example-push-cancel: test that pushing to a branch cancels workflows
This commit is contained in:
parent
44400632c5
commit
fccbd1ce6b
4 changed files with 63 additions and 10 deletions
6
testdata/example-push-cancel/.forgejo/workflows/test.yml
vendored
Normal file
6
testdata/example-push-cancel/.forgejo/workflows/test.yml
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
on: [push]
|
||||
jobs:
|
||||
test:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- run: sleep infinity
|
20
testdata/example-push-cancel/run.sh
vendored
Executable file
20
testdata/example-push-cancel/run.sh
vendored
Executable file
|
@ -0,0 +1,20 @@
|
|||
url=http://root:admin1234@$(cat forgejo-ip):3000
|
||||
token=$(cat forgejo-token)
|
||||
repo=root/example-$example
|
||||
#
|
||||
# push the repository
|
||||
#
|
||||
forgejo-test-helper.sh push_workflow testdata/example-$example $url root example-$example setup-forgejo $token
|
||||
sha=$(forgejo-test-helper.sh branch_tip $url $repo main)
|
||||
#
|
||||
# wait for the workflow (sleep infinity) to start running
|
||||
#
|
||||
forgejo-test-helper.sh wait_running $url $repo $sha
|
||||
#
|
||||
# push to the same branch
|
||||
#
|
||||
forgejo-test-helper.sh push_workflow testdata/example-$example $url root example-$example setup-forgejo $token
|
||||
#
|
||||
# wait for the workflow to be canceld as a result of the previous push
|
||||
#
|
||||
forgejo-test-helper.sh wait_failure $url $repo $sha 'Has been cancelled'
|
4
testdata/example-push-cancel/teardown.sh
vendored
Normal file
4
testdata/example-push-cancel/teardown.sh
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
#
|
||||
# this will effectively discard any linger workflow so they do not interfere with other tests
|
||||
#
|
||||
forgejo-runner.sh reload
|
Loading…
Add table
Add a link
Reference in a new issue