From 400ad184cf749699db2f775d1088873f07d410b3 Mon Sep 17 00:00:00 2001 From: Daniel Villanueva Date: Fri, 10 Jan 2025 11:11:40 +0100 Subject: [PATCH] test(e2e): crc-extension e2e tests runner for mac Signed-off-by: Daniel Villanueva --- .github/workflows/e2e-main.yml | 61 ++++++++++++++++++++++++++++----- .github/workflows/pr-check.yaml | 42 ++++++++++++++++++----- 2 files changed, 87 insertions(+), 16 deletions(-) diff --git a/.github/workflows/e2e-main.yml b/.github/workflows/e2e-main.yml index 05854d5..910a039 100644 --- a/.github/workflows/e2e-main.yml +++ b/.github/workflows/e2e-main.yml @@ -45,7 +45,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-2022, ubuntu-24.04] #, macos-14 + os: [windows-2022, ubuntu-24.04, macos-14] runs-on: ${{ matrix.os }} env: SKIP_INSTALLATION: true @@ -64,7 +64,7 @@ jobs: # Checkout sso extension - uses: actions/checkout@v4 - if: matrix.os == 'windows-2022' + if: matrix.os == 'windows-2022' || matrix.os == 'macos-14' with: repository: redhat-developer/podman-desktop-redhat-account-ext ref: main @@ -85,7 +85,7 @@ jobs: run: pnpm install - name: Install SSO extension dependencies - if: matrix.os == 'windows-2022' + if: matrix.os == 'windows-2022' || matrix.os == 'macos-14' working-directory: ./sso-extension run: pnpm install @@ -93,8 +93,8 @@ jobs: working-directory: ./podman-desktop run: pnpm test:e2e:build - - name: Ensure getting current HEAD version of the test framework (ubuntu) - if: matrix.os == 'ubuntu-24.04' + - name: Ensure getting current HEAD version of the test framework (Ubuntu/MacOS) + if: matrix.os == 'ubuntu-24.04' || matrix.os == 'macos-14' working-directory: ./crc-extension run: | # workaround for https://github.com/containers/podman-desktop-extension-bootc/issues/712 @@ -103,6 +103,25 @@ jobs: jq --arg version "$version" '.devDependencies."@podman-desktop/tests-playwright" = $version' package.json > package.json_tmp && mv package.json_tmp package.json shell: bash + - name: Ensure getting current HEAD version of the test framework (Windows) + if: matrix.os == 'windows-2022' + working-directory: ./crc-extension + run: | + # workaround for https://github.com/containers/podman-desktop-extension-bootc/issues/712 + # Install scoop installer + Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') + scoop --version + # Install jq using scoop + scoop install jq + # Fetch the version of the npm package + $version = npm view @podman-desktop/tests-playwright@next version + Write-Host "Version of @podman-desktop/tests-playwright to be used: $version" + # Update package.json using jq + jq --arg version "$version" '.devDependencies."@podman-desktop/tests-playwright" = $version' package.json > package.json_tmp + # Replace the old package.json with the updated one + Move-Item -Path package.json_tmp -Destination package.json -Force + shell: pwsh + - name: Install CRC extension dependencies working-directory: ./crc-extension run: yarn install --check-files @@ -137,8 +156,22 @@ jobs: mv tests/playwright/output/crc-tests-pd/plugins/extension/ tests/playwright/output/crc-tests-pd/plugins/crcextension tar -xf /tmp/sso_extension.tar -C tests/playwright/output/crc-tests-pd/plugins/ mv tests/playwright/output/crc-tests-pd/plugins/extension/ tests/playwright/output/crc-tests-pd/plugins/ssoextension - - - name: Build OpenShift Local extension locally (Windows, docker) #from container file is not available yet + + - name: Build OpenShift Local extension locally (MacOS) #from container file is not available yet + if: matrix.os == 'macos-14' + shell: bash + working-directory: ./crc-extension + run: | + # -- following https://github.com/crc-org/crc-extension/blob/main/oci/Containerfile.multistage -- + # build extension + yarn build + # make expected test folders + mkdir -p tests/playwright/output/crc-tests-pd/plugins/crcextension + mkdir -p tests/playwright/output/crc-tests-pd/plugins/ssoextension + # move necessary files there + cp -R package.json LICENSE icon.png README.md dist tests/playwright/output/crc-tests-pd/plugins/crcextension + + - name: Build OpenShift Local extension locally (Windows) #from container file is not available yet if: matrix.os == 'windows-2022' working-directory: ./crc-extension shell: pwsh @@ -153,7 +186,19 @@ jobs: # move necessary files there 'package.json', 'LICENSE', 'icon.png', 'README.md', 'dist' | % { cp $_ ./tests/playwright/output/crc-tests-pd/plugins/crcextension -Recurse -Force} - - name: Build SSO extension (crc dependency) locally (Windows, docker) #from container file is not available yet + - name: Build SSO extension (crc dependency) locally (MacOS) #from container file is not available yet + if: matrix.os == 'macos-14' + working-directory: ./sso-extension + shell: bash + run: | + # -- following https://github.com/redhat-developer/podman-desktop-redhat-account-ext/blob/main/Containerfile -- + # build extension + pnpm build + # put the contents into its expected folder: + mkdir -p ../crc-extension/tests/playwright/output/crc-tests-pd/plugins/ssoextension + cp -R ./builtin/redhat-authentication.cdix/* ../crc-extension/tests/playwright/output/crc-tests-pd/plugins/ssoextension + + - name: Build SSO extension (crc dependency) locally (Windows) #from container file is not available yet if: matrix.os == 'windows-2022' working-directory: ./sso-extension shell: pwsh diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index c410709..b4e2112 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -124,7 +124,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-2022, ubuntu-24.04] #, macos-14 + os: [windows-2022, ubuntu-24.04, macos-14] runs-on: ${{ matrix.os }} env: SKIP_INSTALLATION: true @@ -143,7 +143,7 @@ jobs: # Checkout sso extension - uses: actions/checkout@v4 - if: matrix.os == 'windows-2022' + if: matrix.os == 'windows-2022' || matrix.os == 'macos-14' with: repository: redhat-developer/podman-desktop-redhat-account-ext ref: main @@ -164,7 +164,7 @@ jobs: run: pnpm install - name: Install SSO extension dependencies - if: matrix.os == 'windows-2022' + if: matrix.os == 'windows-2022' || matrix.os == 'macos-14' working-directory: ./sso-extension run: pnpm install @@ -172,8 +172,8 @@ jobs: working-directory: ./podman-desktop run: pnpm test:e2e:build - - name: Ensure getting current HEAD version of the test framework (ubuntu) - if: matrix.os == 'ubuntu-24.04' + - name: Ensure getting current HEAD version of the test framework (Ubuntu/MacOS) + if: matrix.os == 'ubuntu-24.04' || matrix.os == 'macos-14' working-directory: ./crc-extension run: | # workaround for https://github.com/containers/podman-desktop-extension-bootc/issues/712 @@ -235,8 +235,22 @@ jobs: mv tests/playwright/output/crc-tests-pd/plugins/extension/ tests/playwright/output/crc-tests-pd/plugins/crcextension tar -xf /tmp/sso_extension.tar -C tests/playwright/output/crc-tests-pd/plugins/ mv tests/playwright/output/crc-tests-pd/plugins/extension/ tests/playwright/output/crc-tests-pd/plugins/ssoextension - - - name: Build OpenShift Local extension locally (Windows, docker) #from container file is not available yet + + - name: Build OpenShift Local extension locally (MacOS) #from container file is not available yet + if: matrix.os == 'macos-14' + shell: bash + working-directory: ./crc-extension + run: | + # -- following https://github.com/crc-org/crc-extension/blob/main/oci/Containerfile.multistage -- + # build extension + yarn build + # make expected test folders + mkdir -p tests/playwright/output/crc-tests-pd/plugins/crcextension + mkdir -p tests/playwright/output/crc-tests-pd/plugins/ssoextension + # move necessary files there + cp -R package.json LICENSE icon.png README.md dist tests/playwright/output/crc-tests-pd/plugins/crcextension + + - name: Build OpenShift Local extension locally (Windows) #from container file is not available yet if: matrix.os == 'windows-2022' working-directory: ./crc-extension shell: pwsh @@ -251,7 +265,19 @@ jobs: # move necessary files there 'package.json', 'LICENSE', 'icon.png', 'README.md', 'dist' | % { cp $_ ./tests/playwright/output/crc-tests-pd/plugins/crcextension -Recurse -Force} - - name: Build SSO extension (crc dependency) locally (Windows, docker) #from container file is not available yet + - name: Build SSO extension (crc dependency) locally (MacOS) #from container file is not available yet + if: matrix.os == 'macos-14' + working-directory: ./sso-extension + shell: bash + run: | + # -- following https://github.com/redhat-developer/podman-desktop-redhat-account-ext/blob/main/Containerfile -- + # build extension + pnpm build + # put the contents into its expected folder: + mkdir -p ../crc-extension/tests/playwright/output/crc-tests-pd/plugins/ssoextension + cp -R ./builtin/redhat-authentication.cdix/* ../crc-extension/tests/playwright/output/crc-tests-pd/plugins/ssoextension + + - name: Build SSO extension (crc dependency) locally (Windows) #from container file is not available yet if: matrix.os == 'windows-2022' working-directory: ./sso-extension shell: pwsh