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 #412

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
30 changes: 29 additions & 1 deletion .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
name: Integration Test
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
microk8s-versions:
- 1.25-strict/stable
Expand All @@ -53,6 +54,8 @@ jobs:
- integration
- integration-tls-provider
- integration-tls-secret
env:
CRAFT_SHARED_CACHE: /home/runner/snap/charmcraft/common/cache/charmcraft/
steps:
- name: Check out repo
uses: actions/checkout@v4
Expand All @@ -66,12 +69,37 @@ jobs:
juju-channel: 3.1/stable
charmcraft-channel: latest/candidate

- 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 integration tests
run: |
juju add-model test-istio
tox -e ${{ matrix.integration-types }} -- --model test-istio
timeout-minutes: 80


# 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: Setup Debug Artifact Collection
run: mkdir tmp
if: failure()
Expand Down
Loading