Skip to content
Merged
Changes from 1 commit
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
82 changes: 82 additions & 0 deletions .github/workflows/cleanup-ccache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Cleanup ccache

on:
pull_request:
branches: [develop] # Remove before merge, just for testing
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be removed before merging to production as indicated by the inline comment. The pull_request trigger on the develop branch appears to be for testing purposes only and should not be present in the final merged version.

Suggested change
pull_request:
branches: [develop] # Remove before merge, just for testing

Copilot uses AI. Check for mistakes.
schedule:
- cron: "0 0 * * 0" # Weekly on Sundays
workflow_dispatch:

env:
TASK: cleanup-ccache-weekly
no_proxy: "bcebos.com,apiin.im.baidu.com,gitee.com,aliyun.com,.baidu.com,.tuna.tsinghua.edu.cn"

defaults:
run:
shell: bash

jobs:
cleanup-ccache:
name: Cleanup L2 ccache
runs-on:
group: GZ_BD-CPU

steps:
- name: Launch container
env:
work_dir: /paddle
PADDLE_ROOT: /paddle
CCACHE_MAXSIZE: 50G
CCACHE_LIMIT_MULTIPLE: 0.8
CCACHE_DIR: "/home/data/cfs/.ccache/l2"
run: |
set -x
container_name=${TASK}-$(date +%s)
echo "container_name=${container_name}" >> ${{ github.env }}
docker_image=ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:cuda129-coverage-test
docker run -d -t --name ${container_name} \
-v "/home/data/cfs:/home/data/cfs" \
-v "/home/data/cfs/.cache:/root/.cache" \
-v "/home/data/shared:/home/data/shared" \
-v "/dev/shm:/dev/shm" \
-v "${{ github.workspace }}/../../..:${{ github.workspace }}/../../.." \
-v ${{ github.workspace }}:/paddle \
-e work_dir \
-e PADDLE_ROOT \
-e GITHUB_ENV \
-e CACHE_DIR \
-e CCACHE_DIR \
-e CCACHE_SECONDARY_STORAGE \
-e CCACHE_MAXSIZE \
-e CCACHE_LIMIT_MULTIPLE \
-e no_proxy \
-w /paddle --network host ${docker_image}

- name: Install ccache inside container
run: |
docker exec -t ${container_name} bash -c '
source ${{ github.workspace }}/../../../proxy
apt-get update
apt-get install -y ccache
'

- name: Cleanup L2 ccache inside container
run: |
docker exec -t ${container_name} bash -c '
# Show current ccache stats
echo "Current ccache stats before cleanup:"
ccache -s
# Trim L2 ccache to free up space, trim all caches exceeding 15days
ccache --evict-older-than 15d
# Show ccache stats after cleanup
echo "Current ccache stats after cleanup:"
ccache -s
'

- name: Terminate and delete the container
if: always()
run: |
set +e
docker exec -t ${{ env.container_name }} /bin/bash -c 'rm -rf * .[^.]*'
docker stop ${{ env.container_name }}
docker rm ${{ env.container_name }}
Loading