Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Tests"

on:
push:
branches:
- master
pull_request:

jobs:
validate:
name: Validation
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Docker (for compose validation)
run: docker compose version

- name: Run test suite
run: bash tests/run_tests.sh
15 changes: 15 additions & 0 deletions tests/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -e

echo "======================================"
echo " Starting Full-Stack Automated Tests"
echo "======================================"

cd "$(dirname "$0")/.."

bash tests/test_scripts.sh
bash tests/test_compose.sh

echo "======================================"
echo " 🎉 All tests passed successfully!"
echo "======================================"
46 changes: 46 additions & 0 deletions tests/test_compose.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash
set -e

echo "Running docker-compose validation tests..."
ERRORS=0

# Mock env vars needed for compose config
export DOMAIN=example.com
export AUTHENTIK_DOMAIN=auth.example.com
export AUTHENTIK_POSTGRES_PASSWORD=mock
export AUTHENTIK_REDIS_PASSWORD=mock
export AUTHENTIK_SECRET_KEY=mock
export GRAFANA_ADMIN_PASSWORD=mock
export GRAFANA_OAUTH_CLIENT_ID=mock
export GRAFANA_OAUTH_CLIENT_SECRET=mock
export CF_DNS_API_TOKEN=mock
export CF_ZONE_API_TOKEN=mock
export CF_ZONE_ID=mock
export ACME_EMAIL=test@example.com

# Base infrastructure
if ! docker compose -f docker-compose.base.yml config -q; then
echo "❌ Validation failed for docker-compose.base.yml"
ERRORS=$((ERRORS+1))
else
echo "✅ Validation passed for docker-compose.base.yml"
fi

# All stacks
for stack in stacks/*; do
if [ -d "$stack" ] && [ -f "$stack/docker-compose.yml" ]; then
if ! docker compose -f "$stack/docker-compose.yml" config -q >/dev/null 2>&1; then
echo "❌ Validation failed for $stack/docker-compose.yml"
ERRORS=$((ERRORS+1))
else
echo "✅ Validation passed for $stack/docker-compose.yml"
fi
fi
done

if [ $ERRORS -gt 0 ]; then
echo "Failed compose tests: $ERRORS"
exit 1
fi

echo "All compose files are valid!"
23 changes: 23 additions & 0 deletions tests/test_scripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -e

echo "Running shell script validation tests..."
ERRORS=0

for script in install.sh scripts/*.sh; do
if [ -f "$script" ]; then
if ! bash -n "$script"; then
echo "❌ Syntax error in $script"
ERRORS=$((ERRORS+1))
else
echo "✅ Syntax check passed for $script"
fi
fi
done

if [ $ERRORS -gt 0 ]; then
echo "Failed script tests: $ERRORS"
exit 1
fi

echo "All shell scripts are valid!"