This commit is contained in:
resonic-user 2025-06-16 10:30:15 +00:00
parent 9a1f577904
commit 7fb32e9eb2

View File

@ -7,22 +7,31 @@ on:
workflow_dispatch:
jobs:
verify-cache:
test-cache:
name: Verify Node Modules Cache
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- id: cache-key
- name: Generate cache key
id: cache-key
run: echo "key=node-modules-${{ runner.os }}-${{ env.LOCK_HASH }}" >> $GITHUB_OUTPUT
env:
LOCK_HASH: ${{ hashFiles('backend/yarn.lock', 'webapp/yarn.lock') }}
run: echo "key=node-modules-${{ runner.os }}-${{ env.LOCK_HASH }}" >> $GITHUB_OUTPUT
- name: Debug resolved cache key
run: echo "Resolved key: ${{ steps.cache-key.outputs.key }}"
- name: Show lockfile hashes (debug)
run: |
echo "backend/yarn.lock hash: ${{ hashFiles('backend/yarn.lock') }}"
echo "webapp/yarn.lock hash: ${{ hashFiles('webapp/yarn.lock') }}"
- name: Restore node_modules cache
id: cache-restore
id: restore-cache
uses: actions/cache@v4
with:
path: |
@ -32,26 +41,44 @@ jobs:
restore-keys: |
node-modules-${{ runner.os }}-
node-modules-
- run: echo "Cache: ${{ steps.cache-restore.outputs.cache-hit }}"
- run: cd backend && yarn install && yarn build
- run: cd webapp && yarn install && yarn build
verify-wait:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: '20' }
- run: cd webapp && yarn install && yarn build
- run: |
if [ -d webapp/out ]; then
- name: Show cache hit status
run: |
if [[ "${{ steps.restore-cache.outputs.cache-hit }}" == "true" ]]; then
echo "✅ Cache was hit!"
else
echo "❌ Cache was missed."
fi
- name: Install backend deps
run: |
cd backend
yarn install
yarn build
- name: Install webapp deps
run: |
cd webapp
yarn install
yarn build
- name: Start webapp (static or fallback)
run: |
if [ -d "webapp/out" ]; then
echo "Serving webapp/out statically..."
npx serve -s webapp/out -l 3000 &
else
cd webapp && yarn start &
echo "webapp/out not found falling back to yarn start..."
cd webapp
yarn start &
fi
- run: |
- name: Test HTTP wait logic
run: |
echo "Waiting for http://localhost:3000 to respond..."
for i in {1..15}; do
curl -sf http://localhost:3000 && echo "✅ up" && exit 0
echo "$i..." && sleep 2
curl -sf http://localhost:3000 && echo "✅ Service ready." && exit 0
echo "Attempt $i failed. Retrying..."
sleep 2
done
echo "❌ no response" && exit 1
echo "❌ Service did not respond in time." && exit 1