mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 04:05:42 +01:00
[CI] simplify end-to-end test cascading PR
Closes: https://codeberg.org/forgejo/forgejo/issues/2670
This commit is contained in:
parent
cc1c000ac8
commit
a1889ac348
3 changed files with 14 additions and 47 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
4
Makefile
4
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}
|
||||
|
||||
|
|
Loading…
Reference in a new issue