mirror of
https://github.com/angristan/openvpn-install.git
synced 2025-12-11 23:12:41 +01:00
### Summary - Add automated end-to-end testing using Docker to verify the installation script works across 18 Linux distributions - Add Oracle Linux 9 support to the installation script - Drop support for EOL distributions (Debian 8/9/10, CentOS 7, Ubuntu 16.04) - Disable Digital Ocean droplets based end-to-end tests, let's use docker from now on ### Changes **New test infrastructure:** - `test/Dockerfile.server` - Multi-OS server image with `BASE_IMAGE` build arg - `test/Dockerfile.client` - Ubuntu 24.04 client for connectivity testing - `test/server-entrypoint.sh` - Runs install script, verifies files exist, asserts iptables NAT rules, starts OpenVPN - `test/client-entrypoint.sh` - Connects to VPN, verifies tun0 interface, pings gateway - `docker-compose.yml` - Orchestrates server + client with shared volume - `.github/workflows/docker-test.yml` - CI matrix testing 18 OS variants - `.github/workflows/test.yml` - Removed push/PR triggers, now manual only for DO tests - `Makefile` - Local testing commands (`make test`, `make test-ubuntu-24.04`, etc.) **Distributions tested (18 total):** | Family | Versions | |--------|----------| | Ubuntu | 18.04, 20.04, 22.04, 24.04 | | Debian | 11, 12 | | Fedora | 40, 41 | | Rocky Linux | 8, 9 | | AlmaLinux | 8, 9 | | Oracle Linux | 8, 9 | | Amazon Linux | 2, 2023 | | CentOS Stream | 9 | | Arch Linux | latest |
167 lines
4.8 KiB
YAML
167 lines
4.8 KiB
YAML
---
|
|
on:
|
|
push:
|
|
workflow_dispatch:
|
|
|
|
name: Docker Test
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
docker-test:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os:
|
|
- name: ubuntu-18.04
|
|
image: ubuntu:18.04
|
|
- name: ubuntu-20.04
|
|
image: ubuntu:20.04
|
|
- name: ubuntu-22.04
|
|
image: ubuntu:22.04
|
|
- name: ubuntu-24.04
|
|
image: ubuntu:24.04
|
|
- name: debian-11
|
|
image: debian:11
|
|
- name: debian-12
|
|
image: debian:12
|
|
- name: centos-stream-9
|
|
image: quay.io/centos/centos:stream9
|
|
- name: fedora-40
|
|
image: fedora:40
|
|
- name: fedora-41
|
|
image: fedora:41
|
|
- name: rocky-8
|
|
image: rockylinux:8
|
|
- name: rocky-9
|
|
image: rockylinux:9
|
|
- name: almalinux-8
|
|
image: almalinux:8
|
|
- name: almalinux-9
|
|
image: almalinux:9
|
|
- name: archlinux
|
|
image: archlinux:latest
|
|
- name: oraclelinux-8
|
|
image: oraclelinux:8
|
|
- name: oraclelinux-9
|
|
image: oraclelinux:9
|
|
- name: amazonlinux-2
|
|
image: amazonlinux:2
|
|
- name: amazonlinux-2023
|
|
image: amazonlinux:2023
|
|
|
|
name: ${{ matrix.os.name }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build server image
|
|
run: |
|
|
docker build \
|
|
--build-arg BASE_IMAGE=${{ matrix.os.image }} \
|
|
-t openvpn-server \
|
|
-f test/Dockerfile.server .
|
|
|
|
- name: Build client image
|
|
run: docker build -t openvpn-client -f test/Dockerfile.client .
|
|
|
|
- name: Create Docker network
|
|
run: docker network create --subnet=172.28.0.0/24 vpn-test
|
|
|
|
- name: Create shared volume
|
|
run: docker volume create shared-config
|
|
|
|
- name: Start OpenVPN server
|
|
run: |
|
|
docker run -d \
|
|
--name openvpn-server \
|
|
--hostname openvpn-server \
|
|
--cap-add=NET_ADMIN \
|
|
--device=/dev/net/tun:/dev/net/tun \
|
|
--sysctl net.ipv4.ip_forward=1 \
|
|
--network vpn-test \
|
|
--ip 172.28.0.10 \
|
|
-v shared-config:/shared \
|
|
openvpn-server
|
|
|
|
- name: Wait for server installation and startup
|
|
run: |
|
|
echo "Waiting for OpenVPN server to install and start..."
|
|
for i in {1..60}; do
|
|
if docker exec openvpn-server pgrep openvpn > /dev/null 2>&1; then
|
|
echo "OpenVPN server is running!"
|
|
break
|
|
fi
|
|
echo "Waiting... ($i/60)"
|
|
sleep 5
|
|
# Show logs for debugging
|
|
docker logs --tail 20 openvpn-server 2>&1 || true
|
|
done
|
|
|
|
# Final check
|
|
if ! docker exec openvpn-server pgrep openvpn > /dev/null 2>&1; then
|
|
echo "ERROR: OpenVPN server failed to start"
|
|
docker logs openvpn-server
|
|
exit 1
|
|
fi
|
|
|
|
- name: Verify client config was generated
|
|
run: |
|
|
docker run --rm -v shared-config:/shared alpine \
|
|
ls -la /shared/
|
|
docker run --rm -v shared-config:/shared alpine \
|
|
cat /shared/client.ovpn
|
|
|
|
- name: Start OpenVPN client and run tests
|
|
run: |
|
|
docker run \
|
|
--name openvpn-client \
|
|
--hostname openvpn-client \
|
|
--cap-add=NET_ADMIN \
|
|
--device=/dev/net/tun:/dev/net/tun \
|
|
--network vpn-test \
|
|
--ip 172.28.0.20 \
|
|
-v shared-config:/shared:ro \
|
|
openvpn-client &
|
|
|
|
# Wait for tests to complete (look for success message)
|
|
for i in {1..60}; do
|
|
if docker logs openvpn-client 2>&1 | grep -q "ALL TESTS PASSED"
|
|
then
|
|
echo "Tests passed!"
|
|
exit 0
|
|
fi
|
|
if docker logs openvpn-client 2>&1 | grep -q "FAIL:"; then
|
|
echo "Tests failed!"
|
|
docker logs openvpn-client
|
|
exit 1
|
|
fi
|
|
echo "Waiting for tests... ($i/60)"
|
|
sleep 2
|
|
done
|
|
|
|
echo "Timeout waiting for tests"
|
|
docker logs openvpn-client
|
|
exit 1
|
|
|
|
- name: Show server logs
|
|
if: always()
|
|
run: docker logs openvpn-server 2>&1 || true
|
|
|
|
- name: Show client logs
|
|
if: always()
|
|
run: docker logs openvpn-client 2>&1 || true
|
|
|
|
- name: Cleanup
|
|
if: always()
|
|
run: |
|
|
docker stop openvpn-server openvpn-client 2>/dev/null || true
|
|
docker rm openvpn-server openvpn-client 2>/dev/null || true
|
|
docker network rm vpn-test 2>/dev/null || true
|
|
docker volume rm shared-config 2>/dev/null || true
|