1
- # reusable workflow triggered by other actions
2
1
name : CI
3
2
3
+ concurrency :
4
+ group : ${{ github.workflow }}-${{ github.ref }}
5
+ cancel-in-progress : true
6
+
4
7
on :
8
+ pull_request :
9
+ schedule :
10
+ - cron : ' 0 8 * * TUE'
11
+ # Triggered on push by .github/workflows/release.yaml
5
12
workflow_call :
6
- secrets :
7
- CHARMCRAFT_CREDENTIALS :
8
- required : true
13
+ outputs :
14
+ artifact-prefix :
15
+ description : build_charm.yaml `artifact-prefix` output
16
+ value : ${{ jobs.build.outputs.artifact-prefix }}
17
+ charm-paths :
18
+ description : paths for all charms in this repo
19
+ value : ${{ jobs.get-charm-paths-channel.outputs.charm-paths }}
20
+ channel :
21
+ description : Charmhub channel the charms are released to
22
+ value : ${{ jobs.get-charm-paths-channel.outputs.charm-channel }}
9
23
10
24
jobs :
25
+ get-charm-paths-channel :
26
+ name : Get charm paths and charmhub channel
27
+ runs-on : ubuntu-latest
28
+ outputs :
29
+ charm-paths : ${{ steps.get-charm-paths.outputs.charm-paths }}
30
+ charm-channel : ${{ steps.select-channel.outputs.name }}
31
+ steps :
32
+ - uses : actions/checkout@v4
33
+ with :
34
+ fetch-depth : 0
35
+ - name : Get paths for all charms in this repo
36
+ id : get-charm-paths
37
+ uses : canonical/kubeflow-ci/actions/get-charm-paths@main
38
+ - name : Select charmhub channel
39
+ uses :
canonical/charming-actions/[email protected]
40
+ id : select-channel
41
+
11
42
lib-check :
12
43
name : Check libraries
44
+ needs :
45
+ - get-charm-paths-channel
46
+ strategy :
47
+ matrix :
48
+ charm : ${{ fromJSON(needs.get-charm-paths-channel.outputs.charm-paths) }}
13
49
uses : canonical/charmed-kubeflow-workflows/.github/workflows/_quality-checks.yaml@main
14
50
secrets : inherit
15
51
with :
16
- charm-path : " . "
52
+ charm-path : ${{ matrix.charm }}
17
53
18
54
lint :
19
55
name : Lint Code
23
59
matrix :
24
60
charm : [operator, serving, eventing]
25
61
steps :
26
- - uses : actions/checkout@v3
62
+ - uses : actions/checkout@v4
27
63
- run : pip install tox
28
64
- run : tox -e ${{ matrix.charm }}-lint
65
+
29
66
unit :
30
67
name : Unit Test
31
68
runs-on : ubuntu-20.04
@@ -34,19 +71,21 @@ jobs:
34
71
matrix :
35
72
charm : [operator, serving, eventing]
36
73
steps :
37
- - uses : actions/checkout@v3
74
+ - uses : actions/checkout@v4
38
75
- run : pip install tox
39
76
- run : tox -e ${{ matrix.charm }}-unit
40
77
41
78
terraform-checks :
42
79
name : Terraform
80
+ needs :
81
+ - get-charm-paths-channel
43
82
uses : canonical/charmed-kubeflow-workflows/.github/workflows/terraform-checks.yaml@main
44
83
strategy :
45
84
fail-fast : false
46
85
matrix :
47
- charm : [operator, serving, eventing]
86
+ charm : ${{ fromJSON(needs.get-charm-paths-channel.outputs.charm-paths) }}
48
87
with :
49
- charm-path : ./charms/knative- ${{ matrix.charm }}
88
+ charm-path : ${{ matrix.charm }}
50
89
# Skipping the Terraform apply check as knative-eventing and knative-serving
51
90
# go to Error when knative-operator is not deployed, instead of the expected
52
91
# Blocked or Active. This is currently a limitation of the Terraform re-usable
@@ -55,10 +94,22 @@ jobs:
55
94
# See https://github.com/canonical/knative-operators/issues/156
56
95
apply : false
57
96
97
+ build :
98
+ strategy :
99
+ matrix :
100
+ charm : ${{ fromJSON(needs.get-charm-paths-channel.outputs.charm-paths) }}
101
+ name : Build charm | ${{ matrix.charm }}
102
+ needs :
103
+ - get-charm-paths-channel
104
+ uses :
canonical/data-platform-workflows/.github/workflows/[email protected]
105
+ with :
106
+ path-to-charm-directory : ${{ matrix.charm }}
107
+
58
108
integration-charm-deployment :
59
109
name : Integration Test
110
+ needs :
111
+ - build
60
112
runs-on : ubuntu-20.04
61
-
62
113
steps :
63
114
# Ideally we'd use self-hosted runners, but this effort is still not stable
64
115
# This action will remove unused software (dotnet, haskell, android libs, codeql,
@@ -69,21 +120,28 @@ jobs:
69
120
70
121
71
122
- name : Check out repo
72
- uses : actions/checkout@v3
123
+ uses : actions/checkout@v4
73
124
74
125
- name : Setup operator environment
75
126
uses : charmed-kubernetes/actions-operator@main
76
127
with :
77
128
provider : microk8s
78
129
channel : 1.31-strict/stable
79
130
juju-channel : 3.6/stable
80
- charmcraft-channel : 3.x/stable
81
131
microk8s-addons : " dns storage rbac metallb:10.64.140.43-10.64.140.49"
82
132
133
+ - name : Download packed charm(s)
134
+ id : download-charms
135
+ timeout-minutes : 5
136
+ uses : actions/download-artifact@v4
137
+ with :
138
+ pattern : ${{ needs.build.outputs.artifact-prefix }}-*
139
+ merge-multiple : true
140
+
83
141
- name : Run integration tests
84
142
run : |
85
143
sg snap_microk8s -c "juju add-model knative-test"
86
- sg snap_microk8s -c "tox -vve integration -- --model knative-test"
144
+ sg snap_microk8s -c "tox -vve integration -- --model knative-test --charms-path=${{ github.workspace }}/charms "
87
145
88
146
- run : kubectl get all -A
89
147
if : failure()
@@ -95,12 +153,13 @@ jobs:
95
153
if : failure()
96
154
97
155
- uses : canonical/kubeflow-ci/actions/dump-charm-debug-artifacts@main
98
- if : always ()
156
+ if : failure ()
99
157
100
158
integration-observability :
101
159
name : Observability Integration Test
160
+ needs :
161
+ - build
102
162
runs-on : ubuntu-20.04
103
-
104
163
steps :
105
164
# Ideally we'd use self-hosted runners, but this effort is still not stable
106
165
# This action will remove unused software (dotnet, haskell, android libs, codeql,
@@ -111,25 +170,32 @@ jobs:
111
170
112
171
113
172
- name : Check out repo
114
- uses : actions/checkout@v3
173
+ uses : actions/checkout@v4
115
174
116
175
- name : Setup operator environment
117
176
uses : charmed-kubernetes/actions-operator@main
118
177
with :
119
178
provider : microk8s
120
179
channel : 1.31-strict/stable
121
180
juju-channel : 3.6/stable
122
- charmcraft-channel : 3.x/stable
181
+
182
+ - name : Download packed charm(s)
183
+ id : download-charms
184
+ timeout-minutes : 5
185
+ uses : actions/download-artifact@v4
186
+ with :
187
+ pattern : ${{ needs.build.outputs.artifact-prefix }}-*
188
+ merge-multiple : true
123
189
124
190
- name : Run integration tests
125
191
run : |
126
192
sg snap_microk8s -c "juju add-model cos-test"
127
- sg snap_microk8s -c "tox -vve cos-integration -- --model cos-test"
193
+ sg snap_microk8s -c "tox -vve cos-integration -- --model cos-test --charms-path=${{ github.workspace }}/charms "
128
194
129
- - run : kubectl get pod/prometheus-k8s-0 -n knative -test -o=jsonpath='{.status}'
195
+ - run : kubectl get pod/prometheus-k8s-0 -n cos -test -o=jsonpath='{.status}'
130
196
if : failure()
131
197
132
- - run : kubectl get pod/knative-operator-0 -nknative -test -o=jsonpath='{.status}'
198
+ - run : kubectl get pod/knative-operator-0 -n cos -test -o=jsonpath='{.status}'
133
199
if : failure()
134
200
135
201
- run : kubectl get all -A
@@ -139,4 +205,22 @@ jobs:
139
205
if : failure()
140
206
141
207
- uses : canonical/kubeflow-ci/actions/dump-charm-debug-artifacts@main
142
- if : always()
208
+ if : failure()
209
+
210
+ release :
211
+ strategy :
212
+ matrix :
213
+ charm : ${{ fromJSON(needs.get-charm-paths-channel.outputs.charm-paths) }}
214
+ name : Release charm to Charmhub branch | ${{ matrix.charm }}
215
+ if : ${{ github.event_name == 'pull_request' }}
216
+ needs :
217
+ - get-charm-paths-channel
218
+ - build
219
+ uses :
canonical/data-platform-workflows/.github/workflows/[email protected]
220
+ with :
221
+ channel : ${{ needs.get-charm-paths-channel.outputs.charm-channel }}
222
+ artifact-prefix : ${{ needs.build.outputs.artifact-prefix }}
223
+ path-to-charm-directory : ${{ matrix.charm }}
224
+ create-git-tags : false
225
+ secrets :
226
+ charmhub-token : ${{ secrets.CHARMCRAFT_CREDENTIALS }}
0 commit comments