Skip to content

Commit a5bfa91

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

File tree

10 files changed

+3505
-14810
lines changed

10 files changed

+3505
-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: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: TWA Integration Test
2+
on:
3+
push:
4+
branches:
5+
- feat/migrate_twa_tests # Temp branch for testing
6+
pull_request:
7+
paths:
8+
- components/crud-web-apps/tensorboards/**
9+
- components/crud-web-apps/common/**
10+
- releasing/version/VERSION
11+
branches:
12+
- main
13+
- v*-branch
14+
- notebooks-v1
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }}
18+
cancel-in-progress: true
19+
20+
env:
21+
IMG: ghcr.io/kubeflow/notebooks/tensorboards-web-app
22+
TAG: integration-test
23+
24+
jobs:
25+
build:
26+
runs-on: ubuntu-22.04
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Build TWA Image
32+
run: |
33+
cd components/crud-web-apps/tensorboards
34+
make docker-build
35+
36+
- name: Install KinD
37+
run: ./components/testing/gh-actions/install_kind.sh
38+
39+
- name: Create KinD Cluster
40+
run: kind create cluster --config components/testing/gh-actions/kind-1-25.yaml
41+
42+
- name: Load Image into KinD Cluster
43+
run: |
44+
kind load docker-image "${IMG}:${TAG}"
45+
46+
- name: Install kustomize
47+
run: ./components/testing/gh-actions/install_kustomize.sh
48+
49+
- name: Install Istio
50+
run: ./components/testing/gh-actions/install_istio.sh
51+
52+
- name: Build & Apply manifests
53+
run: |
54+
cd components/crud-web-apps/tensorboards/manifests
55+
kubectl create ns kubeflow
56+
57+
export CURRENT_IMAGE="${IMG}"
58+
export PR_IMAGE="${IMG}:${TAG}"
59+
60+
# escape "." in the image names, as it is a special characters in sed
61+
export CURRENT_IMAGE=$(echo "$CURRENT_IMAGE" | sed 's|\.|\\.|g')
62+
export PR_IMAGE=$(echo "$PR_IMAGE" | sed 's|\.|\\.|g')
63+
64+
kustomize build overlays/istio \
65+
| sed "s|${CURRENT_IMAGE}:[a-zA-Z0-9_.-]*|${PR_IMAGE}|g" \
66+
| kubectl apply -f -
67+
68+
kubectl wait pods -n kubeflow -l app=tensorboards-web-app --for=condition=Ready --timeout=300s
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: TWA Multi-Arch Build Test
2+
on:
3+
push:
4+
branches:
5+
- feat/migrate_twa_tests # Temp branch for testing
6+
pull_request:
7+
paths:
8+
- components/crud-web-apps/tensorboards/**
9+
- components/crud-web-apps/common/**
10+
- releasing/version/VERSION
11+
branches:
12+
- main
13+
- v*-branch
14+
- notebooks-v1
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }}
18+
cancel-in-progress: true
19+
20+
env:
21+
IMG: ghcr.io/kubeflow/notebooks/tensorboards-web-app
22+
PLATFORMS: linux/amd64,linux/ppc64le,linux/arm64/v8
23+
24+
jobs:
25+
build:
26+
runs-on: ubuntu-22.04
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Setup QEMU
32+
uses: docker/setup-qemu-action@v3
33+
34+
- name: Setup Docker Buildx
35+
uses: docker/setup-buildx-action@v3
36+
37+
- name: Build multi-arch images
38+
uses: docker/build-push-action@v5
39+
with:
40+
context: components/crud-web-apps
41+
file: components/crud-web-apps/tensorboards/Dockerfile
42+
platforms: ${{ env.PLATFORMS }}
43+
push: false
44+
load: false
45+
tags: |
46+
${{ env.IMG }}:${{ github.sha }}
47+
${{ env.IMG }}:latest
48+
cache-from: type=gha
49+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)