From a1889ac34881f7107ab9daabfce232e9313f99be Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Wed, 20 Mar 2024 17:32:06 +0100 Subject: [PATCH] [CI] simplify end-to-end test cascading PR Closes: https://codeberg.org/forgejo/forgejo/issues/2670 --- .forgejo/cascading-pr-end-to-end | 15 ++++--- .../workflows/cascade-setup-end-to-end.yml | 42 +------------------ Makefile | 4 ++ 3 files changed, 14 insertions(+), 47 deletions(-) diff --git a/.forgejo/cascading-pr-end-to-end b/.forgejo/cascading-pr-end-to-end index 2350394f2..d7a6b46b4 100755 --- a/.forgejo/cascading-pr-end-to-end +++ b/.forgejo/cascading-pr-end-to-end @@ -9,9 +9,15 @@ forgejo_pr_or_ref=$4 cd $forgejo full_version=$(make show-version-full) -major_version=$(make show-version-major) +minor_version=$(make show-version-minor) cd $end_to_end + +if ! test -f forgejo/sources/$minor_version ; then + echo "FAIL: forgejo/sources/$minor_version does not exist in the end-to-end repository" + false +fi + date > last-upgrade if test -f "$forgejo_pr_or_ref" ; then @@ -20,11 +26,8 @@ if test -f "$forgejo_pr_or_ref" ; then test "$head_url" != null branch=$(jq --raw-output .head.ref < $forgejo_pr) test "$branch" != null - echo $head_url $branch $full_version > forgejo/sources/$major_version + echo $head_url $branch $full_version > forgejo/sources/$minor_version else forgejo_ref=$forgejo_pr_or_ref - echo $GITHUB_SERVER_URL/$GITHUB_REPOSITORY ${forgejo_ref#refs/heads/} $full_version > forgejo/sources/$major_version + echo $GITHUB_SERVER_URL/$GITHUB_REPOSITORY ${forgejo_ref#refs/heads/} $full_version > forgejo/sources/$minor_version fi - -test "$GITHUB_RUN_NUMBER" -echo $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_NUMBER/artifacts/forgejo > forgejo/binary-url diff --git a/.forgejo/workflows/cascade-setup-end-to-end.yml b/.forgejo/workflows/cascade-setup-end-to-end.yml index 85871ec31..dcca2404d 100644 --- a/.forgejo/workflows/cascade-setup-end-to-end.yml +++ b/.forgejo/workflows/cascade-setup-end-to-end.yml @@ -42,45 +42,6 @@ jobs: ${{ toJSON(github.event) }} EOF - build: - if: > - !startsWith(vars.ROLE, 'forgejo-') && ( - github.event_name == 'push' || - ( - github.event.action == 'label_updated' && contains(github.event.pull_request.labels.*.name, 'run-end-to-end-tests') - ) - ) - runs-on: docker - container: - image: 'docker.io/node:20-bookworm' - steps: - - uses: https://code.forgejo.org/actions/checkout@v3 - with: - fetch-depth: '0' - show-progress: 'false' - - name: adduser forgejo - run: | - git config --add safe.directory '*' - git config user.email "you@example.com" - git config user.name "Your Name" - adduser --quiet --comment forgejo --disabled-password forgejo - chown -R forgejo:forgejo . - - uses: https://code.forgejo.org/actions/setup-go@v4 - with: - go-version: "1.21" - - name: make deps-backend - run: | - su forgejo -c 'make deps-backend' - - name: make forgejo - run: | - su forgejo -c 'make generate-backend static-executable && ln gitea forgejo' - env: - TAGS: bindata sqlite sqlite_unlock_notify - - uses: actions/upload-artifact@v3 - with: - name: forgejo - path: forgejo - cascade: if: > !startsWith(vars.ROLE, 'forgejo-') && ( @@ -89,7 +50,6 @@ jobs: github.event.action == 'label_updated' && contains(github.event.pull_request.labels.*.name, 'run-end-to-end-tests') ) ) - needs: [build] runs-on: docker container: image: node:20-bookworm @@ -108,7 +68,7 @@ jobs: destination-url: https://code.forgejo.org destination-fork-repo: cascading-pr/end-to-end destination-repo: forgejo/end-to-end - destination-branch: forgejo-pr + destination-branch: main destination-token: ${{ secrets.END_TO_END_CASCADING_PR_DESTINATION }} close-merge: true update: .forgejo/cascading-pr-end-to-end diff --git a/Makefile b/Makefile index 1c1524f95..db23e31b2 100644 --- a/Makefile +++ b/Makefile @@ -95,6 +95,7 @@ else FORGEJO_VERSION ?= $(shell git describe --exclude '*-test' --tags --always | sed 's/^v//' | sed 's/\-g/-/')+${GITEA_COMPATIBILITY} endif FORGEJO_VERSION_MAJOR=$(shell echo $(FORGEJO_VERSION) | sed -e 's/\..*//') +FORGEJO_VERSION_MINOR=$(shell echo $(FORGEJO_VERSION) | sed -E -e 's/^([0-9]+\.[0-9]+).*/\1/') show-version-full: @echo ${FORGEJO_VERSION} @@ -102,6 +103,9 @@ show-version-full: show-version-major: @echo ${FORGEJO_VERSION_MAJOR} +show-version-minor: + @echo ${FORGEJO_VERSION_MINOR} + RELEASE_VERSION ?= ${FORGEJO_VERSION} VERSION ?= ${RELEASE_VERSION}