Skip to content

1

1 #376

name: Verify Server
on:
push:
paths:
- 'src/server/**'
- 'src/scripts/**'
tags-ignore:
- '*'
branches:
- '*'
workflow_dispatch:
jobs:
verify-server:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- uses: denoland/setup-deno@v2
id: deno
with:
deno-version: latest
cache-hash: fount
- uses: actions/cache@v5
with:
path: ./node_modules
key: fount-node-modules
- name: Install server dependencies
run: |
for i in $(seq 1 13); do
deno install --prod --allow-scripts --allow-all -c "./deno.json" --entrypoint "./src/server/index.mjs" && break
echo "Attempt $i/13 failed, retrying..."
done
- name: Start server and ping api/ping
run: deno run --allow-scripts --allow-all -c "./deno.json" ./.github/workflows/verify_server.mjs
- name: Delete Previous Cache # 删除之前的缓存确保缓存随着项目运行而更新
continue-on-error: true
shell: bash
run: |
gh extension install actions/gh-actions-cache || true
gh actions-cache delete "fount-node-modules" --confirm || true
gh actions-cache delete "deno-cache-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-fount" --confirm || true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: clean before cache save
continue-on-error: true
shell: bash
run: |
ENTRYPOINTS=()
add_entry() { [ -f "$1" ] && ENTRYPOINTS+=("$1"); }
add_entry "./src/server/index.mjs"
add_entry "./.github/workflows/verify_server.mjs"
[ ${#ENTRYPOINTS[@]} -eq 0 ] && exit 0
deno clean --except "${ENTRYPOINTS[@]}"
- name: Save node_modules Cache
continue-on-error: true
uses: actions/cache/save@v5
with:
path: ./node_modules
key: fount-node-modules
- name: get deno dir
shell: bash
run: echo "DENO_DIR=$(deno info --json | jq -r '.denoDir')" >> $GITHUB_ENV
- name: Save deno Cache
continue-on-error: true
uses: actions/cache/save@v5
with:
path: ${{ env.DENO_DIR }}
key: deno-cache-${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-fount