Skip to content

Update actions/setup-go action to v6 - autoclosed #2804

Update actions/setup-go action to v6 - autoclosed

Update actions/setup-go action to v6 - autoclosed #2804

# 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
jobs:
lib-check:
name: Check charm libraries
runs-on: ubuntu-24.04
strategy:
matrix:
charm: [backend, frontend]
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Check libs
uses: canonical/charming-actions/check-libraries@1753e0803f70445132e92acd45c905aba6473225 # 2.7.0
with:
credentials: "${{ secrets.CHARMHUB_TOKEN }}"
github-token: "${{ secrets.GITHUB_TOKEN }}"
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@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Setup LXD
uses: canonical/setup-lxd@v0.1.3
with:
channel: 5.21/stable
- name: Install charmcraft
run: sudo snap install charmcraft --channel=3.x/stable --classic
- name: Cache wheels
id: cache-wheels
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # 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@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- 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@v0.1.3
with:
channel: 5.21/stable
- name: Setup Go
uses: actions/setup-go@v6.3.0
with:
go-version: 1.26.1
- 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/