Repository navigation
154 lines (128 loc) · 5.09 KB
/
Copy pathe2e.yaml
File metadata and controls
154 lines (128 loc) · 5.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: E2E tests
on:
workflow_dispatch:
push:
branches: [main, dev, 'release/**', 'stable/**']
paths-ignore: ['*.md', 'LICENSE']
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches: [main, dev, 'release/**', 'stable/**']
paths-ignore: ['*.md', 'LICENSE']
concurrency:
group: e2e-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e:
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
runs-on: [self-hosted, Linux, X64]
concurrency:
group: desktop-e2e
queue: max
timeout-minutes: 90
container:
image: ubuntu:24.04@sha256:68ee22004a9109b44973313b02ff7b1de250f1de0f5ecb628d73f579aaff33ac
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 dbus 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
submodules: recursive
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version-file: new-ui/.nvmrc
- name: Install pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
with:
run_install: false
version: 11.28
- name: Install Rust stable
uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
- name: Install sccache
uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # 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: dbus-run-session -- 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@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version-file: new-ui/.nvmrc
- name: Install pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
with:
run_install: false
version: 11.28
- name: Install e2e dependencies
run: pnpm install --no-frozen-lockfile
working-directory: e2e
- name: Lint e2e
run: pnpm lint
working-directory: e2e