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

update integration CI to preserve charmcraft's cache between builds #366

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
56 changes: 56 additions & 0 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ jobs:
strategy:
matrix:
charm: [controller, ui]
env:
CRAFT_SHARED_CACHE: /home/runner/snap/charmcraft/common/cache/charmcraft/
steps:
- name: Check out code
uses: actions/checkout@v3
Expand All @@ -50,8 +52,34 @@ jobs:
microk8s-addons: "dns storage rbac metallb:10.64.140.43-10.64.140.49"
juju-channel: 3.1/stable

- name: Setup Charmcraft's cache
id: cache
uses: actions/cache@v4
with:
path: ${{ env.CRAFT_SHARED_CACHE }}
# 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

# DEBUG: remove this after testing
- name: emit charmcraft cache directory contents
run: |
find $CRAFT_SHARED_CACHE | wc -l
find $CRAFT_SHARED_CACHE/wheels | wc -l

- run: tox -e ${{ matrix.charm }}-integration

# DEBUG: remove this after testing
- name: emit charmcraft cache directory contents
run: |
find $CRAFT_SHARED_CACHE | wc -l
find $CRAFT_SHARED_CACHE/wheels | wc -l


lint:
name: Lint Code
runs-on: ubuntu-20.04
Expand All @@ -67,6 +95,8 @@ jobs:
bundle-integration:
name: Bundle Integration
runs-on: ubuntu-20.04
env:
CRAFT_SHARED_CACHE: /home/runner/snap/charmcraft/common/cache/charmcraft/
steps:
- name: Check out code
uses: actions/checkout@v3
Expand All @@ -79,6 +109,26 @@ jobs:
microk8s-addons: "dns storage rbac ingress metallb:10.64.140.43-10.64.140.49"
juju-channel: 3.1/stable


- name: Setup Charmcraft's cache
id: cache
uses: actions/cache@v4
with:
path: ${{ env.CRAFT_SHARED_CACHE }}
# 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

# DEBUG: remove this after testing
- name: emit charmcraft cache directory contents
run: |
find $CRAFT_SHARED_CACHE | wc -l
find $CRAFT_SHARED_CACHE/wheels | wc -l

- name: Run test
run: |
sudo apt install tar wget
Expand All @@ -89,6 +139,12 @@ jobs:
juju add-model kubeflow
sg snap_microk8s -c "tox -e integration -- --model kubeflow"

# DEBUG: remove this after testing
- name: emit charmcraft cache directory contents
run: |
find $CRAFT_SHARED_CACHE | wc -l
find $CRAFT_SHARED_CACHE/wheels | wc -l

- run: kubectl get all -A
if: failure()

Expand Down
Loading