diff --git a/.github/workflows/test-release.yml b/.github/workflows/test-release.yml index edf43cea..ce4fb67f 100644 --- a/.github/workflows/test-release.yml +++ b/.github/workflows/test-release.yml @@ -87,7 +87,7 @@ jobs: tags: | unclecode/crawl4ai:test-${{ steps.get_version.outputs.VERSION }} unclecode/crawl4ai:test-latest - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max diff --git a/test_release.py b/test_release.py new file mode 100755 index 00000000..cec90824 --- /dev/null +++ b/test_release.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python3 +"""Test script for verifying Test PyPI and Docker releases""" + +import subprocess +import sys + +def test_pypi(): + print("=== Testing Test PyPI Package ===") + print("1. Creating virtual environment...") + subprocess.run([sys.executable, "-m", "venv", "test_env"], check=True) + + print("2. Installing from Test PyPI...") + pip_cmd = "./test_env/bin/pip" if sys.platform != "win32" else "test_env\\Scripts\\pip" + subprocess.run([ + pip_cmd, "install", "-i", "https://test.pypi.org/simple/", + "--extra-index-url", "https://pypi.org/simple/", # For dependencies + "crawl4ai==0.7.1" + ], check=True) + + print("3. Testing import...") + python_cmd = "./test_env/bin/python" if sys.platform != "win32" else "test_env\\Scripts\\python" + result = subprocess.run([ + python_cmd, "-c", + "from crawl4ai import AsyncWebCrawler; print('โœ… Import successful!'); print(f'Version: {__import__(\"crawl4ai\").__version__}')" + ], capture_output=True, text=True) + print(result.stdout) + if result.returncode != 0: + print(f"โŒ Error: {result.stderr}") + return False + + print("4. Cleaning up...") + import shutil + shutil.rmtree("test_env") + print("โœ… Test PyPI package test passed!\n") + return True + +def test_docker(): + print("=== Testing Docker Image ===") + print("1. Pulling test image...") + subprocess.run(["docker", "pull", "unclecode/crawl4ai:test-0.7.1"], check=True) + + print("2. Running version check...") + result = subprocess.run([ + "docker", "run", "--rm", "unclecode/crawl4ai:test-0.7.1", + "python", "-c", "import crawl4ai; print(f'Version: {crawl4ai.__version__}')" + ], capture_output=True, text=True) + print(result.stdout) + + print("3. Testing crawl4ai-doctor command...") + result = subprocess.run([ + "docker", "run", "--rm", "unclecode/crawl4ai:test-0.7.1", + "crawl4ai-doctor" + ], capture_output=True, text=True) + print(result.stdout[:500] + "..." if len(result.stdout) > 500 else result.stdout) + + print("โœ… Docker image test passed!\n") + return True + +if __name__ == "__main__": + print("๐Ÿงช Testing Crawl4AI Release Artifacts\n") + + pypi_ok = False + docker_ok = False + + try: + pypi_ok = test_pypi() + except Exception as e: + print(f"โŒ Test PyPI test failed: {e}") + + try: + docker_ok = test_docker() + except Exception as e: + print(f"โŒ Docker test failed: {e}") + + print("\n๐Ÿ“Š Summary:") + print(f"Test PyPI: {'โœ… Passed' if pypi_ok else 'โŒ Failed'}") + print(f"Docker Hub: {'โœ… Passed' if docker_ok else 'โŒ Failed'}") + + if pypi_ok and docker_ok: + print("\n๐ŸŽ‰ All tests passed! Ready for production release.") + else: + print("\nโš ๏ธ Some tests failed. Please fix before production release.") + sys.exit(1) \ No newline at end of file