@@ -34,10 +34,10 @@ jobs:
3434 lxc-ip-prefix : 10.0.9
3535
3636 - name : publish the forgejo release
37+ shell : bash
3738 run : |
3839 set -x
3940
40- version=1.2.3
4141 cat > /etc/docker/daemon.json <<EOF
4242 {
4343 "insecure-registries" : ["${{ steps.forgejo.outputs.host-port }}"]
5353 url=http://root:admin1234@${{ steps.forgejo.outputs.host-port }}
5454 export FORGEJO_RUNNER_LOGS="${{ steps.forgejo.outputs.runner-logs }}"
5555
56+ function sanity_check() {
57+ local url=$1 version=$2
58+ #
59+ # Minimal sanity checks. Since the binary
60+ # is a script shell it does not test the sanity of the cross
61+ # build, only the sanity of the naming of the binaries.
62+ #
63+ for arch in amd64 arm64 arm-6 ; do
64+ local binary=forgejo-$version-linux-$arch
65+ for suffix in '' '.xz' ; do
66+ curl --fail -L -sS $url/root/forgejo/releases/download/v$version/$binary$suffix > $binary$suffix
67+ if test "$suffix" = .xz ; then
68+ unxz --keep $binary$suffix
69+ fi
70+ chmod +x $binary
71+ ./$binary --version | grep $version
72+ curl --fail -L -sS $url/root/forgejo/releases/download/v$version/$binary$suffix.sha256 > $binary$suffix.sha256
73+ shasum -a 256 --check $binary$suffix.sha256
74+ rm $binary$suffix
75+ done
76+ done
77+
78+ local sources=forgejo-src-$version.tar.gz
79+ curl --fail -L -sS $url/root/forgejo/releases/download/v$version/$sources > $sources
80+ curl --fail -L -sS $url/root/forgejo/releases/download/v$version/$sources.sha256 > $sources.sha256
81+ shasum -a 256 --check $sources.sha256
82+
83+ docker pull ${{ steps.forgejo.outputs.host-port }}/root/forgejo:$version
84+ docker pull ${{ steps.forgejo.outputs.host-port }}/root/forgejo:$version-rootless
85+ }
86+
5687 #
5788 # Create a new project with a fake forgejo and the release workflow only
5889 #
@@ -62,46 +93,41 @@ jobs:
6293 cp $dir/Dockerfile $dir/Dockerfile.rootless
6394
6495 forgejo-test-helper.sh push $dir $url root forgejo
65- sha=$(forgejo-test-helper.sh branch_tip $url root/forgejo main)
6696
67- #
68- # Push a tag to trigger the release workflow and wait for it to complete
69- #
70- forgejo-curl.sh api_json --data-raw '{"tag_name": "v'$version'", "target": "'$sha'"}' $url/api/v1/repos/root/forgejo/tags
7197 forgejo-curl.sh api_json -X PUT --data-raw '{"data":"${{ steps.forgejo.outputs.token }}"}' $url/api/v1/repos/root/forgejo/actions/secrets/TOKEN
7298 forgejo-curl.sh api_json -X PUT --data-raw '{"data":"root"}' $url/api/v1/repos/root/forgejo/actions/secrets/DOER
73- LOOPS=180 forgejo-test-helper .sh wait_success "$url" root/forgejo $sha
99+ forgejo-curl .sh api_json -X PUT --data-raw '{"data":"true"}' $url/api/v1/repos/ root/forgejo/actions/secrets/VERBOSE
74100
75101 #
76- # uncomment to see the logs even when everything is reported to be working ok
102+ # Push a tag to trigger the release workflow and wait for it to complete
77103 #
78- #cat $FORGEJO_RUNNER_LOGS
104+ version=1.2.3
105+ sha=$(forgejo-test-helper.sh branch_tip $url root/forgejo main)
106+ forgejo-curl.sh api_json --data-raw '{"tag_name": "v'$version'", "target": "'$sha'"}' $url/api/v1/repos/root/forgejo/tags
107+ LOOPS=180 forgejo-test-helper.sh wait_success "$url" root/forgejo $sha
108+ sanity_check $url $version
79109
80110 #
81- # Minimal sanity checks. e2e test is for the setup-forgejo
82- # action and the infrastructure playbook. Since the binary
83- # is a script shell it does not test the sanity of the cross
84- # build, only the sanity of the naming of the binaries.
111+ # Push a commit to a branch that triggers the build of a test release
85112 #
86- for arch in amd64 arm64 arm-6 ; do
87- binary=forgejo-$version-linux-$arch
88- for suffix in '' '.xz' ; do
89- curl --fail -L -sS $url/root/forgejo/releases/download/v$version/$binary$suffix > $binary$suffix
90- if test "$suffix" = .xz ; then
91- unxz --keep $binary$suffix
92- fi
93- chmod +x $binary
94- ./$binary --version | grep $version
95- curl --fail -L -sS $url/root/forgejo/releases/download/v$version/$binary$suffix.sha256 > $binary$suffix.sha256
96- shasum -a 256 --check $binary$suffix.sha256
97- rm $binary$suffix
98- done
99- done
100-
101- sources=forgejo-src-$version.tar.gz
102- curl --fail -L -sS $url/root/forgejo/releases/download/v$version/$sources > $sources
103- curl --fail -L -sS $url/root/forgejo/releases/download/v$version/$sources.sha256 > $sources.sha256
104- shasum -a 256 --check $sources.sha256
113+ version=forgejo-test
114+ (
115+ git clone $url/root/forgejo /tmp/forgejo
116+ cd /tmp/forgejo
117+ date > DATE
118+ git config user.email [email protected] 119+ git config user.name username
120+ git add .
121+ git commit -m 'update'
122+ git push $url/root/forgejo main:forgejo
123+ )
124+ sha=$(forgejo-test-helper.sh branch_tip $url root/forgejo forgejo)
125+ LOOPS=180 forgejo-test-helper.sh wait_success "$url" root/forgejo $sha
126+ sanity_check $url $version
105127
106- docker pull ${{ steps.forgejo.outputs.host-port }}/root/forgejo:$version
107- docker pull ${{ steps.forgejo.outputs.host-port }}/root/forgejo:$version-rootless
128+ - name : full logs
129+ if : always()
130+ run : |
131+ sed -e 's/^/[RUNNER LOGS] /' ${{ steps.forgejo.outputs.runner-logs }}
132+ docker logs forgejo | sed -e 's/^/[FORGEJO LOGS]/'
133+ sleep 5 # hack to avoid mixing outputs in Forgejo v1.21
0 commit comments