|
| 1 | +name: UI notebooks tests |
| 2 | + |
| 3 | +on: [pull_request] |
| 4 | + |
| 5 | +concurrency: |
| 6 | + group: ${{ github.head_ref }}-${{ github.workflow }} |
| 7 | + cancel-in-progress: true |
| 8 | + |
| 9 | +env: |
| 10 | + CODEFLARE_OPERATOR_IMG: "quay.io/project-codeflare/codeflare-operator:dev" |
| 11 | + |
| 12 | +jobs: |
| 13 | + verify-0_basic_ray: |
| 14 | + runs-on: ubuntu-20.04-4core |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout code |
| 18 | + uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + submodules: recursive |
| 21 | + |
| 22 | + - name: Checkout common repo code |
| 23 | + uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + repository: "project-codeflare/codeflare-common" |
| 26 | + ref: "main" |
| 27 | + path: "common" |
| 28 | + |
| 29 | + - name: Checkout CodeFlare operator repository |
| 30 | + uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + repository: project-codeflare/codeflare-operator |
| 33 | + path: codeflare-operator |
| 34 | + |
| 35 | + - name: Set Go |
| 36 | + uses: actions/setup-go@v5 |
| 37 | + with: |
| 38 | + go-version-file: "./codeflare-operator/go.mod" |
| 39 | + cache-dependency-path: "./codeflare-operator/go.sum" |
| 40 | + |
| 41 | + - name: Set up gotestfmt |
| 42 | + uses: gotesttools/gotestfmt-action@v2 |
| 43 | + with: |
| 44 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + |
| 46 | + - name: Set up specific Python version |
| 47 | + uses: actions/setup-python@v5 |
| 48 | + with: |
| 49 | + python-version: "3.9" |
| 50 | + cache: "pip" # caching pip dependencies |
| 51 | + |
| 52 | + - name: Setup and start KinD cluster |
| 53 | + uses: ./common/github-actions/kind |
| 54 | + |
| 55 | + - name: Deploy CodeFlare stack |
| 56 | + id: deploy |
| 57 | + run: | |
| 58 | + cd codeflare-operator |
| 59 | + echo Setting up CodeFlare stack |
| 60 | + make setup-e2e |
| 61 | + echo Deploying CodeFlare operator |
| 62 | + make deploy -e IMG="${CODEFLARE_OPERATOR_IMG}" -e ENV="e2e" |
| 63 | + kubectl wait --timeout=120s --for=condition=Available=true deployment -n openshift-operators codeflare-operator-manager |
| 64 | + cd .. |
| 65 | +
|
| 66 | + - name: Setup Guided notebooks execution |
| 67 | + run: | |
| 68 | + echo "Installing papermill and dependencies..." |
| 69 | + pip install poetry ipython ipykernel jupyterlab |
| 70 | + poetry config virtualenvs.create false |
| 71 | + echo "Installing SDK..." |
| 72 | + poetry install --with test,docs |
| 73 | +
|
| 74 | + - name: Install Yarn dependencies |
| 75 | + run: | |
| 76 | + poetry run yarn install |
| 77 | + poetry run yarn playwright install chromium |
| 78 | + working-directory: ui-tests |
| 79 | + |
| 80 | + - name: Run UI notebook tests |
| 81 | + run: | |
| 82 | + set -euo pipefail |
| 83 | +
|
| 84 | + # Remove login/logout cells, as KinD doesn't support authentication using token |
| 85 | + jq -r 'del(.cells[] | select(.source[] | contains("Create authentication object for user permissions")))' 0_basic_ray.ipynb > 0_basic_ray.ipynb.tmp && mv 0_basic_ray.ipynb.tmp 0_basic_ray.ipynb |
| 86 | + jq -r 'del(.cells[] | select(.source[] | contains("auth.logout()")))' 0_basic_ray.ipynb > 0_basic_ray.ipynb.tmp && mv 0_basic_ray.ipynb.tmp 0_basic_ray.ipynb |
| 87 | + # Set explicit namespace as SDK need it (currently) to resolve local queues |
| 88 | + sed -i "s/head_memory=2,/head_memory=2, namespace='default',/" 0_basic_ray.ipynb |
| 89 | +
|
| 90 | + poetry run yarn test |
| 91 | + working-directory: ui-tests |
| 92 | + |
| 93 | + - name: Print CodeFlare operator logs |
| 94 | + if: always() && steps.deploy.outcome == 'success' |
| 95 | + run: | |
| 96 | + echo "Printing CodeFlare operator logs" |
| 97 | + kubectl logs -n openshift-operators --tail -1 -l app.kubernetes.io/name=codeflare-operator | tee ${CODEFLARE_TEST_OUTPUT_DIR}/codeflare-operator.log |
| 98 | +
|
| 99 | + - name: Print KubeRay operator logs |
| 100 | + if: always() && steps.deploy.outcome == 'success' |
| 101 | + run: | |
| 102 | + echo "Printing KubeRay operator logs" |
| 103 | + kubectl logs -n ray-system --tail -1 -l app.kubernetes.io/name=kuberay | tee ${CODEFLARE_TEST_OUTPUT_DIR}/kuberay.log |
| 104 | +
|
| 105 | + - name: Upload Playwright Test assets |
| 106 | + if: always() |
| 107 | + uses: actions/upload-artifact@v4 |
| 108 | + with: |
| 109 | + name: ipywidgets-test-assets |
| 110 | + path: | |
| 111 | + ui-tests/test-results |
| 112 | +
|
| 113 | + - name: Upload Playwright Test report |
| 114 | + if: always() |
| 115 | + uses: actions/upload-artifact@v4 |
| 116 | + with: |
| 117 | + name: ipywidgets-test-report |
| 118 | + path: | |
| 119 | + ui-tests/playwright-report |
0 commit comments