Skip to content

Commit

Permalink
Create cache without zstd compression
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Harding <[email protected]>
  • Loading branch information
klutchell committed Jul 2, 2024
1 parent 175dc8f commit 773b822
Showing 1 changed file with 9 additions and 78 deletions.
87 changes: 9 additions & 78 deletions .github/workflows/yocto-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,8 @@ jobs:
BARYS_ARGUMENTS_VAR: ""

YOCTO_SHARED_DIR: ${{ github.workspace }}/shared/yocto-cache

DOWNLOADS_CACHE_DIR: ${{ github.workspace }}/shared/yocto-cache/shared-downloads
DOWNLOADS_CACHE_TAR: ${{ github.workspace }}/yocto_dl_cache.tar.zst

SSTATE_CACHE_DIR: ${{ github.workspace }}/shared/yocto-cache/${{ inputs.machine }}/sstate
SSTATE_CACHE_TAR: ${{ github.workspace }}/yocto_sstate_cache.tar.zst

outputs:
os_version: ${{ steps.balena-lib.outputs.os_version }}
Expand Down Expand Up @@ -404,11 +400,6 @@ jobs:
BARYS_ARGUMENTS_VAR="${BARYS_ARGUMENTS_VAR} --bitbake-args --no-setscene"
echo "BARYS_ARGUMENTS_VAR=${BARYS_ARGUMENTS_VAR}" >> $GITHUB_ENV
- name: Install zstd
run: |
sudo apt-get update
sudo apt-get install -y zstd
# https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#list-github-actions-caches-for-a-repository
- name: List Action caches
continue-on-error: true
Expand Down Expand Up @@ -445,41 +436,27 @@ jobs:
# https://github.com/actions/cache
- name: Sync downloads cache
id: yocto-dl-cache
uses: actions/[email protected]
with:
# Run the post step to save the cache even if another step before fails
save-always: true
path: ${{ env.DOWNLOADS_CACHE_TAR }}
key: yocto-shared-downloads
path: ${{ env.DOWNLOADS_CACHE_DIR }}
# Caches are scoped to the current branch, with fallback to the default branch
# See: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows
key: yocto-downloads-${{ inputs.machine }}
restore-keys: |
yocto-shared-downloads
yocto-downloads-
# https://github.com/actions/cache
- name: Sync sstate cache
id: yocto-sstate-cache
uses: actions/[email protected]
with:
# Run the post step to save the cache even if another step before fails
save-always: true
path: ${{ env.SSTATE_CACHE_TAR }}
key: yocto-${{ inputs.machine }}-sstate
restore-keys: |
yocto-${{ inputs.machine }}-sstate
- name: Unpack downloads cache
continue-on-error: true
run: |
mkdir -p "${DOWNLOADS_CACHE_DIR}"
tar -I zstd -xf "${DOWNLOADS_CACHE_TAR}" -C "${DOWNLOADS_CACHE_DIR}"
du -sh "${DOWNLOADS_CACHE_TAR}"
- name: Unpack downloads cache
continue-on-error: true
run: |
mkdir -p "${SSTATE_CACHE_DIR}"
tar -I zstd -xf "${SSTATE_CACHE_TAR}" -C "${SSTATE_CACHE_DIR}"
du -sh "${SSTATE_CACHE_TAR}"
path: ${{ env.SSTATE_CACHE_DIR }}
# Caches are scoped to the current branch, with fallback to the default branch
# See: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows
key: yocto-sstate-${{ inputs.machine }}

# All preperation complete before this step
# Start building balenaOS
Expand Down Expand Up @@ -510,52 +487,6 @@ jobs:
exit 1
fi
- name: Compress downloads cache
run: |
rm -f "${DOWNLOADS_CACHE_TAR}"
tar -I 'zstd -9' -cf "${DOWNLOADS_CACHE_TAR}" -C "${DOWNLOADS_CACHE_DIR}" .
du -sh "${DOWNLOADS_CACHE_TAR}"
- name: Compress sstate cache
run: |
rm -f "${SSTATE_CACHE_TAR}"
tar -I 'zstd -9' -cf "${SSTATE_CACHE_TAR}" -C "${SSTATE_CACHE_DIR}" .
du -sh "${SSTATE_CACHE_TAR}"
# https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#list-github-actions-caches-for-a-repository
- name: List Action caches
continue-on-error: true
env:
# environment variables used by gh CLI
# https://cli.github.com/manual/gh_help_environment
GH_DEBUG: "true"
GH_PAGER: "cat"
GH_PROMPT_DISABLED: "true"
GH_REPO: "${{ github.repository }}"
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/actions/caches
# https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-a-repository
- name: Get Actions cache usage
continue-on-error: true
env:
# environment variables used by gh CLI
# https://cli.github.com/manual/gh_help_environment
GH_DEBUG: "true"
GH_PAGER: "cat"
GH_PROMPT_DISABLED: "true"
GH_REPO: "${{ github.repository }}"
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/actions/cache/usage
# TODO: pre-install on self-hosted-runners
# Needed by the yocto job to zip artifacts - Don't remove
- name: Install zip package
Expand Down

0 comments on commit 773b822

Please sign in to comment.