in1
This commit is contained in:
parent
618ac0bf8c
commit
e3698a8a60
@ -37,7 +37,29 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- 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)
|
- name: Install system tools (jq, docker, curl)
|
||||||
run: |
|
run: |
|
||||||
@ -122,7 +144,9 @@ jobs:
|
|||||||
echo "canvas_binary_host_mirror=https://registry.npmmirror.com/-/binary/canvas" >> .npmrc
|
echo "canvas_binary_host_mirror=https://registry.npmmirror.com/-/binary/canvas" >> .npmrc
|
||||||
|
|
||||||
- name: Install dependencies cache (Bun)
|
- 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:
|
with:
|
||||||
path: ~/.bun
|
path: ~/.bun
|
||||||
key: bun-${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('bun.lock') }}
|
key: bun-${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('bun.lock') }}
|
||||||
@ -131,7 +155,9 @@ jobs:
|
|||||||
bun-${{ runner.os }}-
|
bun-${{ runner.os }}-
|
||||||
|
|
||||||
- name: Install dependencies cache (node_modules)
|
- 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:
|
with:
|
||||||
path: |
|
path: |
|
||||||
node_modules
|
node_modules
|
||||||
@ -175,11 +201,15 @@ jobs:
|
|||||||
echo "✅ 缓存目录已准备完成"
|
echo "✅ 缓存目录已准备完成"
|
||||||
|
|
||||||
- name: Turborepo cache (.turbo)
|
- 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:
|
with:
|
||||||
path: .turbo
|
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: |
|
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 }}-
|
turbo-${{ runner.os }}-
|
||||||
|
|
||||||
- name: 安装依赖 (bun)
|
- name: 安装依赖 (bun)
|
||||||
@ -269,7 +299,9 @@ jobs:
|
|||||||
echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
|
echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Cache Next.js build artifacts (.next/cache)
|
- 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:
|
with:
|
||||||
path: |
|
path: |
|
||||||
apps/admin/.next/cache
|
apps/admin/.next/cache
|
||||||
@ -280,7 +312,9 @@ jobs:
|
|||||||
nextcache-${{ runner.os }}-
|
nextcache-${{ runner.os }}-
|
||||||
|
|
||||||
- name: Cache build outputs
|
- 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:
|
with:
|
||||||
path: |
|
path: |
|
||||||
apps/admin/.next
|
apps/admin/.next
|
||||||
@ -293,7 +327,9 @@ jobs:
|
|||||||
build-${{ runner.os }}-
|
build-${{ runner.os }}-
|
||||||
|
|
||||||
- name: Cache ESLint
|
- name: Cache ESLint
|
||||||
uses: https://gitea.cn/actions/cache@v3
|
if: env.CACHE_AVAILABLE == 'true'
|
||||||
|
uses: actions/cache@v4
|
||||||
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
.eslintcache
|
.eslintcache
|
||||||
@ -304,7 +340,9 @@ jobs:
|
|||||||
eslint-${{ runner.os }}-
|
eslint-${{ runner.os }}-
|
||||||
|
|
||||||
- name: Cache TypeScript
|
- name: Cache TypeScript
|
||||||
uses: https://gitea.cn/actions/cache@v3
|
if: env.CACHE_AVAILABLE == 'true'
|
||||||
|
uses: actions/cache@v4
|
||||||
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
.tsbuildinfo
|
.tsbuildinfo
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user