skip: add charmcraft cache #332
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
# reusable workflow triggered by other actions | ||
name: CI | ||
on: | ||
workflow_call: | ||
secrets: | ||
CHARMCRAFT_CREDENTIALS: | ||
required: true | ||
jobs: | ||
lib-check: | ||
name: Check libraries | ||
strategy: | ||
matrix: | ||
charm: | ||
- kfp-api | ||
- kfp-metadata-writer | ||
- kfp-persistence | ||
- kfp-profile-controller | ||
- kfp-schedwf | ||
- kfp-ui | ||
- kfp-viewer | ||
- kfp-viz | ||
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 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
charm: | ||
- kfp-api | ||
- kfp-metadata-writer | ||
- kfp-persistence | ||
- kfp-profile-controller | ||
- kfp-schedwf | ||
- kfp-ui | ||
- kfp-viewer | ||
- kfp-viz | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: python3 -m pip install tox | ||
- run: tox -e ${{ matrix.charm }}-lint | ||
unit: | ||
name: Unit tests | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
charm: | ||
- kfp-api | ||
- kfp-metadata-writer | ||
- kfp-persistence | ||
- kfp-profile-controller | ||
- kfp-schedwf | ||
- kfp-ui | ||
- kfp-viewer | ||
- kfp-viz | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: python3 -m pip install tox | ||
- run: tox -e ${{ matrix.charm }}-unit | ||
integration: | ||
name: Integration tests (microk8s) | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
charm: | ||
- kfp-persistence | ||
- kfp-profile-controller | ||
- kfp-api | ||
- kfp-schedwf | ||
- kfp-viewer | ||
- kfp-ui | ||
- kfp-metadata-writer | ||
- kfp-viz | ||
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. | ||
# This leaves ~45GB free as of 2024-04-10, but this amount has varied as GH changed their | ||
# runners | ||
- name: Maximise GH runner space | ||
uses: jlumbroso/[email protected] | ||
- uses: actions/checkout@v3 | ||
- name: Setup operator environment | ||
uses: charmed-kubernetes/actions-operator@main | ||
with: | ||
provider: microk8s | ||
channel: 1.29-strict/stable | ||
juju-channel: 3.4/stable | ||
charmcraft-channel: latest/candidate | ||
- name: Integration tests | ||
run: | | ||
# Requires the model to be called kubeflow due to | ||
# https://github.com/canonical/kfp-operators/issues/389 | ||
juju add-model kubeflow | ||
sg snap_microk8s -c "tox -e ${{ matrix.charm }}-integration -- --model kubeflow" | ||
- name: Collect charm debug artifacts | ||
uses: canonical/kubeflow-ci/actions/dump-charm-debug-artifacts@main | ||
if: always() | ||
test-bundle: | ||
name: Test the bundle | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
sdk: | ||
- v1 | ||
- v2 | ||
steps: | ||
# This is a workaround for https://github.com/canonical/kfp-operators/issues/250 | ||
# 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. | ||
# This leaves ~45GB free as of 2024-04-10, but this amount has varied as GH changed their | ||
# runners | ||
- name: Maximise GH runner space | ||
uses: jlumbroso/[email protected] | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
- name: Setup Charmcraft's pip cache | ||
id: cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: /home/runner/snap/charmcraft/common/cache/charmcraft/ | ||
# Cache keys must be unique - there is no overwrite mechanic. Add IDs to avoid this (is there a better set of IDs?) | ||
# partial ref: https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache | ||
# To match the most recent previous cache, use restore-keys with the craft-shared-cache prefix. This will hit the | ||
# "first" match, which will be from the most recent run. | ||
# ref: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key | ||
key: craft-shared-cache-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}-${{ strategy.job-index }} | ||
restore-keys: craft-shared-cache | ||
- name: Setup operator environment | ||
uses: charmed-kubernetes/actions-operator@main | ||
with: | ||
provider: microk8s | ||
channel: 1.29-strict/stable | ||
juju-channel: 3.4/stable | ||
charmcraft-channel: latest/candidate | ||
microk8s-addons: "dns hostpath-storage rbac metallb:10.64.140.43-10.64.140.49" | ||
- name: Run test | ||
run: | | ||
# Requires the model to be called kubeflow due to kfp-viewer | ||
juju add-model kubeflow | ||
sg snap_microk8s -c "tox -e bundle-integration-${{ matrix.sdk }} -- --model kubeflow --bundle=./tests/integration/bundles/kfp_latest_edge.yaml.j2" | ||
- name: Get all | ||
run: kubectl get all -A | ||
if: failure() | ||
- name: Get juju status | ||
run: juju status | ||
if: failure() | ||
- name: Collect charm debug artifacts | ||
uses: canonical/kubeflow-ci/actions/dump-charm-debug-artifacts@main | ||
if: always() |