From f9e93647fb3f275c003e73cda2e02f9f0d6bd7a2 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sat, 13 Jan 2024 17:57:29 +0100 Subject: [PATCH 1/3] update hacking instructions --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f85ed11..77f5eb7 100644 --- a/README.md +++ b/README.md @@ -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 From dcc61603a2cef8832df6e873443900c3c4453d1c Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sat, 13 Jan 2024 18:03:40 +0100 Subject: [PATCH 2/3] actions: add example-tag --- .../example-tag/.forgejo/workflows/test.yml | 21 +++++++++++++++++++ actions/example-tag/run.sh | 19 +++++++++++++++++ actions/run.sh | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 actions/example-tag/.forgejo/workflows/test.yml create mode 100755 actions/example-tag/run.sh diff --git a/actions/example-tag/.forgejo/workflows/test.yml b/actions/example-tag/.forgejo/workflows/test.yml new file mode 100644 index 0000000..c7e1357 --- /dev/null +++ b/actions/example-tag/.forgejo/workflows/test.yml @@ -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 diff --git a/actions/example-tag/run.sh b/actions/example-tag/run.sh new file mode 100755 index 0000000..001c303 --- /dev/null +++ b/actions/example-tag/run.sh @@ -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 diff --git a/actions/run.sh b/actions/run.sh index 84d7707..b40cc68 100755 --- a/actions/run.sh +++ b/actions/run.sh @@ -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() { From 6236202f0946709efaabf3c329b3eeca31a9f50b Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sat, 13 Jan 2024 18:19:56 +0100 Subject: [PATCH 3/3] actions: CASCADE_DOCS_FORCE_VERSION can force generating a version --- .forgejo/cascading-docs | 2 +- .forgejo/workflows/actions.yml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.forgejo/cascading-docs b/.forgejo/cascading-docs index 7bc4103..63a5bd9 100755 --- a/.forgejo/cascading-docs +++ b/.forgejo/cascading-docs @@ -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 diff --git a/.forgejo/workflows/actions.yml b/.forgejo/workflows/actions.yml index e2d70b2..a4f27a9 100644 --- a/.forgejo/workflows/actions.yml +++ b/.forgejo/workflows/actions.yml @@ -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 }}"