ci: add APT caching to deploy-docs workflow
All checks were successful
Deploy Documentation / build-and-deploy (push) Successful in 55s
All checks were successful
Deploy Documentation / build-and-deploy (push) Successful in 55s
This commit is contained in:
parent
281175e2cd
commit
e4a8a55a28
1 changed files with 42 additions and 1 deletions
|
|
@ -12,10 +12,51 @@ jobs:
|
||||||
- name: 저장소 체크아웃
|
- name: 저장소 체크아웃
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Python & Graphviz
|
# 1. 기존 APT 캐시 복원 (가장 최근 상태 불러오기)
|
||||||
|
- name: Restore APT Cache
|
||||||
|
uses: actions/cache/restore@v4
|
||||||
|
with:
|
||||||
|
path: /var/cache/apt/archives
|
||||||
|
# 매칭되지 않는 임시 키를 사용하여 항상 restore-keys가 작동하도록 유도
|
||||||
|
key: ${{ runner.os }}-apt-temp
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-apt-
|
||||||
|
|
||||||
|
# 2. 시스템 패키지 설치 및 구버전 찌꺼기 청소
|
||||||
|
- name: Install System Packages
|
||||||
run: |
|
run: |
|
||||||
|
# 2-1. 다운로드된 패키지 파일이 지워지지 않도록 docker-clean 무력화
|
||||||
|
if [ -f /etc/apt/apt.conf.d/docker-clean ]; then
|
||||||
|
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' | tee /etc/apt/apt.conf.d/keep-cache
|
||||||
|
rm -f /etc/apt/apt.conf.d/docker-clean
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 2-2. 패키지 업데이트 및 설치
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y python3 python3-pip python3-venv graphviz
|
apt-get install -y python3 python3-pip python3-venv graphviz
|
||||||
|
|
||||||
|
# 2-3. (핵심) 캐시 용량 최적화를 위해 더 이상 안 쓰는 구버전 패키지 파일만 삭제
|
||||||
|
apt-get autoclean -y
|
||||||
|
|
||||||
|
# 2-4. 다운로드 중단된 임시 파일 삭제 (캐시 오염 방지)
|
||||||
|
rm -f /var/cache/apt/archives/partial/*
|
||||||
|
|
||||||
|
# 3. .deb 파일명 목록 기반 고유 해시(Hash) 계산 (내용을 읽지 않아 초고속)
|
||||||
|
- name: Calculate APT Cache Hash
|
||||||
|
id: apt-hash
|
||||||
|
run: |
|
||||||
|
# 파일 내용 대신 이름(-printf "%f\n")만 추출하여 해시를 계산합니다.
|
||||||
|
# 새 파일이 생기거나 autoclean으로 파일이 지워졌을 때만 해시값이 바뀝니다.
|
||||||
|
DEB_HASH=$(find /var/cache/apt/archives -name "*.deb" -type f -printf "%f\n" | sort | md5sum | awk '{print $1}')
|
||||||
|
echo "hash=$DEB_HASH" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# 4. 계산된 해시값을 Key로 캐시 저장
|
||||||
|
- name: Save APT Cache
|
||||||
|
uses: actions/cache/save@v4
|
||||||
|
with:
|
||||||
|
path: /var/cache/apt/archives
|
||||||
|
# 내용물에 변화가 없으면 해시가 동일하므로 업로드를 자동으로 건너뜁니다 (Skip)
|
||||||
|
key: ${{ runner.os }}-apt-${{ steps.apt-hash.outputs.hash }}
|
||||||
|
|
||||||
- name: Cache Python Virtual Environment
|
- name: Cache Python Virtual Environment
|
||||||
id: cache-venv
|
id: cache-venv
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue