Skip to content

Commit

Permalink
Added cache back
Browse files Browse the repository at this point in the history
  • Loading branch information
EduMenges committed Nov 11, 2024
1 parent 5005d98 commit bdfb0eb
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions .github/workflows/build-targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,12 @@ jobs:
targets_to_update=()
sha_of_targets_to_update=()
build_directories_of_targets_to_update=()
skipped_targets=()
up_to_date_targets=()
for target in "${!target_shas[@]}"; do
if [[ -v release_shas["$target"] && "${target_shas[$target]}" == "${release_shas[$target]}" ]]; then
echo "Skipping $target due to same SHA from release"
skipped_targets+=("${target}")
up_to_date_targets+=("${target}")
else
echo "Adding $target to the update list"
targets_to_update+=("${target}")
Expand All @@ -204,9 +204,28 @@ jobs:
echo "TARGETS_TO_UPDATE=${targets_to_update[@]}" >>$GITHUB_ENV
echo "SHA_OF_TARGETS_TO_UPDATE=${sha_of_targets_to_update[@]}" >>$GITHUB_ENV
echo "BUILD_DIRECTORIES_OF_TARGETS_TO_UPDATE=${build_directories_of_targets_to_update[@]}" >>$GITHUB_ENV
echo "SKIPPED_TARGETS=${skipped_targets}" >>$GITHUB_ENV
echo "UP_TO_DATE_TARGETS=${up_to_date_targets}" >>$GITHUB_ENV
shell: bash

- name: Download up to date targets
working-directory: ${{env.BUILD_DIRECTORY}}
run: |
up_to_date_targets=($UP_TO_DATE_TARGETS)
for target in "${up_to_date_targets[@]}"; do
compressed_target="${target}-lib.tar.gz"
echo Downloading ${compressed_target}
gh release download ${RELEASE_TAG} --pattern "${COMPRESSED_TARGET}" --clobber
done
shell: bash

- name: Restore `src` directories
uses: actions/cache@v4
with:
path: ${{env.BUILD_DIRECTORY}}/*/src
key: ${{env.RELEASE_TAG}}-src
restore-keys: ${{env.RELEASE_TAG}}-src

- name: Build targets in POSIX hosts
working-directory: ${{env.BUILD_DIRECTORY}}
if: ${{matrix.host != 'windows-latest'}}
Expand Down Expand Up @@ -265,3 +284,9 @@ jobs:
echo "$json_data" >release.json
gh release upload --clobber ${RELEASE_TAG} release.json
shell: bash

- name: Save `src` directories
uses: actions/cache@v4
with:
path: ${{env.BUILD_DIRECTORY}}/*/src
key: ${{env.RELEASE_TAG}}-src

0 comments on commit bdfb0eb

Please sign in to comment.