IPv6 tests

This commit is contained in:
Earl Warren 2023-12-02 19:18:51 +01:00
parent f3ac0def98
commit d7e471a392
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
2 changed files with 68 additions and 5 deletions

11
.forgejo/testdata/ipv6.yml vendored Normal file
View file

@ -0,0 +1,11 @@
---
on: push
jobs:
ipv6:
runs-on: docker
container:
image: debian:bookworm
steps:
- run: |
apt update -qq ; apt --quiet install -qq --yes iputils-ping
ping -c 1 -6 ::1

View file

@ -15,14 +15,14 @@ env:
GOPROXY: https://goproxy.io,direct GOPROXY: https://goproxy.io,direct
jobs: jobs:
tests: build-and-tests:
name: check and test name: build and test
if: github.repository_owner != 'forgejo-integration' && github.repository_owner != 'forgejo-experimental' && github.repository_owner != 'forgejo-release' if: github.repository_owner != 'forgejo-integration' && github.repository_owner != 'forgejo-experimental' && github.repository_owner != 'forgejo-release'
runs-on: docker runs-on: docker
services: services:
forgejo: forgejo:
image: codeberg.org/forgejo/forgejo:1.20.4-1 image: codeberg.org/forgejo/forgejo:1.21
env: env:
FORGEJO__security__INSTALL_LOCK: "true" FORGEJO__security__INSTALL_LOCK: "true"
FORGEJO__log__LEVEL: "debug" FORGEJO__log__LEVEL: "debug"
@ -40,17 +40,69 @@ jobs:
with: with:
go-version: '1.21' go-version: '1.21'
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- run: make vet - run: make vet
- run: make build - run: make build
- uses: https://code.forgejo.org/actions/upload-artifact@v3
with:
name: forgejo-runner
path: forgejo-runner
- name: check the forgejo server is responding - name: check the forgejo server is responding
run: | run: |
set -x
apt-get update -qq apt-get update -qq
apt-get install -y -qq jq curl apt-get install -y -qq jq curl
test $FORGEJO_ADMIN_USER = $(curl -sS http://$FORGEJO_ADMIN_USER:$FORGEJO_ADMIN_PASSWORD@$FORGEJO_HOST_PORT/api/v1/user | jq --raw-output .login) test $FORGEJO_ADMIN_USER = $(curl -sS http://$FORGEJO_ADMIN_USER:$FORGEJO_ADMIN_PASSWORD@$FORGEJO_HOST_PORT/api/v1/user | jq --raw-output .login)
- run: make FORGEJO_URL=http://$FORGEJO_HOST_PORT test - run: make FORGEJO_URL=http://$FORGEJO_HOST_PORT test
runner-exec-tests:
needs: [build-and-tests]
name: runner exec tests
if: github.repository_owner != 'forgejo-integration' && github.repository_owner != 'forgejo-experimental' && github.repository_owner != 'forgejo-release'
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- uses: https://code.forgejo.org/actions/download-artifact@v3
with:
name: forgejo-runner
- name: install docker
run: |
mkdir /etc/docker
cat > /etc/docker/daemon.json <<EOF
{
"ipv6": true,
"experimental": true,
"ip6tables": true,
"fixed-cidr-v6": "fd05:d0ca:1::/64",
"default-address-pools": [
{
"base": "172.19.0.0/16",
"size": 24
},
{
"base": "fd05:d0ca:2::/104",
"size": 112
}
]
}
EOF
apt --quiet install --yes -qq docker.io
- name: forgejo-runner exec --enable-ipv6
run: |
set -x
chmod +x forgejo-runner
./forgejo-runner exec --enable-ipv6 --workflows .forgejo/testdata/ipv6.yml
if ./forgejo-runner exec --workflows .forgejo/testdata/ipv6.yml >& /tmp/out ; then
cat /tmp/out
echo "IPv6 not enabled, should fail"
exit 1
fi