Skip to content

Commit 0932f23

Browse files
committed
workflows
Signed-off-by: Rostislav Lán <[email protected]>
1 parent d28ad6c commit 0932f23

File tree

4 files changed

+227
-10
lines changed

4 files changed

+227
-10
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
19+
name: build-extension
20+
21+
on:
22+
pull_request:
23+
branches: [ 'main' ]
24+
push:
25+
branches: [ 'main' ]
26+
27+
jobs:
28+
build-extension:
29+
name: Build OCI image
30+
runs-on: ubuntu-24.04
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
35+
- name: Set image env var
36+
id: set-image
37+
run: echo "IMAGE=ghcr.io/${{ github.repository_owner }}/podman-desktop-image-checker-openshift-ext:pr-${{ github.event.pull_request.number }}" >> "$GITHUB_ENV"
38+
39+
- name: Build image with podman
40+
shell: bash
41+
run: |
42+
echo "Building image ${IMAGE} with podman"
43+
podman build -t "${IMAGE}" -f Containerfile .
44+
podman save -m -o podman-desktop-image-checker-openshift-ext.tar "${IMAGE}"
45+
echo "${IMAGE}" > podman-desktop-image-checker-openshift-ext.image
46+
47+
- name: Upload extension oci flatten images
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: podman-desktop-image-checker-openshift-ext
51+
path: podman-desktop-image-checker-openshift-ext*

.github/workflows/pr-check.yaml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
#
2+
# Copyright (C) 2023 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: pr-check
19+
20+
on:
21+
workflow_run:
22+
workflows:
23+
- build-extension
24+
types:
25+
- completed
26+
27+
jobs:
28+
push-extension:
29+
name: Push OCI image to ghcr
30+
runs-on: ubuntu-24.04
31+
if: |
32+
github.event.workflow_run.conclusion == 'success'
33+
steps:
34+
- name: Download extension oci flatten images
35+
uses: actions/download-artifact@v4
36+
with:
37+
name: podman-desktop-image-checker-openshift-ext
38+
github-token: ${{ secrets.GITHUB_TOKEN }}
39+
run-id: ${{ github.event.workflow_run.id }}
40+
41+
- name: Read image name
42+
id: read-image
43+
run: |
44+
echo "IMAGE=$(cat podman-desktop-image-checker-openshift-ext.image)" >> "$GITHUB_ENV"
45+
46+
- name: Log in to ghcr.io
47+
uses: redhat-actions/[email protected]
48+
with:
49+
registry: ghcr.io
50+
username: ${{ github.actor }}
51+
password: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: Push image for release
54+
shell: bash
55+
run: |
56+
podman load -i podman-desktop-image-checker-openshift-ext.tar
57+
podman push "$IMAGE"
58+
59+
e2e-tests:
60+
name: Run E2E Tests
61+
runs-on: ubuntu-24.04
62+
needs: push-extension
63+
steps:
64+
- name: Checkout the image checker repo
65+
uses: actions/checkout@v4
66+
with:
67+
path: image-checker
68+
69+
- name: Set up Node.js
70+
uses: actions/setup-node@v4
71+
with:
72+
node-version: 22
73+
74+
- name: Get Latest Podman Desktop testing prerelease
75+
env:
76+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
run: |
78+
tag=$(curl --request GET \
79+
-H "Accept: application/vnd.github+json" \
80+
-H "Authorization: Bearer ${{ env.GH_TOKEN }}" \
81+
-H "X-GitHub-Api-Version: 2022-11-28" \
82+
"https://api.github.com/repos/podman-desktop/testing-prereleases/tags?pages=1" | jq -r '.[0].name')
83+
echo "Tag: $tag"
84+
echo "PD_TAG=${tag}" >> $GITHUB_ENV
85+
# releases id
86+
id=$(curl --request GET \
87+
-H "Accept: application/vnd.github+json" \
88+
-H "Authorization: Bearer ${{ env.GH_TOKEN }}" \
89+
-H "X-GitHub-Api-Version: 2022-11-28" \
90+
"https://api.github.com/repos/podman-desktop/testing-prereleases/releases/tags/$tag" | jq -r '.id')
91+
echo "Release ID: $id"
92+
# list assets with tag.gz suffix
93+
url=$(curl --request GET \
94+
-H "Accept: application/vnd.github+json" \
95+
-H "Authorization: Bearer ${{ env.GH_TOKEN }}" \
96+
-H "X-GitHub-Api-Version: 2022-11-28" \
97+
"https://api.github.com/repos/podman-desktop/testing-prereleases/releases/$id/assets" | jq -r '.[] | select (.name | test("tar.gz$"))' | jq -r '.browser_download_url')
98+
echo "Podman Desktop testing prerelease url: ${url}"
99+
curl -L -o podman-desktop.tar.gz "${url}"
100+
mkdir -p podman-desktop
101+
tar -xzf podman-desktop.tar.gz -C podman-desktop --strip-components=1
102+
chmod +x podman-desktop/podman-desktop
103+
echo "PODMAN_DESKTOP_BINARY=${GITHUB_WORKSPACE}/podman-desktop/podman-desktop" >> $GITHUB_ENV
104+
105+
- name: Ensure getting current HEAD version of the test framework
106+
working-directory: image-checker/podman-desktop-extension
107+
run: |
108+
# workaround for https://github.com/containers/podman-desktop-extension-bootc/issues/712
109+
version=$(npm view @podman-desktop/tests-playwright@next version)
110+
echo "Version of @podman-desktop/tests-playwright to be used: $version"
111+
jq --arg version "$version" '.devDependencies."@podman-desktop/tests-playwright" = $version' package.json > package.json_tmp && mv package.json_tmp package.json
112+
113+
- name: Install yarn
114+
working-directory: image-checker/podman-desktop-extension
115+
run: |
116+
yarn install --no-frozen-lockfile
117+
118+
- name: Revert unprivileged user namespace restrictions in Ubuntu 24.04
119+
run: |
120+
# allow unprivileged user namespace
121+
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
122+
123+
- name: Run e2e tests
124+
working-directory: image-checker/podman-desktop-extension
125+
env:
126+
EXTENSION_PREINSTALLED: true
127+
run: |
128+
yarn test:e2e
129+
130+
- name: Publish Test Report
131+
uses: mikepenz/action-junit-report@v5
132+
if: always()
133+
with:
134+
annotate_only: true
135+
fail_on_failure: true
136+
include_passed: true
137+
detailed_summary: true
138+
require_tests: true
139+
report_paths: '**/*results.xml'
140+
141+
- uses: actions/upload-artifact@v4
142+
if: always()
143+
with:
144+
name: pr-check
145+
path: |
146+
./**/tests/**/output/
147+
!./**/*.gguf
148+
!./**/*.bin
149+
!./**/tests/**/videos/*
150+
!./**/tests/**/traces/*
151+
152+
- name: Upload test videos
153+
uses: actions/upload-artifact@v4
154+
if: always()
155+
with:
156+
name: pr-check-videos
157+
path: ./**/tests/playwright/output/videos/*
158+
159+
- name: Upload test traces
160+
uses: actions/upload-artifact@v4
161+
if: always()
162+
with:
163+
name: pr-check-traces
164+
path: ./**/tests/playwright/output/traces/*

podman-desktop-extension/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@
2323
"watch": "tsc -w"
2424
},
2525
"devDependencies": {
26-
"@playwright/test": "^1.50.0",
26+
"@playwright/test": "^1.52.0",
2727
"@podman-desktop/api": "^1.6.3",
2828
"@podman-desktop/tests-playwright": "next",
2929
"@types/node": "^18",
3030
"cross-env": "^7.0.3",
31-
"electron": "^34.0.1",
3231
"mkdirp": "^3.0.1",
3332
"typescript": "5.3.3",
3433
"vite": "^5.0.9",

podman-desktop-extension/tests/src/image-checker.spec.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const extensionLabel = 'redhat.openshift-checker';
3434
const extensionLabelName = 'openshift-checker';
3535
const activeExtensionStatus = 'ACTIVE';
3636
const disabledExtensionStatus = 'DISABLED';
37-
const imageToCheck = 'docker.io/library/httpd';
37+
const imageToCheck = 'ghcr.io/linuxcontainers/alpine';
3838
const isLinux = process.platform === 'linux';
3939
const providerName = 'Red Hat OpenShift Checker';
4040
const extensionName = 'Red Hat OpenShift Checker extension';
@@ -51,7 +51,9 @@ test.beforeAll(async ({ runner, page, welcomePage }) => {
5151
test.afterAll(async ({ runner, page }) => {
5252
test.setTimeout(60000);
5353
try {
54-
deleteImage(page, imageToCheck);
54+
//deleteImage(page, imageToCheck);
55+
// TODO: testing image should be removed after the tests
56+
// for some reason this fails
5557
} finally {
5658
await runner.close();
5759
}
@@ -67,7 +69,7 @@ test.describe.serial('Red Hat Image Checker extension installation', () => {
6769

6870
test('Remove old version of the extension', async ({ navigationBar }) => {
6971
test.skip(!extensionInstalled);
70-
await removeExtension(navigationBar);
72+
await disableAndRemoveExtension(navigationBar);
7173
});
7274

7375
test('Extension can be installed from an OCI image', async ({ navigationBar }) => {
@@ -111,7 +113,7 @@ test.describe.serial('Red Hat Image Checker extension functionality', () => {
111113

112114
const pullImagePage = await imagesPage.openPullImage();
113115
await playExpect(pullImagePage.heading).toBeVisible();
114-
imagesPage = await pullImagePage.pullImage(imageToCheck);
116+
await pullImagePage.pullImage(imageToCheck);
115117
const imageDetailsPage = await getImageDetailsPage(navigationBar);
116118
await playExpect(imageDetailsPage.imageCheckerTab).toBeVisible();
117119

@@ -145,7 +147,7 @@ test.describe.serial('Red Hat Image Checker extension functionality', () => {
145147
await playExpect(imageDetailsPage.imageCheckerTabContent).toBeVisible();
146148

147149
// wait for the analysis to be complete
148-
const analysisStatus = await imageDetailsPage.getAnalysisStatus();
150+
const analysisStatus = imageDetailsPage.analysisStatus;
149151
await playExpect(analysisStatus).toBeVisible();
150152
await playExpect
151153
.poll(async () => await analysisStatus.innerText(), { timeout: 60000 })
@@ -202,14 +204,15 @@ test.describe.serial('Red Hat Image Checker extension handling', () => {
202204
});
203205

204206
test('Extension can be removed', async ({ navigationBar }) => {
205-
await removeExtension(navigationBar);
207+
await disableAndRemoveExtension(navigationBar);
206208
});
207209
});
208210

209-
async function removeExtension(navigationBar: NavigationBar): Promise<void> {
211+
async function disableAndRemoveExtension(navigationBar: NavigationBar): Promise<void> {
210212
const extensions = await navigationBar.openExtensions();
211213
const extensionCard = await extensions.getInstalledExtension(extensionLabelName, extensionLabel);
212-
await extensionCard.disableExtension();
214+
playExpect(extensionCard.status).toHaveText(activeExtensionStatus);
215+
playExpect(extensionCard.removeButton).toBeVisible();
213216
await extensionCard.removeExtension();
214217
await playExpect
215218
.poll(async () => await extensions.extensionIsInstalled(extensionLabel), { timeout: 15000 })

0 commit comments

Comments
 (0)