CI: Use cached builds #13
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
outputs: | |
artifact-prefix: | |
description: build_charm.yaml `artifact-prefix` output | |
value: ${{ jobs.build.outputs.artifact-prefix }} | |
charm-paths: | |
description: paths for all charms in this repo | |
value: ${{ jobs.get-charm-paths-channel.outputs.charm-paths }} | |
channel: | |
description: Charmhub channel the charms are released to | |
value: ${{ jobs.get-charm-paths-channel.outputs.charm-channel }} | |
jobs: | |
lib-check: | |
name: Check libraries | |
strategy: | |
matrix: | |
charm: | |
- katib-controller | |
- katib-db-manager | |
- katib-ui | |
uses: canonical/charmed-kubeflow-workflows/.github/workflows/_quality-checks.yaml@main | |
secrets: inherit | |
with: | |
charm-path: ./charms/${{ matrix.charm }} | |
lint: | |
name: Lint | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- run: python3 -m pip install tox | |
- run: tox -e lint | |
unit: | |
name: Unit tests | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
charm: | |
- katib-controller | |
- katib-db-manager | |
- katib-ui | |
steps: | |
- uses: actions/checkout@v3 | |
- run: python3 -m pip install tox | |
- run: tox -e ${{ matrix.charm }}-unit | |
terraform-checks: | |
name: Terraform | |
uses: canonical/charmed-kubeflow-workflows/.github/workflows/terraform-checks.yaml@main | |
strategy: | |
matrix: | |
charm: | |
- katib-controller | |
- katib-db-manager | |
- katib-ui | |
with: | |
charm-path: ./charms/${{ matrix.charm }} | |
get-charm-paths-channel: | |
name: Get charm paths and charmhub channel | |
runs-on: ubuntu-latest | |
outputs: | |
charm-paths: ${{ steps.get-charm-paths.outputs.charm-paths }} | |
charm-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-channel.outputs.charm-paths) }} | |
name: Build charm | ${{ matrix.charm }} | |
needs: | |
- get-charm-paths-channel | |
uses: canonical/data-platform-workflows/.github/workflows/[email protected] | |
with: | |
path-to-charm-directory: ${{ matrix.charm }} | |
release: | |
strategy: | |
matrix: | |
charm: ${{ fromJSON(needs.get-charm-paths-channel.outputs.charm-paths) }} | |
name: Release charm to Charmhub branch | ${{ matrix.charm }} | |
if: ${{ github.event_name == 'pull_request' }} | |
needs: | |
- get-charm-paths-channel | |
- build | |
uses: canonical/data-platform-workflows/.github/workflows/[email protected] | |
with: | |
channel: ${{ needs.get-charm-paths-channel.outputs.charm-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) | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
charm: | |
- katib-controller | |
- katib-db-manager | |
- katib-ui | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup operator environment | |
uses: charmed-kubernetes/actions-operator@main | |
with: | |
provider: microk8s | |
channel: 1.31-strict/stable | |
juju-channel: 3.6/stable | |
charmcraft-channel: 3.x/stable | |
- name: Download packed charm(s) | |
id: download-charms | |
timeout-minutes: 5 | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: ${{ needs.build.outputs.artifact-prefix }}-* | |
merge-multiple: true | |
- name: Integration tests | |
run: | | |
sg snap_microk8s -c "tox -e ${{ matrix.charm }}-integration -- -- --model testing" | |
# Collect debug logs if failed | |
- name: Dump Juju/k8s logs on failure | |
uses: canonical/kubeflow-ci/actions/dump-charm-debug-artifacts@main | |
if: failure() | |
- name: Dump logs | |
if: failure() | |
uses: canonical/charming-actions/[email protected] | |
test-bundle: | |
name: Test the bundle | |
runs-on: ubuntu-20.04 | |
steps: | |
# Ideally we'd use self-hosted runners, but this effort is still not stable. | |
# This action will remove unused software (dotnet, haskell, android libs, codeql, | |
# and docker images) from the GH runner, which will liberate around 60 GB of storage | |
# distributed in 40GB for root and around 20 for a mnt point. | |
- name: Maximise GH runner space | |
uses: easimon/maximize-build-space@v7 | |
with: | |
root-reserve-mb: 29696 | |
remove-dotnet: 'true' | |
remove-haskell: 'true' | |
remove-android: 'true' | |
remove-codeql: 'true' | |
remove-docker-images: 'true' | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Setup operator environment | |
uses: charmed-kubernetes/actions-operator@main | |
with: | |
provider: microk8s | |
channel: 1.31-strict/stable | |
juju-channel: 3.6/stable | |
microk8s-addons: "dns storage rbac" | |
- name: Download packed charm(s) | |
id: download-charms | |
timeout-minutes: 5 | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: ${{ needs.build.outputs.artifact-prefix }}-* | |
merge-multiple: true | |
- name: Run test | |
run: | | |
# Requires the model to be called kubeflow due to kfp-viewer | |
juju add-model kubeflow --config default-series=focal | |
sg snap_microk8s -c "tox -e bundle-integration -- --model kubeflow" | |
- name: Get pod statuses | |
run: kubectl get all -A | |
if: failure() | |
- name: Get juju status | |
run: juju status | |
if: failure() | |
- name: Get katib-controller workload logs | |
run: kubectl logs --tail 100 -nkubeflow -lapp.kubernetes.io/name=katib-controller | |
if: failure() | |
- name: Get katib-controller operator logs | |
run: kubectl logs --tail 100 -nkubeflow -loperator.juju.is/name=katib-controller | |
if: failure() | |
- name: Get katib-ui workload logs | |
run: kubectl logs --tail 100 -nkubeflow -lapp.kubernetes.io/name=katib-ui | |
if: failure() | |
- name: Get katib-ui operator logs | |
run: kubectl logs --tail 100 -nkubeflow -loperator.juju.is/name=katib-ui | |
if: failure() | |
- name: Get katib-db-manager workload logs | |
run: kubectl logs --tail 100 -nkubeflow -lapp.kubernetes.io/name=katib-db-manager | |
if: failure() | |
- name: Get katib-db-manager operator logs | |
run: kubectl logs --tail 100 -nkubeflow -loperator.juju.is/name=katib-db-manager | |
if: failure() | |
- name: Upload charmcraft logs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: charmcraft-logs | |
path: /tmp/charmcraft-log-* | |
if: failure() |