9
9
types : [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
10
10
paths :
11
11
- microservices-connector/**
12
+ - kubernetes-addons/memory-bandwidth-exporter/**
12
13
- " !microservices-connector/helm/**"
13
14
- " !**.md"
14
15
- " !**.txt"
@@ -21,11 +22,45 @@ concurrency:
21
22
cancel-in-progress : true
22
23
23
24
env :
24
- GOSRC_DIR : " microservices-connector"
25
+ GMC_DIR : " microservices-connector"
26
+ MBE_DIR : " kubernetes-addons/memory-bandwidth-exporter"
25
27
26
28
jobs :
29
+ job1 :
30
+ name : Get-test-matrix
31
+ runs-on : ubuntu-latest
32
+ outputs :
33
+ run_matrix : ${{ steps.get-test-matrix.outputs.run_matrix }}
34
+ steps :
35
+ - name : Checkout out Repo
36
+ uses : actions/checkout@v4
37
+ with :
38
+ fetch-depth : 0
39
+
40
+ - name : Get test matrix
41
+ id : get-test-matrix
42
+ run : |
43
+ set -xe
44
+ base_commit=${{ github.event.pull_request.base.sha }}
45
+ merged_commit=${{ github.event.pull_request.head.sha }}
46
+ run_matrix="["
47
+ if git diff --name-only ${base_commit} ${merged_commit} | grep -q "^${GMC_DIR}/"; then
48
+ run_matrix="${run_matrix}\"${GMC_DIR}\","
49
+ fi
50
+ if git diff --name-only ${base_commit} ${merged_commit} | grep -q "^${MBE_DIR}/"; then
51
+ run_matrix="${run_matrix}\"${MBE_DIR}\","
52
+ fi
53
+ run_matrix=${run_matrix%,}"]"
54
+ echo "run_matrix=${run_matrix}"
55
+ echo "run_matrix=${run_matrix}" >> $GITHUB_OUTPUT
56
+
27
57
go-unittests :
58
+ needs : [job1]
28
59
runs-on : ubuntu-latest
60
+ if : always() && ${{ needs.job1.outputs.run_matrix.length }} > 0
61
+ strategy :
62
+ matrix :
63
+ gopath : ${{ fromJSON(needs.job1.outputs.run_matrix) }}
29
64
permissions :
30
65
contents : write
31
66
actions : write
@@ -47,15 +82,15 @@ jobs:
47
82
with :
48
83
args : --timeout=10m
49
84
version : v1.55.2
50
- working-directory : ${{ env.GOSRC_DIR }}
85
+ working-directory : ${{ matrix.gopath }}
51
86
52
87
- name : Run golangunit test
53
88
run : |
54
- cd $GOSRC_DIR
89
+ cd ${{ matrix.gopath }}
55
90
make test
56
91
57
92
- name : Run tests and generate coverage
58
93
run : |
59
- cd $GOSRC_DIR
94
+ cd ${{ matrix.gopath }}
60
95
go test -coverprofile=coverage.out $(go list ./... | grep -v /e2e)
61
96
../.github/workflows/scripts/go-coverage.sh
0 commit comments