Skip to content

Commit a85e8af

Browse files
committed
Migrate Backend tests to a GHA workflow
1 parent 24424ba commit a85e8af

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: KFP Backend Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
paths:
11+
- 'backend/**'
12+
- 'test/presubmit-backend-test.sh'
13+
workflow_dispatch:
14+
15+
jobs:
16+
backend-tests:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v2
22+
23+
- name: Set up Go
24+
uses: actions/setup-go@v3
25+
with:
26+
go-version: '1.21'
27+
28+
- name: Run Backend Tests
29+
run: ./test/presubmit-backend-test.sh
30+
shell: bash

test/presubmit-backend-test.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,20 @@ set -ex
1919

2020
# Add installed go binaries to PATH.
2121
export PATH="${PATH}:$(go env GOPATH)/bin"
22-
# The current directory is /home/prow/go/src/github.com/kubeflow/pipelines
23-
cd /home/prow/go/src/github.com/kubeflow/pipelines
22+
23+
# Navigate to the repository root directory
24+
REPO_ROOT=$(git rev-parse --show-toplevel)
25+
cd "$REPO_ROOT"
26+
2427
# 1. Check go modules are tidy
2528
# Reference: https://github.com/golang/go/issues/27005#issuecomment-564892876
2629
go mod download
2730
go mod tidy
2831
git diff --exit-code -- go.mod go.sum || (echo "go modules are not tidy, run 'go mod tidy'." && exit 1)
29-
# 2. run test in project directory
32+
33+
# 2. Run tests in the backend directory
3034
go test -v -cover ./backend/...
35+
3136
# 3. Check for forbidden go licenses
3237
./hack/install-go-licenses.sh
3338
go-licenses check ./backend/src/apiserver ./backend/src/cache ./backend/src/agent/persistence ./backend/src/crd/controller/scheduledworkflow ./backend/src/crd/controller/viewer

0 commit comments

Comments
 (0)