From 76f43bad2ff65199071a673131a589494717b089 Mon Sep 17 00:00:00 2001 From: Adam Dinwoodie Date: Tue, 10 Jan 2023 22:42:36 +0000 Subject: [PATCH] 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. --- .github/workflows/cache-perf.yml | 48 ++++++++++++++++++++++++++++++ .github/workflows/cache-test.yml | 22 +------------- .github/workflows/clear-caches.yml | 29 ++++++++++++++++++ 3 files changed, 78 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/cache-perf.yml create mode 100644 .github/workflows/clear-caches.yml diff --git a/.github/workflows/cache-perf.yml b/.github/workflows/cache-perf.yml new file mode 100644 index 0000000..2a1d78a --- /dev/null +++ b/.github/workflows/cache-perf.yml @@ -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 diff --git a/.github/workflows/cache-test.yml b/.github/workflows/cache-test.yml index 7befc8c..212d046 100644 --- a/.github/workflows/cache-test.yml +++ b/.github/workflows/cache-test.yml @@ -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 diff --git a/.github/workflows/clear-caches.yml b/.github/workflows/clear-caches.yml new file mode 100644 index 0000000..12c2d24 --- /dev/null +++ b/.github/workflows/clear-caches.yml @@ -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 + }); + }