Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use single (cached) build for integration tests & release #655

Closed
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
83 changes: 68 additions & 15 deletions .github/workflows/integrate.yaml → .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# reusable workflow triggered by other actions
name: CI
name: Tests

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
schedule:
- cron: '0 8 * * TUE'
# Triggered on push by .github/workflows/release.yaml
workflow_call:
secrets:
CHARMCRAFT_CREDENTIALS:
required: true
inputs:
outputs:
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
description: build_charm.yaml `artifact-prefix` output
value: ${{ jobs.build.outputs.artifact-prefix }}
charm-paths:
value: ${{ jobs.get-charm-paths.outputs.charm-paths }}
channel:
value: ${{ jobs.get-charm-paths.outputs.channel }}

jobs:
lib-check:
Expand Down Expand Up @@ -94,9 +98,58 @@ jobs:
# So the model's name must be kubeflow
# See: https://github.com/kubeflow/kubeflow/issues/6136
model: kubeflow


get-charm-paths:
name: Generate the Charm Matrix content
runs-on: ubuntu-latest
outputs:
charm-paths: ${{ steps.get-charm-paths.outputs.charm-paths }}
channel: ${{ steps.select-channel.outputs.name }}
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
- name: Select charmhub channel
uses: canonical/charming-actions/[email protected]
id: select-channel

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 }}

release:
strategy:
matrix:
charm: ${{ fromJSON(needs.get-charm-paths.outputs.charm-paths) }}
name: Release charm to Charmhub branch | ${{ matrix.charm }}
if: ${{ github.event_name == 'pull_request' }}
needs:
- build
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
with:
charmcraft-snap-channel: latest/candidate # TODO: remove after charmcraft 3.3 stable release
channel: ${{ needs.get-charm-paths.outputs.channel }}
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
path-to-charm-directory: ${{ matrix.charm }}
create-git-tags: false
secrets:
charmhub-token: ${{ secrets.CHARMCRAFT_CREDENTIALS }}

integration:
name: Integration tests (microk8s)
needs:
- build
runs-on: ubuntu-20.04
strategy:
fail-fast: false
Expand Down Expand Up @@ -134,7 +187,7 @@ jobs:
timeout-minutes: 5
uses: actions/download-artifact@v4
with:
pattern: ${{ inputs.artifact-prefix }}-*
pattern: ${{ needs.build.outputs.artifact-prefix }}-*
merge-multiple: true

- name: Integration tests
Expand All @@ -143,7 +196,7 @@ jobs:
# https://github.com/canonical/kfp-operators/issues/389
juju add-model kubeflow
# 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
# 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 }}[email protected]"

Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/get-charm-paths.sh

This file was deleted.

49 changes: 0 additions & 49 deletions .github/workflows/on_pull_request.yaml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/on_push.yaml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/promote.yaml
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed from release.yaml

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# reusable workflow triggered manually
name: Promote charm to other tracks and channels

on:
workflow_dispatch:
inputs:
destination-channel:
description: 'Destination Channel'
required: true
origin-channel:
description: 'Origin Channel'
required: true
charm-name:
description: 'Charm subdirectory name'
required: true

jobs:
promote-charm:
name: Promote charm
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Release charm to channel
# TODO: use canonical/charming-actions/promote-charm?
uses: canonical/charming-actions/[email protected]
Comment on lines +24 to +25
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

promote-charm looks like a new action that might work better here? not sure

with:
credentials: ${{ secrets.CHARMCRAFT_CREDENTIALS }}
github-token: ${{ secrets.GITHUB_TOKEN }}
destination-channel: ${{ github.event.inputs.destination-channel }}
origin-channel: ${{ github.event.inputs.origin-channel }}
tag-prefix: ${{ github.event.inputs.charm-name }}
charm-path: charms/${{ github.event.inputs.charm-name}}
94 changes: 0 additions & 94 deletions .github/workflows/publish.yaml

This file was deleted.

Loading
Loading