|
| 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/* |
0 commit comments