Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions .github/workflows/_charm-quality-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ on:
Sets the `automatically-retry-hooks` in the model-defaults config.
required: true
type: boolean
integration-tests-runners:
description: |
Json matrix of the runners to use to run the integration tests for the charm.
Example: ["ubuntu-latest","Ubuntu_ARM64_4C_16G_03"]
type: string
required: false
default: '["ubuntu-latest"]'
secrets:
CHARMHUB_TOKEN:
required: false
Expand Down Expand Up @@ -164,7 +171,10 @@ jobs:

pack-charm:
name: Pack the charm
runs-on: ubuntu-latest
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: ${{ fromJSON(inputs.integration-tests-runners) }}
needs:
- linting
- linting-rules
Expand Down Expand Up @@ -194,13 +204,16 @@ jobs:
- name: Upload charm artifact
uses: actions/upload-artifact@v4
with:
name: charms-tests${{ (inputs.charm-path && inputs.charm-path != '.') && format('-{0}', inputs.charm-path) || '' }}
name: charms-tests-${{ runner.arch }}${{ (inputs.charm-path && inputs.charm-path != '.') && format('-{0}', inputs.charm-path) || '' }}
path: ${{ inputs.charm-path }}/*.charm

integration-mono:
name: Integration Tests (sequential)
if: ${{ ! inputs.parallelize-integration }}
runs-on: ubuntu-latest
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: ${{ fromJSON(inputs.integration-tests-runners) }}
needs: [snap-channels, pack-charm]
env:
CONCIERGE_JUJU_CHANNEL: ${{ needs.snap-channels.outputs.juju-channel }}
Expand All @@ -218,7 +231,7 @@ jobs:
- name: Download charm artifact
uses: actions/download-artifact@v4
with:
name: charms-tests${{ (inputs.charm-path && inputs.charm-path != '.') && format('-{0}', inputs.charm-path) || '' }}
name: charms-tests-${{ runner.arch }}${{ (inputs.charm-path && inputs.charm-path != '.') && format('-{0}', inputs.charm-path) || '' }}
path: ${{ inputs.charm-path }}
- name: Run integration tests
run: |
Expand Down Expand Up @@ -249,12 +262,13 @@ jobs:
integration-test:
name: Integration Tests (parallel)
if: ${{ inputs.parallelize-integration }}
runs-on: ubuntu-latest
runs-on: ${{ matrix.runner }}
needs: [snap-channels, pack-charm, integration-matrix]
strategy:
fail-fast: false
matrix:
suite: ${{ fromJSON(needs.integration-matrix.outputs.suites) }}
runner: ${{ fromJSON(inputs.integration-tests-runners) }}
env:
CONCIERGE_JUJU_CHANNEL: ${{ needs.snap-channels.outputs.juju-channel }}
CONCIERGE_MICROK8S_CHANNEL: 1.32-strict/stable
Expand All @@ -271,7 +285,7 @@ jobs:
- name: Download charm artifact
uses: actions/download-artifact@v4
with:
name: charms-tests${{ (inputs.charm-path && inputs.charm-path != '.') && format('-{0}', inputs.charm-path) || '' }}
name: charms-tests-${{ runner.arch }}${{ (inputs.charm-path && inputs.charm-path != '.') && format('-{0}', inputs.charm-path) || '' }}
path: ${{ inputs.charm-path }}
- name: Run integration tests
run: |
Expand Down
31 changes: 30 additions & 1 deletion .github/workflows/charm-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,32 @@ jobs:
echo "Modified files: ${{ steps.changed-files.outputs.all_modified_files }}"
echo "any_modified=${{ steps.changed-files.outputs.any_modified }}" >> "$GITHUB_OUTPUT"

define-matrix:
name: Define runner matrix
runs-on: ubuntu-latest
needs: [ci-ignore]
if: needs.ci-ignore.outputs.any_modified == 'true'
outputs:
runners: ${{ steps.runner-matrix.outputs.runners }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo snap install yq
- name: Define runner matrix
id: runner-matrix
run: |
cd "${{ inputs.charm-path }}"
runners="$( \
yq -o json '.platforms | to_entries | map(.key)' charmcraft.yaml | \
sed 's/".*amd64.*"/"ubuntu-latest"/' | \
sed 's/".*arm64.*"/"self-hosted-linux-arm64-noble-medium"/' | \
jq -rc 'unique' \
)"
echo "runners=$runners"
echo "runners=$runners" >> "$GITHUB_OUTPUT"

lib-check:
name: Check libraries # Check if the charm libraries are updated and add the relevant label to the PR
runs-on: ubuntu-latest
Expand Down Expand Up @@ -115,8 +141,10 @@ jobs:
name: Quality Checks
needs:
- ci-ignore
- define-matrix
if: needs.ci-ignore.outputs.any_modified == 'true'
uses: canonical/observability/.github/workflows/_charm-quality-checks.yaml@v1
# FIXME: point at v1
uses: canonical/observability/.github/workflows/_charm-quality-checks.yaml@OPENG-3328
secrets: inherit
with:
charm-path: ${{ inputs.charm-path }}
Expand All @@ -125,4 +153,5 @@ jobs:
juju-channel: ${{ inputs.juju-channel }}
parallelize-integration: ${{ inputs.parallelize-integration }}
automatically-retry-hooks: ${{ inputs.automatically-retry-hooks }}
integration-tests-runners: ${{ needs.define-matrix.outputs.runners }}

6 changes: 4 additions & 2 deletions .github/workflows/charm-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
runners="$( \
yq -o json '.platforms | to_entries | map(.key)' charmcraft.yaml | \
sed 's/".*amd64.*"/"ubuntu-latest"/' | \
sed 's/".*arm64.*"/"Ubuntu_ARM64_4C_16G_03"/' | \
sed 's/".*arm64.*"/"self-hosted-linux-arm64-noble-medium"/' | \
jq -rc 'unique' \
)"
echo "runners=$runners"
Expand All @@ -135,7 +135,8 @@ jobs:

quality-checks:
name: Quality Checks
uses: canonical/observability/.github/workflows/_charm-quality-checks.yaml@v1
# FIXME: point at v1
uses: canonical/observability/.github/workflows/_charm-quality-checks.yaml@OPENG-3328
needs: [define-matrix]
secrets: inherit
with:
Expand All @@ -145,6 +146,7 @@ jobs:
juju-channel: ${{ inputs.juju-channel }}
parallelize-integration: ${{ inputs.parallelize-integration }}
automatically-retry-hooks: ${{ inputs.automatically-retry-hooks }}
integration-tests-runners: "${{ needs.define-matrix.outputs.runners }}"

release-charm:
name: Release the charm
Expand Down