Skip to content

Commit 519c050

Browse files
authored
chore(ci): add workflow to run e2e tests after merge in main (#264)
Signed-off-by: Ondrej Dockal <odockal@redhat.com>
1 parent 2a9d730 commit 519c050

1 file changed

Lines changed: 194 additions & 0 deletions

File tree

.github/workflows/e2e-main.yaml

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
#
2+
# Copyright (C) 2025 Red Hat, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# SPDX-License-Identifier: Apache-2.0
17+
18+
name: e2e-tests-main
19+
20+
on:
21+
workflow_run:
22+
workflows: ["main-build"]
23+
types:
24+
- completed
25+
workflow_dispatch:
26+
inputs:
27+
organization:
28+
default: 'redhat-developer'
29+
description: 'Organization of the Red Hat RHEL VM extension repository'
30+
type: string
31+
required: true
32+
repositoryName:
33+
default: 'podman-desktop-rhel-ext'
34+
description: 'Podman Desktop RedHat RHEL VM extension repository name'
35+
type: string
36+
required: true
37+
branch:
38+
default: 'main'
39+
description: 'Red Hat RHEL VM Extension repo branch'
40+
type: string
41+
required: true
42+
mode:
43+
description: 'Build mode for Podman Desktop'
44+
type: choice
45+
options:
46+
- production
47+
- development
48+
49+
jobs:
50+
e2e-tests:
51+
name: Red Hat RHEL VM Extension E2E tests
52+
runs-on: ubuntu-24.04
53+
env:
54+
MODE: ${{ inputs.mode || 'production' }}
55+
REPO: ${{ inputs.repositoryName || 'podman-desktop-rhel-ext' }}
56+
ORGANIZATION: ${{ inputs.organization || 'redhat-developer' }}
57+
BRANCH: ${{ inputs.branch || 'main' }}
58+
steps:
59+
- uses: actions/checkout@v5
60+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_run'
61+
with:
62+
repository: ${{ env.ORGANIZATION }}/${{ env.REPO }}
63+
ref: ${{ env.BRANCH }}
64+
path: ${{ env.REPO }}
65+
66+
- uses: actions/checkout@v5
67+
if: github.event_name == 'push'
68+
with:
69+
path: podman-desktop-rhel-ext
70+
71+
- name: Setup default repository name
72+
env:
73+
EVENT: ${{ github.event_name }}
74+
run: |
75+
repository=podman-desktop-rhel-ext
76+
if [[ "$EVENT" == 'workflow_dispatch' || "$EVENT" == 'workflow_run' ]]; then
77+
repository=${{ env.REPO }}
78+
fi
79+
echo "REPOSITORY=$repository" >> $GITHUB_ENV
80+
81+
# Checkout podman desktop
82+
- uses: actions/checkout@v5
83+
with:
84+
repository: podman-desktop/podman-desktop
85+
ref: main
86+
path: podman-desktop
87+
88+
- uses: pnpm/action-setup@v4
89+
name: Install pnpm
90+
with:
91+
run_install: false
92+
package_json_file: ./podman-desktop/package.json
93+
94+
- uses: actions/setup-node@v5
95+
with:
96+
node-version: 22
97+
98+
- name: Update podman v5.x
99+
uses: redhat-actions/podman-install@16601a3a718acf7d6986140459092a2f5b941a03
100+
101+
- name: Set default browser desktop app and handlers
102+
run: |
103+
xdg-settings set default-web-browser firefox.desktop
104+
xdg-mime default firefox.desktop x-scheme-handler/https
105+
xdg-mime default firefox.desktop x-scheme-handler/http
106+
xvfb-run xdg-open 'https://developers.redhat.com/articles/faqs-no-cost-red-hat-enterprise-linux#general' & sleep 5; pkill Xvfb
107+
108+
# Install dbus-x11 package to allow dbus session for user for particular display (xvfb-maybe used in e2e test)
109+
# for reference, similar issue: https://github.com/actions/runner-images/issues/12127
110+
- name: Install dbus-x11 package
111+
run: sudo apt-get install dbus-x11
112+
113+
# we might consider replacing with podman-desktop/e2e/.github/actions/pde2e-testenv-prepare@13e2c57c759137bfc1f437f221967461e8a98e2a
114+
# for now we do not need all three steps
115+
- name: Revert unprivileged user namespace restrictions in Ubuntu 24.04
116+
run: |
117+
# allow unprivileged user namespace
118+
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
119+
120+
- name: Set Chromium policy for Podman Desktop app redirection from browser
121+
run: |
122+
echo '{"URLAllowlist": ["podman-desktop:*"]}' > url_allow_list.json
123+
sudo mkdir -p /etc/chromium/policies/managed
124+
sudo cp url_allow_list.json /etc/chromium/policies/managed/url_allow_list.json
125+
126+
- name: Build Podman Desktop for E2E tests Development Mode
127+
working-directory: ./podman-desktop
128+
if: ${{ env.MODE == 'development' }}
129+
run: |
130+
pnpm install
131+
pnpm test:e2e:build
132+
133+
- name: Build Podman Desktop for E2E tests Production Mode
134+
working-directory: ./podman-desktop
135+
if: ${{ env.MODE == 'production' }}
136+
env:
137+
ELECTRON_ENABLE_INSPECT: true
138+
run: |
139+
pnpm install --frozen-lockfile
140+
pnpm compile:current --linux dir
141+
path=$(realpath ./dist/linux-unpacked/podman-desktop)
142+
echo "Podman Desktop built binary: $path"
143+
echo "PODMAN_DESKTOP_BINARY_PATH=$path" >> $GITHUB_ENV
144+
145+
- name: Execute pnpm in Red Hat RHEL VM Extension
146+
working-directory: ${{ env.REPOSITORY }}
147+
run: |
148+
# workaround for https://github.com/containers/podman-desktop-extension-bootc/issues/712
149+
version=$(npm view @podman-desktop/tests-playwright@next version)
150+
echo "Version of @podman-desktop/tests-playwright to be used: $version"
151+
jq --arg version "$version" '.devDependencies."@podman-desktop/tests-playwright" = $version' package.json > package.json_tmp && mv package.json_tmp package.json
152+
pnpm install --no-frozen-lockfile
153+
154+
- name: Run All E2E tests in Red Hat RHEL VM Extension in Development Mode
155+
working-directory: ${{ env.REPOSITORY }}
156+
if: ${{ env.MODE == 'development' }}
157+
env:
158+
PODMAN_DESKTOP_ARGS: ${{ github.workspace }}/podman-desktop
159+
DVLPR_USERNAME: ${{ secrets.DVLPR_USERNAME }}
160+
DVLPR_PASSWORD: ${{ secrets.DVLPR_PASSWORD }}
161+
AUTH_E2E_TESTS: true
162+
run: |
163+
export $(dbus-launch)
164+
pnpm test:e2e
165+
166+
- name: Run All E2E tests in Red Hat RHEL VM Extension in Production mode
167+
working-directory: ${{ env.REPOSITORY }}
168+
if: ${{ env.MODE == 'production' }}
169+
env:
170+
PODMAN_DESKTOP_BINARY: ${{ env.PODMAN_DESKTOP_BINARY_PATH }}
171+
DVLPR_USERNAME: ${{ secrets.DVLPR_USERNAME }}
172+
DVLPR_PASSWORD: ${{ secrets.DVLPR_PASSWORD }}
173+
AUTH_E2E_TESTS: true
174+
run: |
175+
export $(dbus-launch)
176+
pnpm test:e2e
177+
178+
- name: Publish Test Report
179+
uses: mikepenz/action-junit-report@v5
180+
if: always() # always run even if the previous step fails
181+
with:
182+
fail_on_failure: true
183+
include_passed: true
184+
annotate_only: true
185+
detailed_summary: true
186+
require_tests: true
187+
report_paths: '**/*results.xml'
188+
189+
- name: Upload test artifacts
190+
uses: actions/upload-artifact@v4
191+
if: always()
192+
with:
193+
name: e2e-tests
194+
path: ./**/tests/**/output/

0 commit comments

Comments
 (0)