From 00b6c898a9e65ac2d58c0cba09e7a303c7e0f15f Mon Sep 17 00:00:00 2001 From: Tibor Dancs Date: Tue, 17 Sep 2024 17:50:52 +0200 Subject: [PATCH] chore(ci): adding e2e test on ubuntu runner into prcheck (#1727) * chore(ci): adding e2e test on ubuntu runner into prcheck Signed-off-by: Tibor Dancs * chore(ci): pr-review fixes Signed-off-by: Tibor Dancs --------- Signed-off-by: Tibor Dancs --- .github/workflows/e2e-main.yaml | 1 - .github/workflows/pr-check.yaml | 79 +++++++++++++++++++ package.json | 1 + tests/playwright/package.json | 3 +- tests/playwright/src/ai-lab-extension.spec.ts | 2 +- 5 files changed, 83 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e-main.yaml b/.github/workflows/e2e-main.yaml index 09c0a47bb..f30580459 100644 --- a/.github/workflows/e2e-main.yaml +++ b/.github/workflows/e2e-main.yaml @@ -120,7 +120,6 @@ jobs: working-directory: ./podman-desktop-extension-ai-lab env: PODMAN_DESKTOP_ARGS: ${{ github.workspace }}/podman-desktop - AI_LAB_CI_RUN: true run: pnpm test:e2e - uses: actions/upload-artifact@v4 diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index b775c89d1..a7cc68119 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -67,3 +67,82 @@ jobs: echo "Found changes in git" exit 1 fi + + e2e-pr-check: + name: e2e tests smoke + runs-on: ubuntu-24.04 + env: + SKIP_INSTALLATION: true + steps: + - uses: actions/checkout@v4 + with: + path: podman-desktop-extension-ai-lab + # Set up pnpm + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + run_install: false + package_json_file: ./podman-desktop-extension-ai-lab/package.json + # Install Node.js + - uses: actions/setup-node@v4 + with: + node-version: 20 + # Checkout podman desktop + - uses: actions/checkout@v4 + with: + repository: containers/podman-desktop + ref: main + path: podman-desktop + + - name: Update podman + run: | + # ubuntu version from kubic repository to install podman we need (v5) + ubuntu_version='23.04' + sudo sh -c "echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list" + curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key" | sudo apt-key add - + # install necessary dependencies for criu package which is not part of 23.04 + sudo apt-get install -qq libprotobuf32t64 python3-protobuf libnet1 + # install criu manually from static location + curl -sLO http://cz.archive.ubuntu.com/ubuntu/pool/universe/c/criu/criu_3.16.1-2_amd64.deb && sudo dpkg -i criu_3.16.1-2_amd64.deb + sudo apt-get update -qq + sudo apt-get -qq -y install podman || { echo "Start fallback steps for podman nightly installation from a static mirror" && \ + sudo sh -c "echo 'deb http://ftp.lysator.liu.se/pub/opensuse/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list" && \ + curl -L "http://ftp.lysator.liu.se/pub/opensuse/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key" | sudo apt-key add - && \ + sudo apt-get update && \ + sudo apt-get -y install podman; } + podman version + + - name: Revert unprivileged user namespace restrictions in Ubuntu 24.04 + run: | + # allow unprivileged user namespace + sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 + + - name: Install pnpm deps and build Podman Desktop + working-directory: ./podman-desktop + run: | + pnpm install --frozen-lockfile + pnpm test:e2e:build + + - name: Ensure getting current HEAD version of the test framework + working-directory: ./podman-desktop-extension-ai-lab/tests/playwright + run: | + # workaround for https://github.com/containers/podman-desktop-extension-bootc/issues/712 + version=$(npm view @podman-desktop/tests-playwright@next version) + echo "Version of @podman-desktop/tests-playwright to be used: $version" + jq --arg version "$version" '.devDependencies."@podman-desktop/tests-playwright" = $version' package.json > package.json_tmp && mv package.json_tmp package.json + + - name: Execute pnpm in AI Lab Extension + working-directory: ./podman-desktop-extension-ai-lab + run: pnpm install --no-frozen-lockfile + + - name: Run E2E Smoke tests + working-directory: ./podman-desktop-extension-ai-lab + env: + PODMAN_DESKTOP_ARGS: ${{ github.workspace }}/podman-desktop + run: pnpm test:e2e:smoke + + - uses: actions/upload-artifact@v4 + if: always() + with: + name: e2e-pr-check + path: ./**/tests/**/output/ diff --git a/package.json b/package.json index 4b0407910..7ddbf9e7f 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "test:shared": "vitest run -r packages/shared --passWithNoTests --coverage", "test:unit": "npm run test:backend && npm run test:shared && npm run test:frontend", "test:e2e": "cd tests/playwright && npm run test:e2e", + "test:e2e:smoke": "cd tests/playwright && npm run test:e2e:smoke", "typecheck:shared": "tsc --noEmit --project packages/shared", "typecheck:frontend": "tsc --noEmit --project packages/frontend", "typecheck:backend": "cd packages/backend && npm run typecheck", diff --git a/tests/playwright/package.json b/tests/playwright/package.json index a39ac8644..80e14439e 100644 --- a/tests/playwright/package.json +++ b/tests/playwright/package.json @@ -4,7 +4,8 @@ "description": "Podman Desktop AI Lab extension Playwright E2E tests", "scripts": { "test:e2e:setup": "xvfb-maybe --auto-servernum --server-args='-screen 0 1280x960x24' --", - "test:e2e": "npm run test:e2e:setup playwright test src/" + "test:e2e": "npm run test:e2e:setup playwright test src/", + "test:e2e:smoke": "npm run test:e2e:setup playwright test src/ --grep @smoke" }, "author": "Red Hat", "license": "Apache-2.0", diff --git a/tests/playwright/src/ai-lab-extension.spec.ts b/tests/playwright/src/ai-lab-extension.spec.ts index f55c4cb52..40baecd29 100644 --- a/tests/playwright/src/ai-lab-extension.spec.ts +++ b/tests/playwright/src/ai-lab-extension.spec.ts @@ -54,7 +54,7 @@ test.afterAll(async ({ runner }) => { await runner.close(); }); -test.describe.serial(`AI Lab extension installation and verification`, () => { +test.describe.serial(`AI Lab extension installation and verification`, { tag: '@smoke' }, () => { test.describe.serial(`AI Lab extension installation`, () => { test(`Open Settings -> Extensions page`, async () => { dashboardPage = await navigationBar.openDashboard();