Skip to content

Commit

Permalink
gh-actions: Extend action to run Frontend Unit tests (#1998)
Browse files Browse the repository at this point in the history
* gh-actions: Extend action to run Frontend Unit tests

Extend Frontend Test action to run also KWA frontend unit tests.

Signed-off-by: Orfeas Kourkakis <orfeas@arrikto.com>

* gh-actions: Exclude actions when there are only UI changes

Prevent the following workflows when a PR contains changes that affect
only the frontend:
 - Charmed Katib
 - E2E Test with darts-cnn-cifar10
 - E2E Test with enas-cnn-cifar10
 - E2E Test with mxnet-mnist
 - E2E Test with pytorch-mnist
 - E2E Test with simple-pbt
 - E2E Test with tf-mnist-with-summaries
 - Go Test
 - Publish AutoML Algorithm Images
 - Publish Katib Core Images
 - Publish Trial Images
 - Python Test
 - Shellcheck

Signed-off-by: Orfeas Kourkakis <orfeas@arrikto.com>

* gh-actions: Add action to build Katib UI image.

Signed-off-by: Orfeas Kourkakis <orfeas@arrikto.com>

Signed-off-by: Orfeas Kourkakis <orfeas@arrikto.com>
  • Loading branch information
orfeas-k committed Nov 11, 2022
1 parent b1ed847 commit 0ee6062
Show file tree
Hide file tree
Showing 16 changed files with 113 additions and 22 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/darts-cifar10-e2e-test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: E2E Test with darts-cnn-cifar10
on:
- pull_request
pull_request:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/enas-cifar10-e2e-test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: E2E Test with enas-cnn-cifar10
on:
- pull_request
pull_request:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/mxnet-mnist-e2e-test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: E2E Test with mxnet-mnist
on:
- pull_request
pull_request:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/publish-algorithm-images.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: Publish AutoML Algorithm Images

on:
- push
- pull_request
push:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'
pull_request:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'

jobs:
algorithm:
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/publish-core-images.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: Publish Katib Core Images

on:
- push
- pull_request
push:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'
pull_request:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'

jobs:
core:
Expand All @@ -16,7 +20,6 @@ jobs:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}


strategy:
fail-fast: false
matrix:
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/publish-katib-ui-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Publish Katib UI Image

on:
- push
- pull_request

jobs:
ui:
name: Publish Image
uses: ./.github/workflows/build-and-publish-images.yaml
with:
component-name: katib-ui
platforms: linux/amd64,linux/arm64
dockerfile: cmd/new-ui/v1beta1/Dockerfile
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
8 changes: 6 additions & 2 deletions .github/workflows/publish-trial-images.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: Publish Trial Images

on:
- push
- pull_request
push:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'
pull_request:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'

jobs:
trial:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/pytorch-mnist-e2e-test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: E2E Test with pytorch-mnist
on:
- pull_request
pull_request:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/simple-pbt-e2e-test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: E2E Test with simple-pbt
on:
- pull_request
pull_request:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/test-charmed-katib.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: Charmed Katib

on:
- push
- pull_request
push:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'
pull_request:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'

jobs:
lint:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/test-go.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: Go Test

on:
- push
- pull_request
push:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'
pull_request:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'

jobs:
generatetests:
Expand Down
36 changes: 35 additions & 1 deletion .github/workflows/test-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,45 @@ jobs:
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 12.18.1

- name: Run Node test
run: |
npm install prettier --prefix ./pkg/new-ui/v1beta1/frontend
make prettier-check
frontend-unit-tests:
name: Frontend Unit Tests
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 12.18.1

- name: Fetch Kubeflow and install common code dependencies
run: |
cd /tmp && git clone https://github.com/kubeflow/kubeflow.git
cd kubeflow
git checkout c4ca7a9
cd components/crud-web-apps/common/frontend/kubeflow-common-lib
npm i
npm run build
npm link ./dist/kubeflow
- name: Install KWA dependencies
run: |
cd pkg/new-ui/v1beta1/frontend
npm i
npm link kubeflow
- name: Run unit tests
run: |
cd pkg/new-ui/v1beta1/frontend
npm run test:prod
8 changes: 6 additions & 2 deletions .github/workflows/test-python.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: Python Test

on:
- push
- pull_request
push:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'
pull_request:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'

jobs:
test:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/test-shell-script.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: Shellcheck

on:
- push
- pull_request
push:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'
pull_request:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'

jobs:
test:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/tf-mnist-with-summaries-e2e-test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: E2E Test with tf-mnist-with-summaries
on:
- pull_request
pull_request:
paths-ignore:
- 'pkg/new-ui/v1beta1/frontend/**'

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions pkg/new-ui/v1beta1/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"build:prod": "npm run copyLibAssets && ng build --base-href /katib/ --deploy-url /katib/static/ --outputPath dist/static --configuration production",
"copyLibAssets": "cp -r ./node_modules/kubeflow/assets/* ./src/assets/",
"test": "ng test",
"test:prod": "ng test --browsers=ChromeHeadless --watch=false",
"lint": "ng lint",
"format:check": "prettier --check 'src/**/*.{jsx,js,ts,html,scss,css}' || node scripts/check-format-error.js",
"format:write": "prettier --write 'src/**/*.{jsx,js,ts,html,scss,css}'",
Expand Down

0 comments on commit 0ee6062

Please sign in to comment.