Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/cache-evict.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Evict caches for merged PRs

# Caches for merged PRs stay around until we bump against our cache limit.
# They are also not shareable between branches. Therefore, once a PR is
# merged, the cache for that branch is immediately not needed anymore, and we
# can remove it. If we remove these caches, we can save space and be more sure
# that the remaining caches are actually useful, and not at danger of being
# evicted.

on:
workflow_dispatch:
push:
branches:
- main

concurrency:
group: "cache-evict"
cancel-in-progress: true

jobs:
evict-cache:
runs-on: ubuntu-latest

steps:
- name: Evict caches
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}

# This script lists all caches for the repository, lists all remote refs
# for the repository, and then finds the caches that are not present in
# the remote refs. It then deletes those caches.
#
# For that, it uses the `gh` CLI to list and delete caches, and `git` to
# list remote refs. It also uses `jq` to manipulate the data as JSON.
# (It's surprisingly difficult to find a shell command to check if a
# string is inside a given array, that's why we use `jq`.)
run: |
(
# Input 0: List all caches for the repository
gh cache list --limit 100 --json key,ref
# Input 1: List all remote refs for the repository, do some string
# manipulation to get the ref names (second column) as a JSON array
git ls-remote "https://github.com/$GITHUB_REPOSITORY.git" |
awk '{print $2}' |
jq --raw-input --compact-output '.' |
jq --slurp '.'
) |
# Find cache refs not present in the remote refs, and extract their keys
jq --slurp --raw-output \
'.[0] as $caches | .[1] as $remote_refs | $caches.[] | select([.ref] | inside($remote_refs) | not) | .key' |
while read -r key; do
# Delete those cache keys
gh cache delete "$key" ||
echo "::warning::Failed to delete cache key $key"
done
18 changes: 18 additions & 0 deletions .github/workflows/cache-warm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Keeps build cache warm

on:
workflow_dispatch:
schedule:
# GitHub evicts unused caches after 7 days, so we run this every 6 days
- cron: "0 0 */6 * *"

concurrency:
group: "cache-warm"
cancel-in-progress: false

jobs:
warm-cache-build:
uses: ./.github/workflows/waspc-build.yaml

warm-cache-ci:
uses: ./.github/workflows/waspc-ci.yaml
3 changes: 3 additions & 0 deletions .github/workflows/deploy-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ concurrency:
group: "deploy-examples"
cancel-in-progress: true

env:
WASP_TELEMETRY_DISABLE: 1

jobs:
deploy:
strategy:
Expand Down