CI #39
This file contains hidden or 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: CI | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| pull_request: | |
| schedule: | |
| - cron: '0 8 * * TUE' | |
| 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-track.outputs.charm-paths }} | |
| track: | |
| description: Charmhub track determined from branch name | |
| value: ${{ jobs.get-charm-paths-track.outputs.track }} | |
| jobs: | |
| get-charm-paths-track: | |
| name: Get charm paths and track | |
| runs-on: ubuntu-latest | |
| outputs: | |
| charm-paths: ${{ steps.get-charm-paths.outputs.charm-paths }} | |
| track: ${{ steps.determine-track.outputs.track }} | |
| 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: Determine track | |
| id: determine-track | |
| shell: python | |
| run: | | |
| import os | |
| if "${{ github.event_name }}" == "pull_request": | |
| ref = "${{ github.base_ref }}" | |
| else: | |
| ref = "${{ github.ref_name }}" | |
| if ref.startswith("track/"): | |
| track = ref.removeprefix("track/") | |
| else: | |
| track = "latest" | |
| with open(os.environ["GITHUB_OUTPUT"], "a") as f: | |
| f.write(f"track={track}\n") | |
| print(f"Track: {track}") | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: pipx install tox | |
| - run: tox -vve lint | |
| unit: | |
| name: Unit tests | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: pipx install tox | |
| - run: tox -e unit | |
| terraform-checks: | |
| name: Terraform | |
| needs: | |
| - get-charm-paths-track | |
| uses: canonical/charmed-kubeflow-workflows/.github/workflows/terraform-checks.yaml@main | |
| strategy: | |
| matrix: | |
| charm: ${{ fromJSON(needs.get-charm-paths-track.outputs.charm-paths) }} | |
| with: | |
| charm-path: ${{ matrix.charm }} | |
| build: | |
| strategy: | |
| matrix: | |
| charm: ${{ fromJSON(needs.get-charm-paths-track.outputs.charm-paths) }} | |
| name: Build charm | ${{ matrix.charm }} | |
| needs: | |
| - get-charm-paths-track | |
| uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v49.0.1 | |
| with: | |
| path-to-charm-directory: ${{ matrix.charm }} | |
| cache: true | |
| permissions: | |
| actions: read | |
| contents: read | |
| release: | |
| strategy: | |
| matrix: | |
| charm: ${{ fromJSON(needs.get-charm-paths-track.outputs.charm-paths) }} | |
| name: Release charm to Charmhub branch | ${{ matrix.charm }} | |
| if: ${{ github.event_name == 'pull_request' }} | |
| needs: | |
| - get-charm-paths-track | |
| - build | |
| uses: canonical/data-platform-workflows/.github/workflows/release_charm_pr.yaml@v49.0.1 | |
| with: | |
| track: ${{ needs.get-charm-paths-track.outputs.track }} | |
| artifact-prefix: ${{ needs.build.outputs.artifact-prefix }} | |
| path-to-charm-directory: ${{ matrix.charm }} | |
| secrets: | |
| charmhub-token: ${{ secrets.CHARMCRAFT_CREDENTIALS }} | |
| permissions: | |
| actions: read | |
| contents: read | |
| integration: | |
| name: Integration tests | |
| needs: | |
| - build | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| charm: [kubeflow-dashboard] | |
| test-type: [integration, integration-ambient] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: pipx install tox | |
| - name: Setup environment | |
| run: | | |
| sudo apt-get remove -y docker-ce docker-ce-cli containerd.io | |
| sudo rm -rf /run/containerd | |
| sudo snap install concierge --classic | |
| sudo concierge prepare --trace | |
| - name: Configure Cilium for Canonical K8s | |
| if: matrix.test-type == 'integration-ambient' | |
| run: | | |
| # for context, see https://docs.cilium.io/en/stable/network/servicemesh/istio/ | |
| kubectl -n kube-system patch configmap cilium-config --type merge --patch '{"data":{"bpf-lb-sock-hostns-only":"true"}}' | |
| kubectl -n kube-system patch configmap cilium-config --type merge --patch '{"data":{"cni-exclusive":"false"}}' | |
| kubectl -n kube-system rollout restart daemonset cilium | |
| - 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: | | |
| tox -vve ${{ matrix.test-type }} -- --model testing --charm-path=${{ github.workspace }}/${{ matrix.charm }}_ubuntu@24.04-amd64.charm | |
| # On failure, capture debugging resources | |
| - name: Get juju status | |
| run: juju status | |
| if: always() | |
| - uses: canonical/kubeflow-ci/actions/dump-charm-debug-artifacts@main | |
| if: failure() |