aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml15
-rw-r--r--test/linuxserver/docker-compose.override.yml4
-rw-r--r--test/linuxserver/docker-compose.yml46
-rwxr-xr-xtest/linuxserver/test.sh43
4 files changed, 105 insertions, 3 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 3f229d2..47df797 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -6,9 +6,9 @@ on:
workflow_dispatch:
jobs:
- test:
+ test_host:
runs-on: ubuntu-latest
- name: Test
+ name: Test (host)
steps:
- name: Checkout
uses: actions/checkout@v3
@@ -17,8 +17,17 @@ jobs:
- name: Test
run: sudo ./test/host/test.sh
+ test_linuxserver:
+ runs-on: ubuntu-latest
+ name: Test (LinuxServer)
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ - name: Test
+ run: sudo ./test/linuxserver/test.sh
+
publish:
- needs: [test]
+ needs: [test_host, test_linuxserver]
runs-on: ubuntu-latest
name: 'Publish'
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
diff --git a/test/linuxserver/docker-compose.override.yml b/test/linuxserver/docker-compose.override.yml
new file mode 100644
index 0000000..c20f3ad
--- /dev/null
+++ b/test/linuxserver/docker-compose.override.yml
@@ -0,0 +1,4 @@
+# This file is here for the same reason as the root docker-compose.override.yml.
+services:
+ web:
+ build: ../..
diff --git a/test/linuxserver/docker-compose.yml b/test/linuxserver/docker-compose.yml
new file mode 100644
index 0000000..88acc36
--- /dev/null
+++ b/test/linuxserver/docker-compose.yml
@@ -0,0 +1,46 @@
+version: '3'
+
+services:
+ wg:
+ image: lscr.io/linuxserver/wireguard:latest
+ restart: unless-stopped
+ environment:
+ - SERVERURL=wireguard.domain.com
+ - SERVERPORT=51820
+ - PEERS=1
+ - INTERNAL_SUBNET=10.13.13.0
+ - LOG_CONFS=true
+ networks:
+ - wg_web_api_network
+ ports:
+ - 51820:51820/udp
+ - '192.168.177.1:1234:1234'
+ #volumes:
+ # - ./config:/config
+ cap_add:
+ - NET_ADMIN
+ - SYS_MODULE
+ web:
+ image: egortensin/wg-api-web:1
+ depends_on: [api]
+ restart: unless-stopped
+ ports:
+ - '8090:80'
+ #volumes:
+ # - './data:/data:ro'
+ api:
+ image: james/wg-api:latest
+ command: wg-api --device wg0 --listen 0.0.0.0:1234
+ depends_on: [wg]
+ restart: unless-stopped
+ network_mode: service:wg
+ cap_add:
+ - NET_ADMIN
+
+networks:
+ wg_web_api_network:
+ driver: bridge
+ ipam:
+ driver: default
+ config:
+ - subnet: 192.168.177.0/24
diff --git a/test/linuxserver/test.sh b/test/linuxserver/test.sh
new file mode 100755
index 0000000..d043ce1
--- /dev/null
+++ b/test/linuxserver/test.sh
@@ -0,0 +1,43 @@
+#!/usr/bin/env bash
+
+set -o errexit -o nounset -o pipefail
+shopt -s inherit_errexit lastpipe
+
+script_dir="$( dirname -- "${BASH_SOURCE[0]}" )"
+script_dir="$( cd -- "$script_dir" && pwd )"
+readonly script_dir
+
+build_services() {
+ echo ------------------------------------------------------------------
+ echo Pull third-party images
+ echo ------------------------------------------------------------------
+ docker-compose pull wg api
+
+ echo ------------------------------------------------------------------
+ echo Build wg-api-web
+ echo ------------------------------------------------------------------
+ docker-compose build --force-rm --progress plain --pull web
+
+ echo ------------------------------------------------------------------
+ echo docker-compose up
+ echo ------------------------------------------------------------------
+ docker-compose up -d
+}
+
+cleanup() {
+ echo ------------------------------------------------------------------
+ echo Cleaning up
+ echo ------------------------------------------------------------------
+ docker-compose down -v --remove-orphans
+}
+
+main() {
+ cd -- "$script_dir"
+ trap cleanup EXIT
+
+ build_services
+ sleep 3
+ "$script_dir/../check_web.sh"
+}
+
+main