name: Validate Inference on: push: branches: - main workflow_dispatch: jobs: validate: runs-on: ubuntu-latest env: HF_TOKEN: ${{ secrets.HF_TOKEN }} QED_MATH_URL: ${{ vars.QED_MATH_URL }} MAX_STEPS: "8" steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.13" - name: Install uv uses: astral-sh/setup-uv@v5 - name: Install dependencies run: uv sync - name: Validate CI variables shell: bash run: | if [ -z "${HF_TOKEN}" ]; then echo "::error::HF_TOKEN is empty or undefined. Configure repository secret HF_TOKEN." exit 1 fi if [ -z "${QED_MATH_URL}" ]; then echo "::error::QED_MATH_URL is empty or undefined. Configure repository variable QED_MATH_URL." exit 1 fi echo "QED_MATH_URL=${QED_MATH_URL}" - name: Verify QED Math endpoint shell: bash run: | BASE_URL="${QED_MATH_URL%/}" for attempt in 1 2 3 4 5; do code=$(curl -sS -o /dev/null -w "%{http_code}" -X POST \ -H "Content-Type: application/json" -d '{}' \ "${BASE_URL}/reset" || echo "000") if [ "${code}" = "200" ]; then echo "Endpoint is reachable at ${BASE_URL}/reset" exit 0 fi echo "Attempt ${attempt}/5: ${BASE_URL}/reset returned HTTP ${code}; retrying..." sleep 6 done echo "::error::Unable to reach ${BASE_URL}/reset after retries. Check URL and Space status." exit 1 - name: Run inference run: uv run python inference.py