From dca826cd69a5656368addbda89d282f5f3ad264d Mon Sep 17 00:00:00 2001 From: Ryan Clary <9618975+mrclary@users.noreply.github.com> Date: Fri, 11 Oct 2024 09:56:34 -0700 Subject: [PATCH 1/3] Purge workflow cache every Sunday 4:10 UTC and run tests. --- .github/workflows/purge-cache.yml | 63 +++++++++++++++++++++++++ .github/workflows/test-files.yml | 2 + .github/workflows/test-linux.yml | 2 + .github/workflows/test-mac.yml | 2 + .github/workflows/test-remoteclient.yml | 4 +- .github/workflows/test-win.yml | 2 + 6 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/purge-cache.yml diff --git a/.github/workflows/purge-cache.yml b/.github/workflows/purge-cache.yml new file mode 100644 index 00000000000..d0fe2503940 --- /dev/null +++ b/.github/workflows/purge-cache.yml @@ -0,0 +1,63 @@ +name: Purge caches +on: + schedule: + # 4:10 UTC Sunday + - cron: "10 4 * * 0" + + workflow-dispatch: + +jobs: + cleanup: + runs-on: ubuntu-latest + permissions: + actions: write + steps: + - name: Purge Cache + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh extension install actions/gh-actions-cache + + REPO=${{ github.repository }} + + echo "Fetching list of cache key" + allCaches=$(gh actions-cache list -L 100 -R $REPO | cut -f 1 ) + + ## Setting this to not fail the workflow while deleting cache keys. + set +e + echo "Deleting caches..." + for cacheKey in $allCaches + do + gh actions-cache delete $cacheKey -R $REPO --confirm + done + echo "Done" + + run-test-files: + name: Run test-files + needs: + - cleanup + uses: ./.github/workflows/test-files.yml + + run-test-linux: + name: Run test-linux + needs: + - cleanup + uses: ./.github/workflows/test-linux.yml + + run-test-mac: + name: Run test-mac + needs: + - cleanup + uses: ./.github/workflows/test-mac.yml + + run-test-remoteclient: + name: Run test-remoteclient + needs: + - cleanup + uses: ./.github/workflows/test-remoteclient.yml + + run-test-win: + name: Run test-win + needs: + - cleanup + uses: ./.github/workflows/test-win.yml diff --git a/.github/workflows/test-files.yml b/.github/workflows/test-files.yml index 7fb41afdccc..ecf6d9d4812 100644 --- a/.github/workflows/test-files.yml +++ b/.github/workflows/test-files.yml @@ -35,6 +35,8 @@ on: - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + workflow_call: + workflow_dispatch: concurrency: diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 17fbf99e2c6..cf7c991aaf5 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -35,6 +35,8 @@ on: - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + workflow_call: + workflow_dispatch: inputs: ssh: diff --git a/.github/workflows/test-mac.yml b/.github/workflows/test-mac.yml index ff283d444ed..a600b03e1e2 100644 --- a/.github/workflows/test-mac.yml +++ b/.github/workflows/test-mac.yml @@ -35,6 +35,8 @@ on: - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + workflow_call: + workflow_dispatch: inputs: ssh: diff --git a/.github/workflows/test-remoteclient.yml b/.github/workflows/test-remoteclient.yml index 9ea06d22643..aa201aedc0f 100644 --- a/.github/workflows/test-remoteclient.yml +++ b/.github/workflows/test-remoteclient.yml @@ -31,10 +31,12 @@ on: - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + workflow_call: + workflow_dispatch: inputs: ssh: - # github_cli: gh workflow run test-linux.yml --ref -f ssh=true + # github_cli: gh workflow run test-remoteclient.yml --ref -f ssh=true description: 'Enable ssh debugging' required: false default: false diff --git a/.github/workflows/test-win.yml b/.github/workflows/test-win.yml index a6f74c8fb57..bef8663f207 100644 --- a/.github/workflows/test-win.yml +++ b/.github/workflows/test-win.yml @@ -35,6 +35,8 @@ on: - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + workflow_call: + workflow_dispatch: inputs: ssh: From af23a15045faf6e15c75f689e230fa1fe3b7d0f0 Mon Sep 17 00:00:00 2001 From: Ryan Clary <9618975+mrclary@users.noreply.github.com> Date: Fri, 11 Oct 2024 10:02:17 -0700 Subject: [PATCH 2/3] Do not trigger tests on changes to purge-cache.yml --- .github/workflows/test-files.yml | 2 ++ .github/workflows/test-linux.yml | 2 ++ .github/workflows/test-mac.yml | 2 ++ .github/workflows/test-remoteclient.yml | 2 ++ .github/workflows/test-win.yml | 2 ++ 5 files changed, 10 insertions(+) diff --git a/.github/workflows/test-files.yml b/.github/workflows/test-files.yml index ecf6d9d4812..5e3bb9ce692 100644 --- a/.github/workflows/test-files.yml +++ b/.github/workflows/test-files.yml @@ -17,6 +17,7 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' pull_request: branches: @@ -34,6 +35,7 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' workflow_call: diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index cf7c991aaf5..165d19f24ed 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -17,6 +17,7 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' pull_request: branches: @@ -34,6 +35,7 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' workflow_call: diff --git a/.github/workflows/test-mac.yml b/.github/workflows/test-mac.yml index a600b03e1e2..4764baf9cd7 100644 --- a/.github/workflows/test-mac.yml +++ b/.github/workflows/test-mac.yml @@ -17,6 +17,7 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' pull_request: branches: @@ -34,6 +35,7 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' workflow_call: diff --git a/.github/workflows/test-remoteclient.yml b/.github/workflows/test-remoteclient.yml index aa201aedc0f..8bf93755dda 100644 --- a/.github/workflows/test-remoteclient.yml +++ b/.github/workflows/test-remoteclient.yml @@ -15,6 +15,7 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' pull_request: branches: @@ -30,6 +31,7 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' workflow_call: diff --git a/.github/workflows/test-win.yml b/.github/workflows/test-win.yml index bef8663f207..2a801c630f3 100644 --- a/.github/workflows/test-win.yml +++ b/.github/workflows/test-win.yml @@ -17,6 +17,7 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' pull_request: branches: @@ -34,6 +35,7 @@ on: - '!installers-conda/**' - '!.github/workflows/installers-conda.yml' - '!.github/workflows/build-subrepos.yml' + - '!.github/workflows/purge-cache.yml' workflow_call: From 225add7744fcf3e5a450de22e26d83786d5c7a3d Mon Sep 17 00:00:00 2001 From: Ryan Clary <9618975+mrclary@users.noreply.github.com> Date: Fri, 11 Oct 2024 10:04:46 -0700 Subject: [PATCH 3/3] Test purge caches --- .github/workflows/purge-cache.yml | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/.github/workflows/purge-cache.yml b/.github/workflows/purge-cache.yml index d0fe2503940..bc9a20b146a 100644 --- a/.github/workflows/purge-cache.yml +++ b/.github/workflows/purge-cache.yml @@ -1,8 +1,8 @@ name: Purge caches on: schedule: - # 4:10 UTC Sunday - - cron: "10 4 * * 0" + # 17:15 UTC Friday + - cron: "15 17 * * 5" workflow-dispatch: @@ -16,21 +16,7 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh extension install actions/gh-actions-cache - - REPO=${{ github.repository }} - - echo "Fetching list of cache key" - allCaches=$(gh actions-cache list -L 100 -R $REPO | cut -f 1 ) - - ## Setting this to not fail the workflow while deleting cache keys. - set +e - echo "Deleting caches..." - for cacheKey in $allCaches - do - gh actions-cache delete $cacheKey -R $REPO --confirm - done - echo "Done" + echo "Test purge cache." run-test-files: name: Run test-files