This commit is contained in:
shanshanzhong 2025-09-26 07:21:51 -07:00
parent 618ac0bf8c
commit e3698a8a60

View File

@ -37,7 +37,29 @@ jobs:
steps:
- name: Checkout code
uses: https://gitea.cn/actions/checkout@v4
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 缓存服务健康检查
id: cache-health
continue-on-error: true
run: |
echo "检查缓存服务可用性..."
# 设置缓存可用性标志
CACHE_AVAILABLE=true
# 测试GitHub Actions缓存API
if ! curl -s --connect-timeout 10 --max-time 30 "https://api.github.com/repos/${{ github.repository }}/actions/caches" > /dev/null 2>&1; then
echo "⚠️ GitHub Actions缓存服务不可用将跳过缓存步骤"
CACHE_AVAILABLE=false
else
echo "✅ 缓存服务可用"
fi
echo "CACHE_AVAILABLE=$CACHE_AVAILABLE" >> $GITHUB_ENV
echo "cache-available=$CACHE_AVAILABLE" >> $GITHUB_OUTPUT
- name: Install system tools (jq, docker, curl)
run: |
@ -122,7 +144,9 @@ jobs:
echo "canvas_binary_host_mirror=https://registry.npmmirror.com/-/binary/canvas" >> .npmrc
- name: Install dependencies cache (Bun)
uses: https://gitea.cn/actions/cache@v3
if: env.CACHE_AVAILABLE == 'true'
uses: actions/cache@v4
continue-on-error: true
with:
path: ~/.bun
key: bun-${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('bun.lock') }}
@ -131,7 +155,9 @@ jobs:
bun-${{ runner.os }}-
- name: Install dependencies cache (node_modules)
uses: https://gitea.cn/actions/cache@v3
if: env.CACHE_AVAILABLE == 'true'
uses: actions/cache@v4
continue-on-error: true
with:
path: |
node_modules
@ -175,11 +201,15 @@ jobs:
echo "✅ 缓存目录已准备完成"
- name: Turborepo cache (.turbo)
uses: https://gitea.cn/actions/cache@v3
if: env.CACHE_AVAILABLE == 'true'
uses: actions/cache@v4
continue-on-error: true
with:
path: .turbo
key: turbo-${{ runner.os }}-${{ hashFiles('turbo.json') }}-${{ hashFiles('bun.lock') }}
key: turbo-${{ runner.os }}-${{ hashFiles('turbo.json') }}-${{ hashFiles('apps/**/package.json') }}-${{ hashFiles('packages/**/package.json') }}-${{ hashFiles('bun.lock') }}
restore-keys: |
turbo-${{ runner.os }}-${{ hashFiles('turbo.json') }}-${{ hashFiles('apps/**/package.json') }}-${{ hashFiles('packages/**/package.json') }}-
turbo-${{ runner.os }}-${{ hashFiles('turbo.json') }}-
turbo-${{ runner.os }}-
- name: 安装依赖 (bun)
@ -269,7 +299,9 @@ jobs:
echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Cache Next.js build artifacts (.next/cache)
uses: https://gitea.cn/actions/cache@v3
if: env.CACHE_AVAILABLE == 'true'
uses: actions/cache@v4
continue-on-error: true
with:
path: |
apps/admin/.next/cache
@ -280,7 +312,9 @@ jobs:
nextcache-${{ runner.os }}-
- name: Cache build outputs
uses: https://gitea.cn/actions/cache@v3
if: env.CACHE_AVAILABLE == 'true'
uses: actions/cache@v4
continue-on-error: true
with:
path: |
apps/admin/.next
@ -293,7 +327,9 @@ jobs:
build-${{ runner.os }}-
- name: Cache ESLint
uses: https://gitea.cn/actions/cache@v3
if: env.CACHE_AVAILABLE == 'true'
uses: actions/cache@v4
continue-on-error: true
with:
path: |
.eslintcache
@ -304,7 +340,9 @@ jobs:
eslint-${{ runner.os }}-
- name: Cache TypeScript
uses: https://gitea.cn/actions/cache@v3
if: env.CACHE_AVAILABLE == 'true'
uses: actions/cache@v4
continue-on-error: true
with:
path: |
.tsbuildinfo