Skip to content

Commit 79832e3

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 79832e3

File tree

3 files changed

+86
-27
lines changed

3 files changed

+86
-27
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

+9-27
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: ./
@@ -78,7 +60,7 @@ jobs:
7860
run: |
7961
for file in /cygdrive/c/cygwin-packages/*/*/*/*/bash-completion-*.tar.*; do
8062
[[ -f "$file" ]] && exit 1
81-
fi
63+
done
8264
8365
- name: Delete the Cygwin installation and downloaded packages
8466
run: |
@@ -98,7 +80,7 @@ jobs:
9880
run: |
9981
for file in /cygdrive/c/cygwin-packages/*/*/*/*/brotli-*.tar.*; do
10082
[[ -f "$file" ]] && exit 0
101-
fi
83+
done
10284
exit 1
10385
10486
- name: Delete the Cygwin installation and downloaded packages
@@ -119,7 +101,7 @@ jobs:
119101
run: |
120102
for file in /cygdrive/c/cygwin-packages/*/*/*/*/libyajl2-*.tar.*; do
121103
[[ -f "$file" ]] && exit 1
122-
fi
104+
done
123105
124106
- name: Delete the Cygwin installation and downloaded packages
125107
run: |
@@ -139,7 +121,7 @@ jobs:
139121
run: |
140122
for file in /cygdrive/c/cygwin-packages/*/*/*/*/mksh-*.tar.*; do
141123
[[ -f "$file" ]] && exit 1
142-
fi
124+
done
143125
144126
- name: Delete the Cygwin installation and downloaded packages
145127
run: |
@@ -158,7 +140,7 @@ jobs:
158140
run: |
159141
for file in /cygdrive/c/cygwin-packages/*/*/*/*/libgif7-*.tar.*; do
160142
[[ -f "$file" ]] && exit 1
161-
fi
143+
done
162144
163145
- name: Delete the Cygwin installation and downloaded packages
164146
run: |
@@ -177,7 +159,7 @@ jobs:
177159
run: |
178160
for file in /cygdrive/c/cygwin-packages/*/*/*/*/mksh-*.tar.*; do
179161
[[ -f "$file" ]] && exit 1
180-
fi
162+
done
181163
182164
- name: Delete the Cygwin installation and downloaded packages
183165
run: |

.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)