-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add much more comprehensive cache testing
- Loading branch information
Showing
2 changed files
with
193 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
name: Caching tests | ||
|
||
on: [push, pull_request] | ||
|
||
# Ensure there's only a single version of this running in any repo, so one set | ||
# of tests won't create or destroy caches that interfere with another run. | ||
concurrency: caches | ||
|
||
jobs: | ||
clear-caches: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: write | ||
steps: | ||
# This will only delete up to 100 caches. That should be far more than | ||
# is ever needed. | ||
- name: Delete cache entries | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const response = await github.rest.actions.getActionsCacheList({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
per_page: 100, | ||
key: 'cygwin-install-action-packages-' | ||
}); | ||
for (const cache of response.data.actions_caches) { | ||
await github.rest.actions.deleteActionsCacheById({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
cache_id: cache.id | ||
}); | ||
} | ||
test-caching: | ||
runs-on: windows-latest | ||
|
||
needs: clear-caches | ||
|
||
# Ordering is important here to ensure the correct things are in the | ||
# correct caches at the correct times. | ||
# | ||
# This also relies on having six Cygwin packages that don't have any | ||
# cross-dependencies (and ideally are small and have few dependencies of | ||
# their own), so we can distinguish what's cached at what step. | ||
# | ||
# We test for the correct behaviour in the following circumstances: | ||
# | ||
# option | saves | restores | ||
# ------------+---------+---------- | ||
# disabled | no (1) | no (5) | ||
# enabled | yes (2) | yes (6) | ||
# saveonly | yes (3) | no (7) | ||
# restoreonly | no (4) | yes (8) | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Cygwin + bash_completion, no caching | ||
uses: ./ | ||
with: | ||
packages: bash-completion | ||
package-cache: disabled | ||
|
||
- name: Delete the Cygwin installation and downloaded packages | ||
run: | | ||
Remove-Item -Force -Recurse C:\cygwin | ||
Remove-Item -Force -Recurse C:\cygwin-packages | ||
Remove-Item -Force -Recurse C:\cygwin-packages-checksum.* | ||
- name: Install Cygwin + brotli, with caching | ||
uses: ./ | ||
with: | ||
packages: brotli | ||
package-cache: enabled | ||
|
||
# This assumes 6 and tests 1 | ||
- name: Ensure bash-completion not downloaded | ||
shell: C:\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -o igncr {0} | ||
run: | | ||
for file in /cygdrive/c/cygwin-packages/*/*/*/*/bash-completion-*.tar.*; do | ||
[[ -f "$file" ]] && exit 1 | ||
done | ||
exit 0 | ||
- name: Delete the Cygwin installation and downloaded packages | ||
run: | | ||
Remove-Item -Force -Recurse C:\cygwin | ||
Remove-Item -Force -Recurse C:\cygwin-packages | ||
Remove-Item -Force -Recurse C:\cygwin-packages-checksum.* | ||
- name: Install Cygwin + libyajl2, with caching | ||
uses: ./ | ||
with: | ||
packages: libyajl2 | ||
package-cache: enabled | ||
|
||
# This tests 2 and 6 | ||
- name: Ensure brotli downloaded | ||
shell: C:\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -o igncr {0} | ||
run: | | ||
for file in /cygdrive/c/cygwin-packages/*/*/*/*/brotli-*.tar.*; do | ||
[[ -f "$file" ]] && exit 0 | ||
done | ||
exit 1 | ||
- name: Delete the Cygwin installation and downloaded packages | ||
run: | | ||
Remove-Item -Force -Recurse C:\cygwin | ||
Remove-Item -Force -Recurse C:\cygwin-packages | ||
Remove-Item -Force -Recurse C:\cygwin-packages-checksum.* | ||
- name: Install Cygwin + mksh, saveonly | ||
uses: ./ | ||
with: | ||
packages: mksh | ||
package-cache: saveonly | ||
|
||
# This assumes 2 and tests 7 | ||
- name: Ensure libyajl2 not downloaded | ||
shell: C:\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -o igncr {0} | ||
run: | | ||
for file in /cygdrive/c/cygwin-packages/*/*/*/*/libyajl2-*.tar.*; do | ||
[[ -f "$file" ]] && exit 1 | ||
done | ||
exit 0 | ||
- name: Delete the Cygwin installation and downloaded packages | ||
run: | | ||
Remove-Item -Force -Recurse C:\cygwin | ||
Remove-Item -Force -Recurse C:\cygwin-packages | ||
Remove-Item -Force -Recurse C:\cygwin-packages-checksum.* | ||
- name: Install Cygwin + libgif7, restoreonly | ||
uses: ./ | ||
with: | ||
packages: libgif7 | ||
package-cache: restoreonly | ||
|
||
# This tests 3 and 8 | ||
- name: Ensure mksh downloaded | ||
shell: C:\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -o igncr {0} | ||
run: | | ||
for file in /cygdrive/c/cygwin-packages/*/*/*/*/mksh-*.tar.*; do | ||
[[ -f "$file" ]] && exit 1 | ||
done | ||
exit 0 | ||
- name: Delete the Cygwin installation and downloaded packages | ||
run: | | ||
Remove-Item -Force -Recurse C:\cygwin | ||
Remove-Item -Force -Recurse C:\cygwin-packages | ||
Remove-Item -Force -Recurse C:\cygwin-packages-checksum.* | ||
- name: Install Cygwin, restoreonly | ||
uses: ./ | ||
with: | ||
package-cache: restoreonly | ||
|
||
# This assumes 8 and tests 4 | ||
- name: Ensure libgif7 not downloaded | ||
shell: C:\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -o igncr {0} | ||
run: | | ||
for file in /cygdrive/c/cygwin-packages/*/*/*/*/libgif7-*.tar.*; do | ||
[[ -f "$file" ]] && exit 1 | ||
done | ||
exit 0 | ||
- name: Delete the Cygwin installation and downloaded packages | ||
run: | | ||
Remove-Item -Force -Recurse C:\cygwin | ||
Remove-Item -Force -Recurse C:\cygwin-packages | ||
Remove-Item -Force -Recurse C:\cygwin-packages-checksum.* | ||
- name: Install Cygwin, caching disabled | ||
uses: ./ | ||
with: | ||
package-cache: disabled | ||
|
||
# This assumes 3 and tests 5 | ||
- name: Ensure mksh not downloaded | ||
shell: C:\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -o igncr {0} | ||
run: | | ||
for file in /cygdrive/c/cygwin-packages/*/*/*/*/mksh-*.tar.*; do | ||
[[ -f "$file" ]] && exit 1 | ||
done | ||
exit 0 | ||
- name: Delete the Cygwin installation and downloaded packages | ||
run: | | ||
Remove-Item -Force -Recurse C:\cygwin | ||
Remove-Item -Force -Recurse C:\cygwin-packages | ||
Remove-Item -Force -Recurse C:\cygwin-packages-checksum.* |
This file contains 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