Skip to content

Commit

Permalink
ci: remove wrapper around get charm paths and build with cache workfl…
Browse files Browse the repository at this point in the history
…ows (#651)

* ci: remove wrapper around get charm paths and build with cache workflows

This commit removes the extra abstraction of the get-charm-paths action and
build_charm.yaml reusable workflow to avoid potential incompatibilities
and sync issues with the data platforms workflows.

* update workflows for dpw v29

* fix: use correct artifact name

* nit: address comments for consistency with data repos
---------

Co-authored-by: NohaIhab <[email protected]>
  • Loading branch information
DnPlas and NohaIhab authored Jan 21, 2025
1 parent 9df3478 commit 1a58b13
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 8 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ on:
secrets:
CHARMCRAFT_CREDENTIALS:
required: true
inputs:
artifact-prefix:
description: |
Prefix for charm package GitHub artifact(s)
Use canonical/data-platform-workflows build_charm.yaml to build the charm(s)
required: true
type: string

jobs:
lib-check:
Expand Down Expand Up @@ -126,7 +134,7 @@ jobs:
timeout-minutes: 5
uses: actions/download-artifact@v4
with:
pattern: packed-charm-cache-true-.-charms-${{ matrix.charm }}-*
pattern: ${{ inputs.artifact-prefix }}-*
merge-multiple: true

- name: Integration tests
Expand All @@ -137,7 +145,7 @@ jobs:
# Pass the path where the charm artefact is downloaded to the tox command
# FIXME: Right now the complete path is half hardcoded to <charm name>_ubuntu-20.04-amd64.charm
# We need to find a better way to dynamically get this value
sg snap_microk8s -c "tox -e ${{ matrix.charm }}-integration -- --model kubeflow --charm-path=${{ github.workspace }}/charms/${{ matrix.charm }}/${{ matrix.charm }}_ubuntu-20.04-amd64.charm"
sg snap_microk8s -c "tox -e ${{ matrix.charm }}-integration -- --model kubeflow --charm-path=${{ github.workspace }}/charms/${{ matrix.charm }}/${{ matrix.charm }}_ubuntu@20.04-amd64.charm"
- name: Collect charm debug artifacts
uses: canonical/kubeflow-ci/actions/dump-charm-debug-artifacts@main
Expand Down
33 changes: 28 additions & 5 deletions .github/workflows/on_pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,42 @@ on:
pull_request:

jobs:
get-paths-and-build:
name: Get charm paths and build with cache
uses: canonical/charmed-kubeflow-workflows/.github/workflows/get_charms_build_with_cache.yaml@main
get-charm-paths:
name: Generate the Charm Matrix content
runs-on: ubuntu-latest
outputs:
charm-paths: ${{ steps.get-charm-paths.outputs.charm-paths }}
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

build:
strategy:
matrix:
charm: ${{ fromJSON(needs.get-charm-paths.outputs.charm-paths) }}
name: Build charm | ${{ matrix.charm }}
needs:
- get-charm-paths
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
with:
charmcraft-snap-channel: latest/candidate # TODO: remove after charmcraft 3.3 stable release
path-to-charm-directory: ${{ matrix.charm }}

tests:
name: Run Tests
needs: [get-paths-and-build]
needs: build
uses: ./.github/workflows/integrate.yaml
secrets: inherit
with:
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}

# publish runs in parallel with tests, as we always publish in this situation
publish-charm:
name: Publish Charm
needs: [get-paths-and-build]
needs: build
uses: ./.github/workflows/publish.yaml
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
strategy:
fail-fast: false
matrix:
charm-path: ${{ fromJson(needs.get-charm-paths.outputs.charm_paths_list) }}
charm-path: ${{ fromJSON(needs.get-charm-paths.outputs.charm_paths_list) }}

steps:
- name: Checkout
Expand Down

0 comments on commit 1a58b13

Please sign in to comment.