Skip to content

Allow Windows to sleep #357

Allow Windows to sleep

Allow Windows to sleep #357

Workflow file for this run

name: E2E tests
on:
workflow_dispatch:
push:
branches: [main, dev, 'release/**', 'stable/**']
paths-ignore: ['*.md', 'LICENSE']
pull_request:
branches: [main, dev, 'release/**', 'stable/**']
paths-ignore: ['*.md', 'LICENSE']
concurrency:
group: e2e-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e:
runs-on: [self-hosted, Linux, X64]
timeout-minutes: 90
container:
image: ubuntu:24.04
options: --privileged
env:
DEBIAN_FRONTEND: noninteractive
CLIENT_BINARY: ${{ github.workspace }}/src-tauri/target/release/defguard-client
NATIVE_DRIVER: /usr/bin/WebKitWebDriver
SQLX_OFFLINE: '1'
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: 'true'
DEFGUARD_CLIENT_WELCOME_SKIP: '1'
# Fix for: repository path is not owned by current user.
VERGEN_GIT_SHA: 'e2e'
VERGEN_IDEMPOTENT: '1'
steps:
- name: Install system dependencies
run: |
apt-get update
apt-get install -y build-essential ca-certificates desktop-file-utils curl git \
iproute2 iputils-ping libayatana-appindicator3-dev libgtk-3-dev libprotobuf-dev \
librsvg2-dev libssl-dev libudev-dev libwebkit2gtk-4.1-dev libxdo-dev patchelf procps \
protobuf-compiler webkit2gtk-driver xvfb wireguard-tools xclip xdg-utils
- uses: actions/checkout@v7
with:
submodules: recursive
- uses: actions/setup-node@v7
with:
node-version-file: new-ui/.nvmrc
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
run_install: false
version: 11.11
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.11
- name: Install tauri-driver
run: cargo install tauri-driver --locked
- name: Install tauri-cli
run: cargo install tauri-cli --locked
- name: Build new-ui
run: pnpm install --no-frozen-lockfile && pnpm build
working-directory: new-ui
- name: Build client
run: cargo tauri build
- name: Prepare e2e environment
run: |
cp e2e/.env.example e2e/.env
echo "CORE_URL=${{ secrets.E2E_CORE_URL }}" >> e2e/.env
echo "PROXY_URL=${{ secrets.E2E_PROXY_URL }}" >> e2e/.env
echo "CORE_ADMIN_PASSWORD=${{ secrets.E2E_CORE_ADMIN_PASSWORD }}" >> e2e/.env
echo "NETWORK_ENDPOINT=${{ secrets.E2E_NETWORK_ENDPOINT }}" >> e2e/.env
- name: Check deployment is reachable
run: curl -sf --max-time 15 "${{ secrets.E2E_CORE_URL }}/api/v1/health"
- name: Stub resolvectl
run: |
printf '#!/bin/sh\ncat >/dev/null 2>&1 || true\nexit 0\n' > /usr/local/sbin/resolvectl
chmod +x /usr/local/sbin/resolvectl
- name: Start defguard-service
run: |
/usr/sbin/groupadd -f defguard
/usr/sbin/modprobe wireguard || true
setsid src-tauri/target/release/defguard-service < /dev/null &
for _ in $(seq 1 40); do [ -S /var/run/defguard.socket ] && break; sleep 0.5; done
test -S /var/run/defguard.socket
- name: Install e2e dependencies
run: pnpm install --no-frozen-lockfile
working-directory: e2e
- name: Provision core (network + gateway check)
run: pnpm provision
working-directory: e2e
- name: Run e2e tests
run: xvfb-run -a pnpm test
working-directory: e2e
- name: Collect logs
if: always()
run: |
mkdir -p e2e-logs/client
cp -r /var/log/defguard-service e2e-logs/service-logs || true
- name: Upload logs
if: always()
uses: actions/upload-artifact@v7
with:
name: e2e-logs
path: e2e-logs
if-no-files-found: warn
retention-days: 7
lint-e2e:
runs-on:
- codebuild-defguard-client-runner-${{ github.run_id }}-${{ github.run_attempt }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version-file: new-ui/.nvmrc
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
run_install: false
version: 11.11
- name: Install e2e dependencies
run: pnpm install --no-frozen-lockfile
working-directory: e2e
- name: Lint e2e
run: pnpm lint
working-directory: e2e