-
Notifications
You must be signed in to change notification settings - Fork 5
161 lines (142 loc) · 4.53 KB
/
Copy pathci.yaml
File metadata and controls
161 lines (142 loc) · 4.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
schedule:
- cron: '0 8 * * TUE'
workflow_call:
outputs:
artifact-prefix:
description: build_charm.yaml `artifact-prefix` output
value: ${{ jobs.build.outputs.artifact-prefix }}
charm-paths:
description: paths for all charms in this repo
value: ${{ jobs.get-charm-paths-track.outputs.charm-paths }}
track:
description: Charmhub track determined from branch name
value: ${{ jobs.get-charm-paths-track.outputs.track }}
jobs:
get-charm-paths-track:
name: Get charm paths and track
runs-on: ubuntu-latest
outputs:
charm-paths: ${{ steps.get-charm-paths.outputs.charm-paths }}
track: ${{ steps.determine-track.outputs.track }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get paths for all charms in this repo
id: get-charm-paths
uses: canonical/kubeflow-ci/actions/get-charm-paths@main
- name: Determine track
id: determine-track
shell: python
run: |
import os
if "${{ github.event_name }}" == "pull_request":
ref = "${{ github.base_ref }}"
else:
ref = "${{ github.ref_name }}"
if ref.startswith("track/"):
track = ref.removeprefix("track/")
else:
track = "latest"
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
f.write(f"track={track}\n")
print(f"Track: {track}")
lint:
name: Lint
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: pipx install tox
- run: tox -vve lint
unit:
name: Unit tests
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: pipx install tox
- run: tox -e unit
terraform-checks:
name: Terraform
needs:
- get-charm-paths-track
uses: canonical/charmed-kubeflow-workflows/.github/workflows/terraform-checks.yaml@main
strategy:
matrix:
charm: ${{ fromJSON(needs.get-charm-paths-track.outputs.charm-paths) }}
with:
charm-path: ${{ matrix.charm }}
build:
strategy:
matrix:
charm: ${{ fromJSON(needs.get-charm-paths-track.outputs.charm-paths) }}
name: Build charm | ${{ matrix.charm }}
needs:
- get-charm-paths-track
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v49.0.1
with:
path-to-charm-directory: ${{ matrix.charm }}
cache: true
permissions:
actions: read
contents: read
release:
strategy:
matrix:
charm: ${{ fromJSON(needs.get-charm-paths-track.outputs.charm-paths) }}
name: Release charm to Charmhub branch | ${{ matrix.charm }}
if: ${{ github.event_name == 'pull_request' }}
needs:
- get-charm-paths-track
- build
uses: canonical/data-platform-workflows/.github/workflows/release_charm_pr.yaml@v49.0.1
with:
track: ${{ needs.get-charm-paths-track.outputs.track }}
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
path-to-charm-directory: ${{ matrix.charm }}
secrets:
charmhub-token: ${{ secrets.CHARMCRAFT_CREDENTIALS }}
permissions:
actions: read
contents: read
integration:
name: Integration tests
needs:
- build
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
charm: [kubeflow-dashboard]
test-type: [integration]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: pipx install tox
- name: Setup environment
run: |
sudo apt-get remove -y docker-ce docker-ce-cli containerd.io
sudo rm -rf /run/containerd
sudo snap install concierge --classic
sudo concierge prepare --trace
- name: Download packed charm(s)
id: download-charms
timeout-minutes: 5
uses: actions/download-artifact@v4
with:
pattern: ${{ needs.build.outputs.artifact-prefix }}-*
merge-multiple: true
- name: Integration tests
run: |
tox -vve ${{ matrix.test-type }} -- --model kubeflow --charm-path=${{ github.workspace }}/${{ matrix.charm }}_ubuntu@24.04-amd64.charm
# On failure, capture debugging resources
- name: Get juju status
run: juju status
if: always()
- uses: canonical/kubeflow-ci/actions/dump-charm-debug-artifacts@main
if: failure()