diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index c354cb37..44c0489c 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -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 @@ -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 @@ -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 }} @@ -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: | @@ -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 @@ -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: | diff --git a/.github/workflows/charm-pull-request.yaml b/.github/workflows/charm-pull-request.yaml index 2e67d6a1..63ea7e2a 100644 --- a/.github/workflows/charm-pull-request.yaml +++ b/.github/workflows/charm-pull-request.yaml @@ -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 @@ -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 }} @@ -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 }} diff --git a/.github/workflows/charm-release.yaml b/.github/workflows/charm-release.yaml index a4b044d6..3a2a4967 100644 --- a/.github/workflows/charm-release.yaml +++ b/.github/workflows/charm-release.yaml @@ -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" @@ -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: @@ -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