Merge pull request 'actions: add example-tag' (#67) from earl-warren/end-to-end:wip-event into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/67
This commit is contained in:
commit
6e3976b17c
6 changed files with 50 additions and 5 deletions
|
@ -14,7 +14,7 @@ fi
|
|||
|
||||
cd $docs/docs/user
|
||||
|
||||
if ! test -f actions-contexts/version.txt || test "$VERSION" != $(cat actions-contexts/version.txt) ; then
|
||||
if test "$FORCE_VERSION" = "$VERSION" || ! test -f actions-contexts/version.txt || test "$VERSION" != $(cat actions-contexts/version.txt) ; then
|
||||
rm -fr actions-contexts
|
||||
mkdir actions-contexts
|
||||
echo "$VERSION" > actions-contexts/version.txt
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
# forgejo-cascading-pr (https://codeberg.org/forgejo-cascading-pr)
|
||||
# secrets.CASCADE_DOCS_DESTINATION_TOKEN
|
||||
# https://codeberg.org/forgejo-cascading-pr scope write:issue, write:repository, read:user
|
||||
# vars.CASCADE_DOCS_FORCE_VERSION
|
||||
# replace the generated documentation for a given version even if it has already
|
||||
# been generated (e.g. v1.22.0-test)
|
||||
#
|
||||
|
||||
on:
|
||||
|
@ -75,4 +78,5 @@ jobs:
|
|||
prefix: ${{ env.GITHUB_REPOSITORY }}-${{ matrix.info.version }}
|
||||
update: .forgejo/cascading-docs
|
||||
env:
|
||||
FORCE_VERSION: "${{ vars.CASCADE_DOCS_FORCE_VERSION }}"
|
||||
VERSION: "${{ steps.run.outputs.full_version }}"
|
||||
|
|
|
@ -28,24 +28,25 @@ export PATH=$(pwd)/setup-forgejo:$PATH
|
|||
git clone https://code.forgejo.org/forgejo/end-to-end
|
||||
cd end-to-end
|
||||
export DIR=/tmp/end-to-end
|
||||
sudo rm -fr /srv/example ; sudo mkdir /srv/example ; sudo chown -R $USER /srv/example
|
||||
```
|
||||
|
||||
Run one example
|
||||
|
||||
```sh
|
||||
actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v1.22.0-test/forgejo-1.22.0-test-linux-amd64 v1_22 cron # runs actions/example-cron
|
||||
actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v1.22.0-test/forgejo-1.22.0-test-linux-amd64 v1.22.0-test v1_22 cron # runs actions/example-cron
|
||||
```
|
||||
|
||||
Cleanup
|
||||
|
||||
```sh
|
||||
actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v1.22.0-test/forgejo-1.22.0-test-linux-amd64 v1_22 none
|
||||
actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v1.22.0-test/forgejo-1.22.0-test-linux-amd64 v1.22.0-test v1_22 none
|
||||
```
|
||||
|
||||
Run all examples for v1_22
|
||||
|
||||
```sh
|
||||
actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v1.22.0-test/forgejo-1.22.0-test-linux-amd64 v1_22
|
||||
actions/run.sh https://codeberg.org/forgejo-experimental/forgejo/releases/download/v1.22.0-test/forgejo-1.22.0-test-linux-amd64 v1.22.0-test v1_22
|
||||
```
|
||||
|
||||
### Remote testing
|
||||
|
|
21
actions/example-tag/.forgejo/workflows/test.yml
Normal file
21
actions/example-tag/.forgejo/workflows/test.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: code.forgejo.org/oci/node:20-bookworm
|
||||
volumes:
|
||||
- /srv/example:/srv/example
|
||||
steps:
|
||||
|
||||
- name: save event
|
||||
run: |
|
||||
d=/srv/example/tag/contexts/$GITHUB_EVENT_NAME
|
||||
mkdir -p $d
|
||||
cat > $d/github <<'EOF'
|
||||
${{ toJSON(github) }}
|
||||
EOF
|
19
actions/example-tag/run.sh
Executable file
19
actions/example-tag/run.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
export d=/srv/example/tag
|
||||
|
||||
function main() {
|
||||
mkdir -p $d
|
||||
|
||||
local repo=root/example-$example
|
||||
|
||||
forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token
|
||||
local sha=$(forgejo-test-helper.sh branch_tip $url $repo main)
|
||||
|
||||
local api=$url/api/v1
|
||||
forgejo-curl.sh api_json --data-raw '{"tag_name":"v1.1","target":"'$sha'"}' $api/repos/$repo/tags
|
||||
|
||||
forgejo-test-helper.sh wait_success $url $repo $sha
|
||||
|
||||
test -f /srv/example/tag/contexts/push/github
|
||||
}
|
||||
|
||||
main
|
|
@ -35,7 +35,7 @@ function examples_v1_20() {
|
|||
|
||||
function examples_v1_21() {
|
||||
# keep "cron" last otherwise it will linger and pollute the following runs
|
||||
echo 'echo push push-cancel artifacts service checkout pull-request container expression local-action context docker-action if if-fail cron'
|
||||
echo 'echo push tag push-cancel artifacts service checkout pull-request container expression local-action context docker-action if if-fail cron'
|
||||
}
|
||||
|
||||
function examples_v1_22() {
|
||||
|
|
Loading…
Add table
Reference in a new issue