|
| 1 | +name: Run e2e RHTAS Console CI tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + artifact: |
| 7 | + description: | |
| 8 | + The name of the component being tested, ie server etc. |
| 9 | + Must correspond to an artifact storing the custom built image, named <artifact>, |
| 10 | + and should contain the file <artifact>.tar inside. |
| 11 | + required: false |
| 12 | + type: string |
| 13 | + ui_image: |
| 14 | + description: image uri for the ui (ie. ghcr.io/<namespace>/<image-name>:<tag>) |
| 15 | + type: string |
| 16 | + required: false |
| 17 | + default: "" |
| 18 | + server_image: |
| 19 | + description: image uri for the server (ie. ghcr.io/<namespace>/<image-name>:<tag>) |
| 20 | + type: string |
| 21 | + required: false |
| 22 | + default: "" |
| 23 | + server_db_image: |
| 24 | + description: image uri for server-postgres (ie. ghcr.io/<namespace>/<image-name>:<tag>) |
| 25 | + type: string |
| 26 | + required: false |
| 27 | + default: "" |
| 28 | + workflow_dispatch: |
| 29 | + inputs: |
| 30 | + artifact: |
| 31 | + description: | |
| 32 | + The name of the component being tested, ie server etc. |
| 33 | + Must correspond to an artifact storing the custom built image, named <artifact>, |
| 34 | + and should contain the file <artifact>.tar inside. |
| 35 | + required: false |
| 36 | + type: string |
| 37 | + ui_image: |
| 38 | + description: image uri for the ui (ie. ghcr.io/<namespace>/<image-name>:<tag>) |
| 39 | + type: string |
| 40 | + required: false |
| 41 | + default: "" |
| 42 | + server_image: |
| 43 | + description: image uri for the server (ie. ghcr.io/<namespace>/<image-name>:<tag>) |
| 44 | + type: string |
| 45 | + required: false |
| 46 | + default: "" |
| 47 | + server_db_image: |
| 48 | + description: image uri for server-postgres (ie. ghcr.io/<namespace>/<image-name>:<tag>) |
| 49 | + type: string |
| 50 | + required: false |
| 51 | + default: "" |
| 52 | + |
| 53 | +jobs: |
| 54 | + check-images: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + steps: |
| 57 | + - name: Download artifact |
| 58 | + if: "${{ inputs.artifact != '' }}" |
| 59 | + uses: actions/download-artifact@v5 |
| 60 | + with: |
| 61 | + name: ${{ inputs.artifact }} |
| 62 | + path: /tmp |
| 63 | + - name: Load images |
| 64 | + if: ${{ inputs.artifact != '' }} |
| 65 | + run: | |
| 66 | + docker load --input /tmp/${{ inputs.artifact }}.tar |
| 67 | + - name: Check ui image exists |
| 68 | + if: ${{ inputs.ui_image != '' }} |
| 69 | + run: | |
| 70 | + if docker image inspect ${{ inputs.ui_image }} >/dev/null 2>&1; then |
| 71 | + echo "Image exists locally" |
| 72 | + docker image inspect ${{ inputs.ui_image }} |
| 73 | + else |
| 74 | + echo "Image does not exist locally" |
| 75 | + docker manifest inspect ${{ inputs.ui_image }} |
| 76 | + fi |
| 77 | + - name: Check server image exists |
| 78 | + if: ${{ inputs.server_image != '' }} |
| 79 | + run: | |
| 80 | + if docker image inspect ${{ inputs.server_image }} >/dev/null 2>&1; then |
| 81 | + echo "Image exists locally" |
| 82 | + docker image inspect ${{ inputs.server_image }} |
| 83 | + else |
| 84 | + echo "Image does not exist locally" |
| 85 | + docker manifest inspect ${{ inputs.server_image }} |
| 86 | + fi |
| 87 | + - name: Check server_db_image image exists |
| 88 | + if: ${{ inputs.server_db_image != '' }} |
| 89 | + run: | |
| 90 | + if docker image inspect ${{ inputs.server_db_image }} >/dev/null 2>&1; then |
| 91 | + echo "Image exists locally" |
| 92 | + docker image inspect ${{ inputs.server_db_image }} |
| 93 | + else |
| 94 | + echo "Image does not exist locally" |
| 95 | + docker manifest inspect ${{ inputs.server_db_image }} |
| 96 | + fi |
| 97 | +
|
| 98 | + e2e-integration-tests: |
| 99 | + needs: check-images |
| 100 | + runs-on: ubuntu-latest |
| 101 | + steps: |
| 102 | + - name: Download artifact |
| 103 | + if: "${{ inputs.artifact != '' }}" |
| 104 | + uses: actions/download-artifact@v5 |
| 105 | + with: |
| 106 | + name: ${{ inputs.artifact }} |
| 107 | + path: /tmp |
| 108 | + - name: Load images |
| 109 | + if: ${{ inputs.artifact != '' }} |
| 110 | + run: | |
| 111 | + docker load --input /tmp/${{ inputs.artifact }}.tar |
| 112 | +
|
| 113 | + - name: Checkout ui repo |
| 114 | + uses: actions/checkout@v5 |
| 115 | + - uses: actions/setup-node@v4 |
| 116 | + with: |
| 117 | + node-version: 22 |
| 118 | + cache: "npm" |
| 119 | + - name: Install dependencies |
| 120 | + run: npm ci --verbose --ignore-scripts --no-audit |
| 121 | + |
| 122 | + - name: Start rhtas-console |
| 123 | + uses: ./.github/actions/start-console |
| 124 | + with: |
| 125 | + ui_image: ${{ inputs.ui_image }} |
| 126 | + server_image: ${{ inputs.server_image }} |
| 127 | + server_db_image: ${{ inputs.server_db_image }} |
| 128 | + |
| 129 | + - name: Run Playwright tests |
| 130 | + run: | |
| 131 | + PW_TEST_CONNECT_WS_ENDPOINT=ws://localhost:5000/ CONSOLE_UI_URL=http://localhost:8088 AUTH_REQUIRED=false npm run -w e2e test |
| 132 | +
|
| 133 | + - name: Upload Playwright artifacts |
| 134 | + if: failure() # only upload if tests failed |
| 135 | + uses: actions/upload-artifact@v4 |
| 136 | + with: |
| 137 | + name: playwright-artifacts |
| 138 | + path: | |
| 139 | + e2e/test-results |
| 140 | + e2e/playwright-report |
0 commit comments