Skip to content

Commit 8b9b78f

Browse files
committed
feat: Migrate TWA test-related workflows
Signed-off-by: Yehudit Kerido <[email protected]>
1 parent b38fc0f commit 8b9b78f

File tree

6 files changed

+3431
-14810
lines changed

6 files changed

+3431
-14810
lines changed
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
name: TWA Frontend Tests
2+
on:
3+
pull_request:
4+
paths:
5+
- components/crud-web-apps/tensorboards/frontend/**
6+
- releasing/version/VERSION
7+
branches:
8+
- main
9+
- v*-branch
10+
- notebooks-v1
11+
12+
jobs:
13+
frontend-format-linting-check:
14+
name: Code format and lint
15+
runs-on: ubuntu-22.04
16+
defaults:
17+
run:
18+
working-directory: components/crud-web-apps/tensorboards/frontend
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 16
28+
cache: 'npm'
29+
cache-dependency-path: 'components/crud-web-apps/tensorboards/frontend/package-lock.json'
30+
31+
- name: Install dependencies
32+
run: npm ci
33+
34+
- name: Check code format
35+
run: npm run format:check
36+
37+
- name: Lint code
38+
run: npm run lint-check
39+
40+
build-common-lib:
41+
name: Build Kubeflow common library
42+
runs-on: ubuntu-22.04
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
47+
- name: Setup Node.js
48+
uses: actions/setup-node@v4
49+
with:
50+
node-version: 16
51+
cache: 'npm'
52+
cache-dependency-path: 'components/crud-web-apps/common/frontend/kubeflow-common-lib/package-lock.json'
53+
54+
- name: Install and build common library
55+
run: |
56+
cd components/crud-web-apps/common/frontend/kubeflow-common-lib
57+
npm ci
58+
npm run build
59+
60+
- name: Cache built common library
61+
uses: actions/cache@v4
62+
with:
63+
path: components/crud-web-apps/common/frontend/kubeflow-common-lib/dist
64+
key: kubeflow-common-lib-${{ github.sha }}
65+
restore-keys: |
66+
kubeflow-common-lib-
67+
68+
frontend-unit-tests:
69+
name: Unit tests
70+
runs-on: ubuntu-22.04
71+
needs: build-common-lib
72+
steps:
73+
- name: Checkout code
74+
uses: actions/checkout@v4
75+
76+
- name: Setup Node.js
77+
uses: actions/setup-node@v4
78+
with:
79+
node-version: 16
80+
cache: 'npm'
81+
cache-dependency-path: 'components/crud-web-apps/tensorboards/frontend/package-lock.json'
82+
83+
- name: Restore built common library
84+
uses: actions/cache@v4
85+
with:
86+
path: components/crud-web-apps/common/frontend/kubeflow-common-lib/dist
87+
key: kubeflow-common-lib-${{ github.sha }}
88+
restore-keys: |
89+
kubeflow-common-lib-
90+
91+
- name: Install common library dependencies
92+
run: |
93+
cd components/crud-web-apps/common/frontend/kubeflow-common-lib
94+
npm ci
95+
npm link ./dist/kubeflow
96+
97+
- name: Install TWA dependencies
98+
run: |
99+
cd components/crud-web-apps/tensorboards/frontend
100+
npm ci
101+
npm link kubeflow
102+
103+
- name: Run unit tests
104+
run: |
105+
cd components/crud-web-apps/tensorboards/frontend
106+
npm run test:prod
107+
108+
frontend-ui-tests:
109+
name: UI tests with Cypress
110+
runs-on: ubuntu-22.04
111+
needs: build-common-lib
112+
steps:
113+
- name: Checkout code
114+
uses: actions/checkout@v4
115+
116+
- name: Setup Node.js
117+
uses: actions/setup-node@v4
118+
with:
119+
node-version: 16
120+
cache: 'npm'
121+
cache-dependency-path: 'components/crud-web-apps/tensorboards/frontend/package-lock.json'
122+
123+
- name: Restore built common library
124+
uses: actions/cache@v4
125+
with:
126+
path: components/crud-web-apps/common/frontend/kubeflow-common-lib/dist
127+
key: kubeflow-common-lib-${{ github.sha }}
128+
restore-keys: |
129+
kubeflow-common-lib-
130+
131+
- name: Install common library dependencies
132+
run: |
133+
cd components/crud-web-apps/common/frontend/kubeflow-common-lib
134+
npm ci
135+
npm link ./dist/kubeflow
136+
137+
- name: Install TWA dependencies
138+
run: |
139+
cd components/crud-web-apps/tensorboards/frontend
140+
npm ci
141+
npm link kubeflow
142+
143+
- name: Run Cypress tests
144+
run: |
145+
cd components/crud-web-apps/tensorboards/frontend
146+
npm run serve > serve.log 2>&1 & npx wait-on http://localhost:4200
147+
npm run ui-test-ci-all
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: TWA Integration Test
2+
on: # Temp branch for testing
3+
pull_request:
4+
paths:
5+
- components/crud-web-apps/tensorboards/**
6+
- components/crud-web-apps/common/**
7+
- releasing/version/VERSION
8+
branches:
9+
- main
10+
- v*-branch
11+
- notebooks-v1
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }}
15+
cancel-in-progress: true
16+
17+
env:
18+
IMG: ghcr.io/kubeflow/notebooks/tensorboards-web-app
19+
TAG: integration-test
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-22.04
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Build TWA Image
29+
run: |
30+
cd components/crud-web-apps/tensorboards
31+
make docker-build
32+
33+
- name: Install KinD
34+
run: ./components/testing/gh-actions/install_kind.sh
35+
36+
- name: Create KinD Cluster
37+
run: kind create cluster --config components/testing/gh-actions/kind-1-25.yaml
38+
39+
- name: Load Image into KinD Cluster
40+
run: |
41+
kind load docker-image "${IMG}:${TAG}"
42+
43+
- name: Install kustomize
44+
run: ./components/testing/gh-actions/install_kustomize.sh
45+
46+
- name: Install Istio
47+
run: ./components/testing/gh-actions/install_istio.sh
48+
49+
- name: Build & Apply manifests
50+
run: |
51+
cd components/crud-web-apps/tensorboards/manifests
52+
kubectl create ns kubeflow
53+
54+
export CURRENT_IMAGE="${IMG}"
55+
export PR_IMAGE="${IMG}:${TAG}"
56+
57+
# escape "." in the image names, as it is a special characters in sed
58+
export CURRENT_IMAGE=$(echo "$CURRENT_IMAGE" | sed 's|\.|\\.|g')
59+
export PR_IMAGE=$(echo "$PR_IMAGE" | sed 's|\.|\\.|g')
60+
61+
kustomize build overlays/istio \
62+
| sed "s|${CURRENT_IMAGE}:[a-zA-Z0-9_.-]*|${PR_IMAGE}|g" \
63+
| kubectl apply -f -
64+
65+
kubectl wait pods -n kubeflow -l app=tensorboards-web-app --for=condition=Ready --timeout=300s
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: TWA Multi-Arch Build Test
2+
on: # Temp branch for testing
3+
pull_request:
4+
paths:
5+
- components/crud-web-apps/tensorboards/**
6+
- components/crud-web-apps/common/**
7+
- releasing/version/VERSION
8+
branches:
9+
- main
10+
- v*-branch
11+
- notebooks-v1
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }}
15+
cancel-in-progress: true
16+
17+
env:
18+
IMG: ghcr.io/kubeflow/notebooks/tensorboards-web-app
19+
PLATFORMS: linux/amd64,linux/ppc64le,linux/arm64/v8
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-22.04
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Setup QEMU
29+
uses: docker/setup-qemu-action@v3
30+
31+
- name: Setup Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
34+
- name: Build multi-arch images
35+
uses: docker/build-push-action@v5
36+
with:
37+
context: components/crud-web-apps
38+
file: components/crud-web-apps/tensorboards/Dockerfile
39+
platforms: ${{ env.PLATFORMS }}
40+
push: false
41+
load: false
42+
tags: |
43+
${{ env.IMG }}:${{ github.sha }}
44+
${{ env.IMG }}:latest
45+
cache-from: type=gha
46+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)