2026-03-30 23:32:01 -05:00
|
|
|
name: Dev
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
push:
|
|
|
|
|
branches:
|
|
|
|
|
- dev
|
|
|
|
|
|
|
|
|
|
jobs:
|
2026-03-31 14:48:27 -05:00
|
|
|
test:
|
|
|
|
|
runs-on: docker
|
|
|
|
|
container:
|
|
|
|
|
image: python:3.13-slim
|
|
|
|
|
services:
|
|
|
|
|
postgres:
|
|
|
|
|
image: postgres:17
|
|
|
|
|
env:
|
|
|
|
|
POSTGRES_USER: wiregui
|
|
|
|
|
POSTGRES_PASSWORD: wiregui
|
|
|
|
|
POSTGRES_DB: wiregui
|
|
|
|
|
options: >-
|
|
|
|
|
--health-cmd "pg_isready -U wiregui"
|
|
|
|
|
--health-interval 5s
|
|
|
|
|
--health-timeout 5s
|
|
|
|
|
--health-retries 5
|
|
|
|
|
valkey:
|
|
|
|
|
image: valkey/valkey:8
|
|
|
|
|
options: >-
|
|
|
|
|
--health-cmd "valkey-cli ping"
|
|
|
|
|
--health-interval 5s
|
|
|
|
|
--health-timeout 5s
|
|
|
|
|
--health-retries 5
|
|
|
|
|
mock-oidc:
|
|
|
|
|
image: ghcr.io/navikt/mock-oauth2-server:2.1.10
|
|
|
|
|
env:
|
|
|
|
|
SERVER_PORT: "9000"
|
|
|
|
|
JSON_CONFIG: '{"interactiveLogin":true,"httpServer":"NettyWrapper","tokenCallbacks":[{"issuerId":"test-idp","tokenExpiry":3600,"requestMappings":[{"requestParam":"scope","match":"*","claims":{"sub":"$${claim:sub}","email":"$${claim:sub}@test.local","name":"Test User"}}]}]}'
|
feat: comprehensive test suite + SAML auth fixes + mock SAML IdP
Tests (198 unit + 70 e2e = 268 total):
- Add test_api_deps.py: Bearer token auth, get_current_api_user, require_admin
- Add test_wireguard_extended.py: ensure_interface, set_private_key, set_listen_port
- Add test_firewall_extended.py: _nft/_nft_batch errors, jump rules, policies
- Add test_mfa_login.py: MFA redirect, TOTP verify, invalid code, cancel
- Add test_magic_link_page.py: page render, submit, empty email, back to login
- Add test_admin_devices.py: list, filter, create, edit, delete, config dialog
- Add test_admin_rules.py: list, create, edit, delete (all DB-verified)
- Add test_admin_settings.py: defaults, security, OIDC/SAML providers
- Add test_saml_login.py: button visible, redirect, metadata, full login flow
Bug fixes:
- Fix SAML callback to use /auth/complete bridge (same fix as OIDC)
- Fix missing get_settings import in admin settings page
- Add SAML provider buttons to login page
- Make SAML strict mode configurable per-provider
Infrastructure:
- Add mock SimpleSAMLphp IdP to compose.yml with SP config
- Add mock-saml service to CI workflows (release + dev)
2026-03-31 16:52:29 -05:00
|
|
|
mock-saml:
|
|
|
|
|
image: kenchan0130/simplesamlphp
|
|
|
|
|
env:
|
|
|
|
|
SIMPLESAMLPHP_SP_ENTITY_ID: http://localhost:13003/auth/saml/test-saml/metadata
|
|
|
|
|
SIMPLESAMLPHP_SP_ASSERTION_CONSUMER_SERVICE: http://localhost:13003/auth/saml/test-saml/callback
|
|
|
|
|
SIMPLESAMLPHP_IDP_BASE_URL: http://mock-saml:8080/simplesaml/
|
2026-03-31 14:48:27 -05:00
|
|
|
env:
|
|
|
|
|
CI: "true"
|
|
|
|
|
WG_DATABASE_URL: postgresql+asyncpg://wiregui:wiregui@postgres/wiregui
|
|
|
|
|
WG_REDIS_URL: redis://valkey:6379/0
|
|
|
|
|
MOCK_OIDC_HOST: mock-oidc
|
feat: comprehensive test suite + SAML auth fixes + mock SAML IdP
Tests (198 unit + 70 e2e = 268 total):
- Add test_api_deps.py: Bearer token auth, get_current_api_user, require_admin
- Add test_wireguard_extended.py: ensure_interface, set_private_key, set_listen_port
- Add test_firewall_extended.py: _nft/_nft_batch errors, jump rules, policies
- Add test_mfa_login.py: MFA redirect, TOTP verify, invalid code, cancel
- Add test_magic_link_page.py: page render, submit, empty email, back to login
- Add test_admin_devices.py: list, filter, create, edit, delete, config dialog
- Add test_admin_rules.py: list, create, edit, delete (all DB-verified)
- Add test_admin_settings.py: defaults, security, OIDC/SAML providers
- Add test_saml_login.py: button visible, redirect, metadata, full login flow
Bug fixes:
- Fix SAML callback to use /auth/complete bridge (same fix as OIDC)
- Fix missing get_settings import in admin settings page
- Add SAML provider buttons to login page
- Make SAML strict mode configurable per-provider
Infrastructure:
- Add mock SimpleSAMLphp IdP to compose.yml with SP config
- Add mock-saml service to CI workflows (release + dev)
2026-03-31 16:52:29 -05:00
|
|
|
MOCK_SAML_HOST: mock-saml
|
2026-03-31 14:48:27 -05:00
|
|
|
steps:
|
|
|
|
|
- name: Install system dependencies and checkout
|
|
|
|
|
run: |
|
|
|
|
|
apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
|
git wireguard-tools pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl
|
2026-03-31 15:21:44 -05:00
|
|
|
git clone --depth=1 -b "${GITHUB_REF_NAME}" ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git .
|
2026-03-31 14:48:27 -05:00
|
|
|
|
|
|
|
|
- name: Install uv
|
|
|
|
|
run: pip install uv
|
|
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
|
run: uv sync
|
|
|
|
|
|
|
|
|
|
- name: Install Playwright browsers
|
|
|
|
|
run: uv run playwright install --with-deps chromium
|
|
|
|
|
|
2026-03-31 17:02:49 -05:00
|
|
|
- name: Run migrations
|
|
|
|
|
run: uv run alembic upgrade head
|
|
|
|
|
|
2026-03-31 14:48:27 -05:00
|
|
|
- name: Run unit tests
|
2026-03-31 18:30:15 -05:00
|
|
|
run: uv run pytest tests/ --ignore=tests/e2e --ignore=tests/integration -v --tb=short
|
2026-03-31 14:48:27 -05:00
|
|
|
|
|
|
|
|
- name: Run E2E tests
|
2026-03-31 17:02:49 -05:00
|
|
|
run: uv run pytest tests/e2e/ -v --tb=short
|
2026-03-31 14:48:27 -05:00
|
|
|
|
2026-03-30 23:32:01 -05:00
|
|
|
docker:
|
2026-03-31 14:48:27 -05:00
|
|
|
needs: test
|
2026-03-30 23:32:01 -05:00
|
|
|
runs-on: docker
|
|
|
|
|
container:
|
|
|
|
|
image: catthehacker/ubuntu:act-latest
|
|
|
|
|
options: --privileged
|
|
|
|
|
steps:
|
|
|
|
|
- name: Checkout repository
|
|
|
|
|
run: |
|
|
|
|
|
git clone ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git -b dev .
|
|
|
|
|
git fetch origin main --tags
|
|
|
|
|
|
|
|
|
|
- name: Build and push pre-release image
|
|
|
|
|
shell: bash
|
|
|
|
|
env:
|
|
|
|
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
|
run: |
|
|
|
|
|
# Derive version from latest tag on main: v1.2.3 -> 1.2.3.dev0, .dev1, etc.
|
|
|
|
|
LATEST_TAG=$(git describe --tags --abbrev=0 origin/main 2>/dev/null || echo "v0.0.0")
|
|
|
|
|
BASE_VERSION="${LATEST_TAG#v}"
|
|
|
|
|
# Count commits on dev since that tag
|
|
|
|
|
DEV_N=$(git rev-list --count "${LATEST_TAG}..HEAD" 2>/dev/null || echo "0")
|
|
|
|
|
VERSION="${BASE_VERSION}.dev${DEV_N}"
|
|
|
|
|
|
|
|
|
|
REGISTRY=$(echo "${{ github.server_url }}" | sed 's|https://||; s|http://||')
|
|
|
|
|
IMAGE="${REGISTRY}/${{ github.repository_owner }}/wiregui"
|
|
|
|
|
|
|
|
|
|
echo "Building ${IMAGE}:v${VERSION}"
|
|
|
|
|
|
|
|
|
|
echo "${REGISTRY_TOKEN}" | docker login "${REGISTRY}" \
|
|
|
|
|
-u "${{ github.repository_owner }}" --password-stdin
|
|
|
|
|
|
2026-03-30 23:35:44 -05:00
|
|
|
docker build --no-cache \
|
2026-03-30 23:32:01 -05:00
|
|
|
--build-arg "VERSION=${VERSION}" \
|
|
|
|
|
-t "${IMAGE}:v${VERSION}" \
|
|
|
|
|
-t "${IMAGE}:dev" \
|
|
|
|
|
.
|
|
|
|
|
|
|
|
|
|
docker push "${IMAGE}:v${VERSION}"
|
|
|
|
|
docker push "${IMAGE}:dev"
|
|
|
|
|
|
2026-03-31 14:48:27 -05:00
|
|
|
echo "Pushed ${IMAGE}:v${VERSION}, ${IMAGE}:dev"
|