Skip to content

Commit

Permalink
Add cache performance testing
Browse files Browse the repository at this point in the history
This should hopefully show how much of a difference, if any, caching
packages makes.  There's no automated comparison here, the test just
runs one install without a cache, then a second install with a cache,
then a human needs to look at what difference it makes.
  • Loading branch information
me-and committed Jan 10, 2023
1 parent 9a6c69a commit 79832e3
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 27 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/cache-perf.yml
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
36 changes: 9 additions & 27 deletions .github/workflows/cache-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,9 @@ concurrency: caches

jobs:
clear-caches:
runs-on: ubuntu-latest
uses: ./.github/workflows/clear-caches.yml
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
Expand All @@ -53,6 +33,8 @@ jobs:
# 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: ./
Expand All @@ -78,7 +60,7 @@ jobs:
run: |
for file in /cygdrive/c/cygwin-packages/*/*/*/*/bash-completion-*.tar.*; do
[[ -f "$file" ]] && exit 1
fi
done
- name: Delete the Cygwin installation and downloaded packages
run: |
Expand All @@ -98,7 +80,7 @@ jobs:
run: |
for file in /cygdrive/c/cygwin-packages/*/*/*/*/brotli-*.tar.*; do
[[ -f "$file" ]] && exit 0
fi
done
exit 1
- name: Delete the Cygwin installation and downloaded packages
Expand All @@ -119,7 +101,7 @@ jobs:
run: |
for file in /cygdrive/c/cygwin-packages/*/*/*/*/libyajl2-*.tar.*; do
[[ -f "$file" ]] && exit 1
fi
done
- name: Delete the Cygwin installation and downloaded packages
run: |
Expand All @@ -139,7 +121,7 @@ jobs:
run: |
for file in /cygdrive/c/cygwin-packages/*/*/*/*/mksh-*.tar.*; do
[[ -f "$file" ]] && exit 1
fi
done
- name: Delete the Cygwin installation and downloaded packages
run: |
Expand All @@ -158,7 +140,7 @@ jobs:
run: |
for file in /cygdrive/c/cygwin-packages/*/*/*/*/libgif7-*.tar.*; do
[[ -f "$file" ]] && exit 1
fi
done
- name: Delete the Cygwin installation and downloaded packages
run: |
Expand All @@ -177,7 +159,7 @@ jobs:
run: |
for file in /cygdrive/c/cygwin-packages/*/*/*/*/mksh-*.tar.*; do
[[ -f "$file" ]] && exit 1
fi
done
- name: Delete the Cygwin installation and downloaded packages
run: |
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/clear-caches.yml
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
});
}

0 comments on commit 79832e3

Please sign in to comment.