-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add package caching #6
Draft
me-and
wants to merge
4
commits into
cygwin:master
Choose a base branch
from
me-and:cache
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+338
−8
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,48 @@ | ||
name: Cache performance testing | ||
|
||
# Only run manually: the purpose of this test is to check how much (if at all) | ||
# using the caches helps, and that's not something that needs doing often, and | ||
# it is something that's time consuming. | ||
on: workflow_dispatch | ||
|
||
# Avoid running at the same time as other actions that interfere with caches, | ||
# to avoid pollution. | ||
concurrency: caches | ||
|
||
jobs: | ||
clear-caches: | ||
uses: ./.github/workflows/clear-caches.yml | ||
permissions: | ||
actions: write | ||
|
||
# There should now be no cache, so we can test how long it takes to do an | ||
# install without a cache while building the cache for the later action. | ||
install-without-cache: | ||
runs-on: windows-latest | ||
needs: clear-caches | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install a large set of Cygwin packages | ||
uses: ./ | ||
with: | ||
packages: > | ||
biber doxygen evolution kde-dev-utils | ||
mkvtoolnix-debuginfo nghttp x11vnc | ||
package-cache: saveonly | ||
|
||
install-with-cache: | ||
runs-on: windows-latest | ||
needs: install-without-cache | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install a large set of Cygwin packages | ||
uses: ./ | ||
with: | ||
packages: > | ||
biber doxygen evolution kde-dev-utils | ||
mkvtoolnix-debuginfo nghttp x11vnc | ||
package-cache: enabled |
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,173 @@ | ||
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: | ||
uses: ./.github/workflows/clear-caches.yml | ||
permissions: | ||
actions: write | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Clear Cygwin package caches | ||
|
||
on: workflow_call | ||
|
||
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 | ||
}); | ||
} |
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure "locally" is the best word to use here.