2023-04-30 11:26:17 -05:00
|
|
|
name: Integration tests for the release process
|
|
|
|
|
2024-05-19 05:35:31 -05:00
|
|
|
on:
|
2023-04-30 11:26:17 -05:00
|
|
|
push:
|
|
|
|
paths:
|
|
|
|
- go.mod
|
2023-05-30 04:47:06 -05:00
|
|
|
- Dockerfile
|
2023-08-25 07:25:36 -05:00
|
|
|
- .forgejo/workflows/build-release.yml
|
|
|
|
- .forgejo/workflows/build-release-integration.yml
|
2024-05-19 05:35:31 -05:00
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- go.mod
|
|
|
|
- Dockerfile
|
|
|
|
- .forgejo/workflows/build-release.yml
|
|
|
|
- .forgejo/workflows/build-release-integration.yml
|
2023-04-30 11:26:17 -05:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
release-simulation:
|
|
|
|
runs-on: self-hosted
|
2023-08-25 07:25:36 -05:00
|
|
|
if: github.repository_owner != 'forgejo-integration' && github.repository_owner != 'forgejo-release'
|
2023-04-30 11:26:17 -05:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- id: forgejo
|
|
|
|
uses: https://code.forgejo.org/actions/setup-forgejo@v1
|
|
|
|
with:
|
|
|
|
user: root
|
|
|
|
password: admin1234
|
2023-11-05 12:53:11 -06:00
|
|
|
image-version: 1.20
|
2023-04-30 11:26:17 -05:00
|
|
|
lxc-ip-prefix: 10.0.9
|
|
|
|
|
2023-08-25 07:25:36 -05:00
|
|
|
- name: publish
|
2023-04-30 11:26:17 -05:00
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
|
2023-08-25 07:25:36 -05:00
|
|
|
version=1.2.3
|
|
|
|
cat > /etc/docker/daemon.json <<EOF
|
|
|
|
{
|
|
|
|
"insecure-registries" : ["${{ steps.forgejo.outputs.host-port }}"]
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
systemctl restart docker
|
|
|
|
|
2023-04-30 11:26:17 -05:00
|
|
|
dir=$(mktemp -d)
|
|
|
|
trap "rm -fr $dir" EXIT
|
|
|
|
|
|
|
|
url=http://root:admin1234@${{ steps.forgejo.outputs.host-port }}
|
|
|
|
export FORGEJO_RUNNER_LOGS="${{ steps.forgejo.outputs.runner-logs }}"
|
|
|
|
|
|
|
|
#
|
|
|
|
# Create a new project with the runner and the release workflow only
|
|
|
|
#
|
|
|
|
rsync -a --exclude .git ./ $dir/
|
2023-08-25 07:25:36 -05:00
|
|
|
rm $(find $dir/.forgejo/workflows/*.yml | grep -v build-release.yml)
|
2023-11-05 12:53:11 -06:00
|
|
|
forgejo-test-helper.sh push $dir $url root runner
|
|
|
|
sha=$(forgejo-test-helper.sh branch_tip $url root/runner main)
|
2023-04-30 11:26:17 -05:00
|
|
|
|
|
|
|
#
|
|
|
|
# Push a tag to trigger the release workflow and wait for it to complete
|
|
|
|
#
|
2023-11-05 12:53:11 -06:00
|
|
|
forgejo-curl.sh api_json --data-raw '{"tag_name": "v'$version'", "target": "'$sha'"}' $url/api/v1/repos/root/runner/tags
|
2023-04-30 11:26:17 -05:00
|
|
|
LOOPS=180 forgejo-test-helper.sh wait_success "$url" root/runner $sha
|
|
|
|
|
2023-08-25 07:25:36 -05:00
|
|
|
#
|
|
|
|
# uncomment to see the logs even when everything is reported to be working ok
|
|
|
|
#
|
|
|
|
#cat $FORGEJO_RUNNER_LOGS
|
|
|
|
|
2023-04-30 11:26:17 -05:00
|
|
|
#
|
|
|
|
# Minimal sanity checks. e2e test is for the setup-forgejo action
|
2023-08-25 07:25:36 -05:00
|
|
|
#
|
|
|
|
for arch in amd64 arm64 ; do
|
|
|
|
binary=forgejo-runner-$version-linux-$arch
|
|
|
|
for suffix in '' '.xz' ; do
|
|
|
|
curl --fail -L -sS $url/root/runner/releases/download/v$version/$binary$suffix > $binary$suffix
|
|
|
|
if test "$suffix" = .xz ; then
|
|
|
|
unxz --keep $binary$suffix
|
|
|
|
fi
|
|
|
|
chmod +x $binary
|
|
|
|
./$binary --version | grep $version
|
|
|
|
curl --fail -L -sS $url/root/runner/releases/download/v$version/$binary$suffix.sha256 > $binary$suffix.sha256
|
|
|
|
shasum -a 256 --check $binary$suffix.sha256
|
|
|
|
rm $binary$suffix
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
docker pull ${{ steps.forgejo.outputs.host-port }}/root/runner:$version
|
2024-05-19 09:20:33 -05:00
|
|
|
|
|
|
|
docker inspect ${{ steps.forgejo.outputs.host-port}}/root/runner:$version > labels.json
|
|
|
|
python3 .forgejo/labelscompare.py
|