|
| 1 | +name: VWA Frontend Tests |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + paths: |
| 5 | + - components/crud-web-apps/volumes/frontend/** |
| 6 | + - releasing/version/VERSION |
| 7 | + branches: |
| 8 | + - main |
| 9 | + - notebooks-v1 |
| 10 | + |
| 11 | +jobs: |
| 12 | + frontend-format-lint-check: |
| 13 | + name: Check code format and lint |
| 14 | + runs-on: ubuntu-22.04 |
| 15 | + steps: |
| 16 | + - name: Check out code |
| 17 | + uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Setup Node |
| 20 | + uses: actions/setup-node@v4 |
| 21 | + with: |
| 22 | + node-version: 16 |
| 23 | + |
| 24 | + - name: Check frontend code formatting |
| 25 | + run: | |
| 26 | + cd components/crud-web-apps/volumes/frontend |
| 27 | + npm i |
| 28 | + npm run format:check |
| 29 | +
|
| 30 | + - name: Check frontend code linting |
| 31 | + run: | |
| 32 | + cd components/crud-web-apps/volumes/frontend |
| 33 | + npm i |
| 34 | + npm run lint-check |
| 35 | +
|
| 36 | + frontend-unit-tests: |
| 37 | + runs-on: ubuntu-22.04 |
| 38 | + name: Unit tests |
| 39 | + steps: |
| 40 | + - name: Checkout |
| 41 | + uses: actions/checkout@v4 |
| 42 | + |
| 43 | + - name: Setup node version to 16 |
| 44 | + uses: actions/setup-node@v4 |
| 45 | + with: |
| 46 | + node-version: 16 |
| 47 | + |
| 48 | + - name: Install Kubeflow common library dependecies |
| 49 | + run: | |
| 50 | + cd components/crud-web-apps/common/frontend/kubeflow-common-lib |
| 51 | + npm i |
| 52 | + npm run build |
| 53 | + npm link ./dist/kubeflow |
| 54 | +
|
| 55 | + - name: Install VWA dependencies |
| 56 | + run: | |
| 57 | + cd components/crud-web-apps/volumes/frontend |
| 58 | + npm i |
| 59 | + npm link kubeflow |
| 60 | +
|
| 61 | + - name: Run unit tests |
| 62 | + run: | |
| 63 | + cd components/crud-web-apps/volumes/frontend |
| 64 | + npm run test:prod |
| 65 | +
|
| 66 | + run-tests-in-chrome: |
| 67 | + name: UI tests in chrome |
| 68 | + runs-on: ubuntu-22.04 |
| 69 | + steps: |
| 70 | + - name: Checkout |
| 71 | + uses: actions/checkout@v4 |
| 72 | + |
| 73 | + - name: Setup node version to 16 |
| 74 | + uses: actions/setup-node@v4 |
| 75 | + with: |
| 76 | + node-version: 16 |
| 77 | + |
| 78 | + - name: Install Kubeflow common library dependecies |
| 79 | + run: | |
| 80 | + cd components/crud-web-apps/common/frontend/kubeflow-common-lib |
| 81 | + npm i |
| 82 | + npm run build |
| 83 | + npm link ./dist/kubeflow |
| 84 | +
|
| 85 | + - name: Install VWA dependencies |
| 86 | + run: | |
| 87 | + cd components/crud-web-apps/volumes/frontend |
| 88 | + npm i |
| 89 | + npm link kubeflow |
| 90 | +
|
| 91 | + - name: Serve UI & run Cypress tests in Chrome |
| 92 | + uses: cypress-io/github-action@v6 |
| 93 | + with: |
| 94 | + working-directory: components/crud-web-apps/volumes/frontend |
| 95 | + start: npm run serve |
| 96 | + install: false |
| 97 | + browser: chrome |
| 98 | + wait-on: "http://localhost:4200" |
| 99 | + record: false |
| 100 | + |
| 101 | + run-tests-in-firefox: |
| 102 | + name: UI tests in firefox |
| 103 | + runs-on: ubuntu-22.04 |
| 104 | + steps: |
| 105 | + - name: Checkout |
| 106 | + uses: actions/checkout@v4 |
| 107 | + |
| 108 | + - name: Setup node version to 16 |
| 109 | + uses: actions/setup-node@v4 |
| 110 | + with: |
| 111 | + node-version: 16 |
| 112 | + |
| 113 | + - name: Install Firefox dependencies |
| 114 | + run: | |
| 115 | + sudo apt-get update |
| 116 | + # Install Firefox from snap (more reliable for CI) |
| 117 | + sudo snap install firefox --classic |
| 118 | + # Install xvfb for headless mode |
| 119 | + sudo apt-get install -y xvfb |
| 120 | + # Create multiple symlinks to ensure Firefox is found |
| 121 | + sudo ln -sf /snap/bin/firefox /usr/local/bin/firefox |
| 122 | + sudo ln -sf /snap/bin/firefox /usr/bin/firefox |
| 123 | + # Add snap bin to PATH for this session |
| 124 | + echo 'export PATH="/snap/bin:$PATH"' >> ~/.bashrc |
| 125 | + export PATH="/snap/bin:$PATH" |
| 126 | + # Verify Firefox installation and location |
| 127 | + which firefox |
| 128 | + firefox --version |
| 129 | + # Set up display for headless mode |
| 130 | + export DISPLAY=:99 |
| 131 | + Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & |
| 132 | + # Wait a moment for Xvfb to start |
| 133 | + sleep 2 |
| 134 | +
|
| 135 | + - name: Install Kubeflow common library dependecies |
| 136 | + run: | |
| 137 | + cd components/crud-web-apps/common/frontend/kubeflow-common-lib |
| 138 | + npm i |
| 139 | + npm run build |
| 140 | + npm link ./dist/kubeflow |
| 141 | +
|
| 142 | + - name: Install VWA dependencies |
| 143 | + run: | |
| 144 | + cd components/crud-web-apps/volumes/frontend |
| 145 | + npm i |
| 146 | + npm link kubeflow |
| 147 | +
|
| 148 | + - name: Verify Firefox detection |
| 149 | + run: | |
| 150 | + cd components/crud-web-apps/volumes/frontend |
| 151 | + # List available browsers for Cypress |
| 152 | + npx cypress info |
| 153 | + # Try to detect Firefox specifically |
| 154 | + npx cypress run --browser firefox --dry-run || echo "Firefox detection failed, trying alternative approach" |
| 155 | +
|
| 156 | + - name: Serve UI & run Cypress tests in Firefox |
| 157 | + uses: cypress-io/github-action@v6 |
| 158 | + with: |
| 159 | + working-directory: components/crud-web-apps/volumes/frontend |
| 160 | + start: npm run serve |
| 161 | + install: false |
| 162 | + browser: firefox |
| 163 | + wait-on: "http://localhost:4200" |
| 164 | + record: false |
| 165 | + env: |
| 166 | + DISPLAY: :99 |
| 167 | + PATH: /snap/bin:/usr/local/bin:/usr/bin:/bin |
0 commit comments