Skip to content

Commit c9be7a5

Browse files
committed
Add cache performance testing
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.
1 parent 9a6c69a commit c9be7a5

File tree

3 files changed

+80
-21
lines changed

3 files changed

+80
-21
lines changed

.github/workflows/cache-perf.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Cache performance testing
2+
3+
# Only run manually: the purpose of this test is to check how much (if at all)
4+
# using the caches helps, and that's not something that needs doing often, and
5+
# it is something that's time consuming.
6+
on: workflow_dispatch
7+
8+
# Avoid running at the same time as other actions that interfere with caches,
9+
# to avoid pollution.
10+
concurrency: caches
11+
12+
jobs:
13+
clear-caches:
14+
uses: ./.github/workflows/clear-caches.yml
15+
permissions:
16+
actions: write
17+
18+
# There should now be no cache, so we can test how long it takes to do an
19+
# install without a cache while building the cache for the later action.
20+
install-without-cache:
21+
runs-on: windows-latest
22+
needs: clear-caches
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
27+
- name: Install a large set of Cygwin packages
28+
uses: ./
29+
with:
30+
packages: >
31+
biber doxygen evolution kde-dev-utils
32+
mkvtoolnix-debuginfo nghttp x11vnc
33+
package-cache: saveonly
34+
35+
install-with-cache:
36+
runs-on: windows-latest
37+
needs: install-without-cache
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v3
41+
42+
- name: Install a large set of Cygwin packages
43+
uses: ./
44+
with:
45+
packages: >
46+
biber doxygen evolution kde-dev-utils
47+
mkvtoolnix-debuginfo nghttp x11vnc
48+
package-cache: enabled

.github/workflows/cache-test.yml

+3-21
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,9 @@ concurrency: caches
88

99
jobs:
1010
clear-caches:
11-
runs-on: ubuntu-latest
11+
uses: ./.github/workflows/clear-caches.yml
1212
permissions:
1313
actions: write
14-
steps:
15-
# This will only delete up to 100 caches. That should be far more than
16-
# is ever needed.
17-
- name: Delete cache entries
18-
uses: actions/github-script@v6
19-
with:
20-
script: |
21-
const response = await github.rest.actions.getActionsCacheList({
22-
owner: context.repo.owner,
23-
repo: context.repo.repo,
24-
per_page: 100,
25-
key: 'cygwin-install-action-packages-'
26-
});
27-
for (const cache of response.data.actions_caches) {
28-
await github.rest.actions.deleteActionsCacheById({
29-
owner: context.repo.owner,
30-
repo: context.repo.repo,
31-
cache_id: cache.id
32-
});
33-
}
3414

3515
test-caching:
3616
runs-on: windows-latest
@@ -53,6 +33,8 @@ jobs:
5333
# saveonly | yes (3) | no (7)
5434
# restoreonly | no (4) | yes (8)
5535
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v3
5638

5739
- name: Install Cygwin + bash_completion, no caching
5840
uses: ./

.github/workflows/clear-caches.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Clear Cygwin package caches
2+
3+
on: workflow_call
4+
5+
jobs:
6+
clear-caches:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
actions: write
10+
steps:
11+
# This will only delete up to 100 caches. That should be far more than
12+
# is ever needed.
13+
- name: Delete cache entries
14+
uses: actions/github-script@v6
15+
with:
16+
script: |
17+
const response = await github.rest.actions.getActionsCacheList({
18+
owner: context.repo.owner,
19+
repo: context.repo.repo,
20+
per_page: 100,
21+
key: 'cygwin-install-action-packages-'
22+
});
23+
for (const cache of response.data.actions_caches) {
24+
await github.rest.actions.deleteActionsCacheById({
25+
owner: context.repo.owner,
26+
repo: context.repo.repo,
27+
cache_id: cache.id
28+
});
29+
}

0 commit comments

Comments
 (0)