|
| 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 | + #pull_request: |
| 22 | + #branches: [ 'main' ] |
| 23 | + push: |
| 24 | + branches: [ 'main' ] |
| 25 | + |
| 26 | +jobs: |
| 27 | + build-extension: |
| 28 | + name: Build OCI image |
| 29 | + runs-on: ubuntu-22.04 |
| 30 | + steps: |
| 31 | + - name: Checkout repository |
| 32 | + uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - name: Set image env var |
| 35 | + run: | |
| 36 | + echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER}/podman-desktop-image-checker-openshift-ext:latest" >> $GITHUB_ENV |
| 37 | + |
| 38 | + - name: Set up Podman |
| 39 | + run: | |
| 40 | + sudo apt-get update -y -qq |
| 41 | + sudo mkdir -p /etc/apt/keyrings |
| 42 | + curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/Release.key \ |
| 43 | + | gpg --dearmor \ |
| 44 | + | sudo tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null |
| 45 | + echo \ |
| 46 | + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg]\ |
| 47 | + https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/ /" \ |
| 48 | + | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null |
| 49 | + sudo apt-get update -qq |
| 50 | + sudo apt-get -qq -y install containernetworking-plugins podman |
| 51 | +
|
| 52 | + - name: Build image with podman |
| 53 | + shell: bash |
| 54 | + run: | |
| 55 | + podman build -t ${IMAGE} -f Containerfile . |
| 56 | + podman save -m -o podman-desktop-image-checker-openshift-ext.tar ${IMAGE} |
| 57 | + echo ${IMAGE} > podman-desktop-image-checker-openshift-ext.image |
| 58 | +
|
| 59 | + - name: Upload extension oci flatten images |
| 60 | + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 |
| 61 | + with: |
| 62 | + name: podman-desktop-image-checker-openshift-ext |
| 63 | + path: podman-desktop-image-checker-openshift-ext* |
| 64 | + |
| 65 | + push-extension: |
| 66 | + name: Push OCI image to ghcr |
| 67 | + if: github.event_name == 'push' |
| 68 | + runs-on: ubuntu-22.04 |
| 69 | + needs: build-extension |
| 70 | + permissions: |
| 71 | + contents: read |
| 72 | + packages: write |
| 73 | + steps: |
| 74 | + - name: Download extension oci flatten images |
| 75 | + uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 |
| 76 | + with: |
| 77 | + name: podman-desktop-image-checker-openshift-ext |
| 78 | + |
| 79 | + - name: Log in to ghcr.io |
| 80 | + uses: redhat-actions/podman-login@4934294ad0449894bcd1e9f191899d7292469603 # v1.7 |
| 81 | + with: |
| 82 | + registry: ghcr.io |
| 83 | + username: ${{ github.actor }} |
| 84 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 85 | + |
| 86 | + - name: Push image for release |
| 87 | + shell: bash |
| 88 | + run: | |
| 89 | + podman load -i podman-desktop-image-checker-openshift-ext.tar |
| 90 | + podman push ghcr.io/${GITHUB_REPOSITORY_OWNER}/podman-desktop-image-checker-openshift-ext:latest |
| 91 | + |
| 92 | + e2e-tests: |
| 93 | + name: Run E2E Tests |
| 94 | + runs-on: ubuntu-22.04 |
| 95 | + needs: push-extension |
| 96 | + permissions: |
| 97 | + contents: read |
| 98 | + packages: read |
| 99 | + actions: write |
| 100 | + steps: |
| 101 | + - name: Checkout the image checker repo |
| 102 | + uses: actions/checkout@v4 |
| 103 | + with: |
| 104 | + path: image-checker-extension |
| 105 | + |
| 106 | + - name: Set up Node.js |
| 107 | + uses: actions/setup-node@v4 |
| 108 | + with: |
| 109 | + node-version: 22 |
| 110 | + |
| 111 | + - name: Install yarn |
| 112 | + working-directory: image-checker-extension/podman-desktop-extension |
| 113 | + run: yarn install --frozen-lockfile |
| 114 | + |
| 115 | + - name: Checkout the podman-desktop repo |
| 116 | + uses: actions/checkout@v4 |
| 117 | + with: |
| 118 | + repository: podman-desktop/podman-desktop |
| 119 | + ref: main |
| 120 | + path: podman-desktop |
| 121 | + |
| 122 | + - name: Install pnpm |
| 123 | + uses: pnpm/action-setup@v4 |
| 124 | + with: |
| 125 | + run_install: false |
| 126 | + package_json_file: ./podman-desktop/package.json |
| 127 | + |
| 128 | + - name: Install pnpm deps and build Podman Desktop |
| 129 | + working-directory: ./podman-desktop |
| 130 | + run: | |
| 131 | + pnpm install --frozen-lockfile |
| 132 | + pnpm test:e2e:build |
| 133 | +
|
| 134 | + - name: Run E2E tests |
| 135 | + working-directory: ./image-checker-extension/podman-desktop-extension |
| 136 | + env: |
| 137 | + PODMAN_DESKTOP_ARGS: ${{ github.workspace }}/podman-desktop |
| 138 | + EXTENSION_PREINSTALLED: true |
| 139 | + run: | |
| 140 | + yarn test:e2e |
0 commit comments