diff --git a/.gitea/workflows/cache_test.yaml b/.gitea/workflows/cache_test.yaml index cafaa83..3807400 100644 --- a/.gitea/workflows/cache_test.yaml +++ b/.gitea/workflows/cache_test.yaml @@ -1,35 +1,36 @@ -name: CI Cache Directory Test +name: CI Built-in Cache Test on: [push] jobs: test-cache: runs-on: ubuntu-latest steps: - - name: Check Cache and Simulate Asset Download + - name: Check out repository code + uses: actions/checkout@v4 + + # 1. Ask Gitea to look for an existing cache match + - name: Cache Mock Engine + id: engine-cache + uses: actions/cache@v4 + with: + path: ./mock_downloads # The folder we want to preserve + key: mock-engine-cache-v1 # The unique identifier for this cache + + # 2. This step only runs if there was a CACHE MISS + - name: Simulate Asset Download (On Cache Miss) + if: steps.engine-cache.outputs.cache-hit != 'true' run: | - CACHE_DIR="/root/.godot-si-cache/test-version" - TARGET_FILE="./dummy_engine.txt" - - echo "🔍 Checking if target directory persistent cache exists..." - - if [ -f "${CACHE_DIR}/dummy_engine.txt" ]; then - echo "🚀 CACHE HIT! Found dummy asset in cache. Copying..." - cp "${CACHE_DIR}/dummy_engine.txt" "$TARGET_FILE" - echo "✅ Content inside cached asset: $(cat $TARGET_FILE)" - else - echo "📥 CACHE MISS! Creating a lightweight mock asset..." - - # Simulate generating a download asset - echo "Mock Godot Engine Data v4.7" > "$TARGET_FILE" - - echo "💾 Attempting to save asset to host persistent cache path..." - mkdir -p "${CACHE_DIR}" - cp "$TARGET_FILE" "${CACHE_DIR}/dummy_engine.txt" - echo "🎯 Asset saved to cache directory successfully." - fi + echo "📥 CACHE MISS! Creating the folder and simulating a file download..." + mkdir -p ./mock_downloads + echo "Mock Godot Engine Data v4.7" > ./mock_downloads/dummy_engine.txt + # 3. This runs ALWAYS to verify the file is where it should be - name: Verify Workspace Output run: | - echo "Checking workspace execution folder:" - ls -la ./dummy_engine.txt - echo "File content: $(cat ./dummy_engine.txt)" + echo "🔍 Verifying file presence..." + if [ -f "./mock_downloads/dummy_engine.txt" ]; then + echo "✅ File found! Content: $(cat ./mock_downloads/dummy_engine.txt)" + else + echo "❌ File not found!" + exit 1 + fi