Skip to content

tests: pr-build-extension workflow for PR check #1

tests: pr-build-extension workflow for PR check

tests: pr-build-extension workflow for PR check #1

Workflow file for this run

#
# Copyright (C) 2023 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
name: pr-check
on:
pull_request:
branches: [ 'main' ]
jobs:
build-extension:
name: Build OCI image
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set image env var
run: |
echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER}/podman-desktop-image-checker-openshift-ext:latest" >> $GITHUB_ENV
- name: Set up Podman
run: |
sudo apt-get update -y -qq
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/Release.key \
| gpg --dearmor \
| sudo tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg]\
https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/ /" \
| sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null
sudo apt-get update -qq
sudo apt-get -qq -y install containernetworking-plugins podman
- name: Build image with podman
shell: bash
run: |
podman build -t ${IMAGE} -f Containerfile .
podman save -m -o podman-desktop-image-checker-openshift-ext.tar ${IMAGE}
echo ${IMAGE} > podman-desktop-image-checker-openshift-ext.image
- name: Upload extension oci flatten images
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
with:
name: podman-desktop-image-checker-openshift-ext
path: podman-desktop-image-checker-openshift-ext*
push-extension:
name: Push OCI image to ghcr
if: github.event_name == 'push'
runs-on: ubuntu-22.04
needs: build-extension
permissions:
contents: read
packages: write
steps:
- name: Download extension oci flatten images
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
with:
name: podman-desktop-image-checker-openshift-ext
- name: Log in to ghcr.io
uses: redhat-actions/podman-login@4934294ad0449894bcd1e9f191899d7292469603 # v1.7
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push image for release
shell: bash
run: |
podman load -i podman-desktop-image-checker-openshift-ext.tar
podman push ghcr.io/${GITHUB_REPOSITORY_OWNER}/podman-desktop-image-checker-openshift-ext:latest
e2e-tests:
name: Run E2E Tests
runs-on: ubuntu-22.04
needs: push-extension
permissions:
contents: read
packages: read
actions: write
steps:
- name: Checkout the image checker repo
uses: actions/checkout@v4
with:
path: image-checker-extension
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install yarn
working-directory: image-checker-extension/podman-desktop-extension
run: yarn install --frozen-lockfile
- name: Checkout the podman-desktop repo
uses: actions/checkout@v4
with:
repository: podman-desktop/podman-desktop
ref: main
path: podman-desktop
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
package_json_file: ./podman-desktop/package.json
- name: Install pnpm deps and build Podman Desktop
working-directory: ./podman-desktop
run: |
pnpm install --frozen-lockfile
pnpm test:e2e:build
- name: Run E2E tests
working-directory: ./image-checker-extension/podman-desktop-extension
env:
PODMAN_DESKTOP_ARGS: ${{ github.workspace }}/podman-desktop
EXTENSION_PREINSTALLED: true
run: |
yarn test:e2e