-
Notifications
You must be signed in to change notification settings - Fork 11
176 lines (152 loc) · 5.63 KB
/
charm_integration_test.yml
File metadata and controls
176 lines (152 loc) · 5.63 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# Copyright 2025 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-FileCopyrightText: Copyright 2025 Canonical Ltd.
# SPDX-License-Identifier: Apache-2.0
name: Charm integration tests
on:
workflow_call:
secrets:
CHARMHUB_TOKEN:
required: true
push:
branches:
- main
tags:
- v*
pull_request:
paths:
- .github/workflows/charm_integration_test.yml
- backend/charm/**
- frontend/charm/**
- spread/**
- spread.yaml
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true
permissions: {}
jobs:
lib-check:
name: Check charm libraries
runs-on: ubuntu-24.04
strategy:
matrix:
charm: [backend, frontend]
permissions:
pull-requests: write # Needed for the library check to add labels
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Check libs
uses: canonical/charming-actions/check-libraries@1753e0803f70445132e92acd45c905aba6473225 # 2.7.0
with:
# Ignoring until we set up environments
credentials: "${{ secrets.CHARMHUB_TOKEN }}" # zizmor: ignore[secrets-outside-env]
github-token: "${{ secrets.GITHUB_TOKEN }}" # zizmor: ignore[secrets-outside-env]
charm-path: "${{ matrix.charm }}/charm"
pack-charm:
name: Build charm
runs-on: ubuntu-24.04
strategy:
matrix:
charm: [backend, frontend]
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Setup LXD
uses: canonical/setup-lxd@8c6a87bfb56aa48f3fb9b830baa18562d8bfd4ee # v1
with:
channel: 5.21/stable
- name: Install charmcraft
run: sudo snap install charmcraft --channel=3.x/stable --classic
- name: Cache wheels
id: cache-wheels
# Ignoring the zizmor error since these artifacts are not used in releases,
# but we may want to revisit this to actually address the zizmor complaint
uses: actions/cache@565629816435f6c0b50676926c9b05c254113c0c # zizmor: ignore[cache-poisoning] Hash points to v4
with:
path: /home/runner/snap/charmcraft/common/cache/charmcraft
key: ${{ runner.os }}-wheel-cache-${{ hashFiles('./uv.lock') }}
restore-keys: |
${{ runner.os }}-wheel-cache-
- name: Pack charm
run: charmcraft pack -v
working-directory: "${{ matrix.charm }}/charm"
- name: Upload charm artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: ${{ matrix.charm }}-charm
path: "${{ matrix.charm }}/charm/*.charm"
- name: Upload charmcraft logs
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: charmcraft-logs-spread-integration
path: /home/ubuntu/.local/state/charmcraft/log/*
integration-test:
name: Spread Integration Test
runs-on: ubuntu-24.04
needs:
- lib-check
- pack-charm
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Download backend charm artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: backend-charm
path: ${{ github.workspace }}/backend/charm
- name: Download frontend charm artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: frontend-charm
path: ${{ github.workspace }}/frontend/charm
- name: Setup LXD
uses: canonical/setup-lxd@8c6a87bfb56aa48f3fb9b830baa18562d8bfd4ee # v1
with:
channel: 5.21/stable
- name: Setup Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version: 1.26.1
cache: false
- name: Install spread
run: |
go install github.com/snapcore/spread/cmd/spread@latest
- name: Run integration tests
run: |
spread -v -artifacts=./artifacts localhost
- name: Sanitize Artifacts Paths
if: failure()
run: |
# When using spread -artifacts=<path/to/artifacts>,
# artifacts are generated with paths in the form <backend>:<system>:<suite>/task/artifact
# The upload-artifact action does not allow ':' in paths, so we need to sanitize them
for ARTIFACT_PATH in $(ls -1 ./artifacts/); do
SANITIZED_PATH=$(echo "${ARTIFACT_PATH}" | tr ':' '-')
mv "artifacts/${ARTIFACT_PATH}" "artifacts/${SANITIZED_PATH}"
done
- name: Upload spread artifacts
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: spread-artifacts
path: ./artifacts/