@@ -3,88 +3,109 @@ name: continuous-integration
33on :
44 push :
55 branches :
6- - master
6+ - master
77 tags :
8- - v0.*
8+ - v0.*
99 pull_request :
1010 branches :
11- - master
11+ - master
1212
1313permissions :
1414 contents : read
1515
16- env :
17- SUDO : sudo
18- GO_VERSION : " ^1.21 "
16+ concurrency :
17+ group : ci-${{ github.workflow }}-${{ github.ref }}
18+ cancel-in-progress : true
1919
2020jobs :
21- ci-unit-tests-custom-metrics-stackdriver-adapter :
22- name : ci-unit-tests-custom-metrics-stackdriver-adapter
21+ ci-unit-tests :
22+ name : ci-unit-tests-${{ matrix.component.name }}
2323 runs-on : ubuntu-latest
24+ strategy :
25+ fail-fast : false
26+ matrix :
27+ component :
28+ - name : custom-metrics-stackdriver-adapter
29+ dir : custom-metrics-stackdriver-adapter
30+ build-target : build
31+ - name : prometheus-to-sd
32+ dir : prometheus-to-sd
33+ build-target : build
34+ - name : event-exporter
35+ dir : event-exporter
36+ build-target : build
37+ - name : kubelet-to-gcm
38+ dir : kubelet-to-gcm
39+ build-target : compile
40+ if : ${{ hashFiles(format('{0}/go.mod', matrix.component.dir)) != '' }}
2441 steps :
2542 - name : Check out code into the Go module directory
2643 uses : actions/checkout@v4
2744
28- - name : Set up Go 1.x
45+ - name : Set up Go from module
2946 uses : actions/setup-go@v5
3047 with :
31- go-version : ${{ env.GO_VERSION }}
48+ go-version-file : ${{ matrix.component.dir }}/go.mod
49+ cache : true
50+ cache-dependency-path : ${{ matrix.component.dir }}/go.sum
3251 id : go
3352
3453 - name : Unit tests
35- run : |
36- cd custom-metrics-stackdriver-adapter
37- make test
54+ working-directory : ${{ matrix.component.dir }}
55+ run : make test
3856
39- ci-build-custom-metrics-stackdriver-adapter :
40- name : ci-build-custom-metrics-stackdriver-adapter
57+ ci-build :
58+ name : ci-build-${{ matrix.component.name }}
4159 runs-on : ubuntu-latest
60+ strategy :
61+ fail-fast : false
62+ matrix :
63+ component :
64+ - name : custom-metrics-stackdriver-adapter
65+ dir : custom-metrics-stackdriver-adapter
66+ build-target : build
67+ - name : prometheus-to-sd
68+ dir : prometheus-to-sd
69+ build-target : build
70+ - name : event-exporter
71+ dir : event-exporter
72+ build-target : build
73+ - name : kubelet-to-gcm
74+ dir : kubelet-to-gcm
75+ build-target : compile
76+ if : ${{ hashFiles(format('{0}/go.mod', matrix.component.dir)) != '' }}
4277 steps :
4378 - name : Check out code into the Go module directory
4479 uses : actions/checkout@v4
4580
46- - name : Set up Go 1.x
81+ - name : Set up Go from module
4782 uses : actions/setup-go@v5
4883 with :
49- go-version : ${{ env.GO_VERSION }}
84+ go-version-file : ${{ matrix.component.dir }}/go.mod
85+ cache : true
86+ cache-dependency-path : ${{ matrix.component.dir }}/go.sum
5087 id : go
5188
5289 - name : Build
53- run : |
54- cd custom-metrics-stackdriver-adapter
55- make build
56- ci-unit-tests-prometheus-to-sd :
57- name : ci-unit-tests-prometheus-to-sd
58- runs-on : ubuntu-latest
59- steps :
60- - name : Check out code into the Go module directory
61- uses : actions/checkout@v4
90+ working-directory : ${{ matrix.component.dir }}
91+ run : make ${{ matrix.component.build-target }}
6292
63- - name : Set up Go 1.x
64- uses : actions/setup-go@v5
65- with :
66- go-version : ${{ env.GO_VERSION }}
67- id : go
68-
69- - name : Unit tests
70- run : |
71- cd prometheus-to-sd
72- make test
73-
74- ci-build-prometheus-to-sd :
75- name : ci-build-prometheus-to-sd
93+ ci-container-build :
94+ name : ci-container-build-${{ matrix.component }}
7695 runs-on : ubuntu-latest
96+ strategy :
97+ fail-fast : false
98+ matrix :
99+ component :
100+ - custom-metrics-stackdriver-adapter
101+ - prometheus-to-sd
102+ - event-exporter
103+ - kubelet-to-gcm
104+ - fluentd-gcp-scaler
105+ if : ${{ hashFiles(format('{0}/Dockerfile', matrix.component)) != '' }}
77106 steps :
78- - name : Check out code into the Go module directory
107+ - name : Check out code
79108 uses : actions/checkout@v4
80-
81- - name : Set up Go 1.x
82- uses : actions/setup-go@v5
83- with :
84- go-version : ${{ env.GO_VERSION }}
85- id : go
86-
87- - name : Build
88- run : |
89- cd prometheus-to-sd
90- make build
109+ - name : Build container
110+ working-directory : ${{ matrix.component }}
111+ run : docker build .
0 commit comments