This commit is contained in:
resonic-user 2025-06-16 11:46:37 +00:00
parent e1ea4a55d9
commit 707775a96e

View File

@ -41,6 +41,27 @@ jobs:
name: ${{ matrix.name }}-image
path: /tmp/${{ matrix.name }}.tar
build-environment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies and build
run: |
cd backend && yarn install && yarn build
cd ../webapp && yarn install && yarn build
- name: Build environment image
run: |
docker build -t ocelotsocial/environment:cache -f Dockerfile.environment .
- name: Save environment image as artifact
run: docker save ocelotsocial/environment:cache -o environment.tar
- uses: actions/upload-artifact@v4
with:
name: environment-image
path: environment.tar
consolidate-environment:
runs-on: ubuntu-latest
needs: [build-images, verify-cache]
@ -70,60 +91,20 @@ jobs:
echo "$i..." && sleep 2
done
echo "❌ Webapp did not respond in time" && exit 1
- name: Install Cypress
run: yarn install
- name: Run Cypress tests
run: yarn run cypress:run
verify-summary:
runs-on: ubuntu-latest
needs: [verify-cache, consolidate-environment]
needs: [build-environment, consolidate-environment]
if: always()
steps:
- name: CI Summary
run: |
echo "### ✅ CI Cache Verification Summary" >> $GITHUB_STEP_SUMMARY
echo "- Cache: ${{ needs.verify-cache.result }}" >> $GITHUB_STEP_SUMMARY
echo "- Environment: ${{ needs.consolidate-environment.result }}" >> $GITHUB_STEP_SUMMARY
if [[ '${{ needs.verify-cache.result }}' != 'success' || '${{ needs.consolidate-environment.result }}' != 'success' ]]; then
echo "- Build Environment: ${{ needs.build-environment.result }}" >> $GITHUB_STEP_SUMMARY
echo "- Consolidate Environment: ${{ needs.consolidate-environment.result }}" >> $GITHUB_STEP_SUMMARY
if [[ '${{ needs.build-environment.result }}' != 'success' || '${{ needs.consolidate-environment.result }}' != 'success' ]]; then
echo "\n❌ One or more checks failed." >> $GITHUB_STEP_SUMMARY
exit 1
else
echo "\n✅ All checks passed successfully!" >> $GITHUB_STEP_SUMMARY
fi
verify-cache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- id: cache-key
env:
LOCK_HASH: ${{ hashFiles('backend/yarn.lock', 'webapp/yarn.lock') }}
run: echo "key=node-modules-${{ runner.os }}-${{ env.LOCK_HASH }}" >> $GITHUB_OUTPUT
- 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: restore-cache
uses: actions/cache@v4
with:
path: |
backend/node_modules
webapp/node_modules
key: ${{ steps.cache-key.outputs.key }}
restore-keys: |
node-modules-${{ runner.os }}-
node-modules-
- 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