8a9ff9b0a4
(cherry picked from commitc2a7aaeee8
) (cherry picked from commit6b6007fbce
) (cherry picked from commit63608a221e
) (cherry picked from commit5cfe60baa7
) (cherry picked from commit2af4c73d12
) (cherry picked from commit1985959bfe
) (cherry picked from commit880424c77e
) (cherry picked from commitc78a861d1b
) (cherry picked from commit25c1227011
) (cherry picked from commit7195e894ee
) (cherry picked from commitcf15153873
) (cherry picked from commit9bee773c95
) (cherry picked from commit581c3060da
) (cherry picked from commitbf550f9b2c
) (cherry picked from commitb570eca0b9
) [CI] implementation: Woodpecker based CI (squash) Upgrade xgo to Go v1.20 for building binaries (cherry picked from commit6308c776b6
) [CI] v1.20: switch PR check from Woodpecker CI to Forgejo Actions The PR checks for v1.19 still rely on Woodpecker CI. Keeping .woodpecker in v1.20 while both Woodpecker CI & Forgejo Actions are enabled would dupicate the checks. The release process in releases remains Woodpecker CI. (cherry picked from commit93e42f3f53
) (cherry picked from commit599c5162ad
) (cherry picked from commit6f8b723a55
) (cherry picked from commite238d7d72f
) (cherry picked from commit93e3ebff86
) (cherry picked from commit26bc89ed7b
)
69 lines
1.8 KiB
Bash
Executable file
69 lines
1.8 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
set -ex
|
|
|
|
test_teardown() {
|
|
setup_api
|
|
api DELETE repos/$PUSH_USER/forgejo/releases/tags/$TAG || true
|
|
api DELETE repos/$PUSH_USER/forgejo/tags/$TAG || true
|
|
rm -fr dist/release
|
|
setup_tea
|
|
$BIN_DIR/tea login delete $RELEASETEAMUSER || true
|
|
}
|
|
|
|
test_setup() {
|
|
mkdir -p $RELEASE_DIR
|
|
touch $RELEASE_DIR/file-one.txt
|
|
touch $RELEASE_DIR/file-two.txt
|
|
}
|
|
|
|
test_ensure_tag() {
|
|
api DELETE repos/$PUSH_USER/forgejo/tags/$TAG || true
|
|
#
|
|
# idempotent
|
|
#
|
|
ensure_tag
|
|
api GET repos/$PUSH_USER/forgejo/tags/$TAG > /tmp/tag1.json
|
|
ensure_tag
|
|
api GET repos/$PUSH_USER/forgejo/tags/$TAG > /tmp/tag2.json
|
|
diff -u /tmp/tag[12].json
|
|
#
|
|
# sanity check on the SHA of an existing tag
|
|
#
|
|
(
|
|
CI_COMMIT_SHA=12345
|
|
! ensure_tag
|
|
)
|
|
api DELETE repos/$PUSH_USER/forgejo/tags/$TAG
|
|
}
|
|
|
|
#
|
|
# Running the test locally instead of within Woodpecker
|
|
#
|
|
# 1. Setup: obtain a token at https://codeberg.org/user/settings/applications
|
|
# 2. Run: RELEASETEAMUSER=<username> RELEASETEAMTOKEn=<apptoken> binaries-pull-push-test.sh test_run
|
|
# 3. Verify: (optional) manual verification at https://codeberg.org/<username>/forgejo/releases
|
|
# 4. Cleanup: RELEASETEAMUSER=<username> RELEASETEAMTOKEn=<apptoken> binaries-pull-push-test.sh test_teardown
|
|
#
|
|
test_run() {
|
|
test_teardown
|
|
to_push=/tmp/binaries-releases-to-push
|
|
pulled=/tmp/binaries-releases-pulled
|
|
RELEASE_DIR=$to_push
|
|
test_setup
|
|
test_ensure_tag
|
|
echo "================================ TEST BEGIN"
|
|
push
|
|
RELEASE_DIR=$pulled
|
|
pull
|
|
diff -r $to_push $pulled
|
|
echo "================================ TEST END"
|
|
}
|
|
|
|
: ${CI_REPO_OWNER:=dachary}
|
|
: ${PULL_USER=$CI_REPO_OWNER}
|
|
: ${PUSH_USER=$CI_REPO_OWNER}
|
|
: ${CI_COMMIT_TAG:=W17.8.20-1}
|
|
: ${CI_COMMIT_SHA:=$(git rev-parse HEAD)}
|
|
|
|
. $(dirname $0)/binaries-pull-push.sh
|