diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48c8a7521..076072ea0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,10 +5,12 @@ on: branches: - main - release-* + - robocorp-release-* pull_request: branches: - main - release-* + - robocorp-release-* concurrency: # For pull requests, cancel all currently-running jobs for this workflow diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2f3ce0a27..bdb49807b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,7 +1,9 @@ name: Upload Python Package on: - release: - types: [published] + workflow_dispatch: + # release: + # types: [published] + jobs: deploy-pypi: runs-on: ubuntu-latest diff --git a/.github/workflows/trigger_internal_tests.yml b/.github/workflows/trigger_internal_tests.yml index b4e6c21db..412461fbf 100644 --- a/.github/workflows/trigger_internal_tests.yml +++ b/.github/workflows/trigger_internal_tests.yml @@ -1,10 +1,11 @@ name: "Internal Tests" on: - push: - branches: - - main - - release-* + workflow_dispatch: + # push: + # branches: + # - main + # - release-* jobs: trigger: diff --git a/setup.py b/setup.py index 79ab19e30..1f0b03622 100644 --- a/setup.py +++ b/setup.py @@ -59,6 +59,18 @@ def download_driver(zip_name: str) -> None: subprocess.check_call(["curl", url, "-o", "driver/" + zip_file]) +def patch_driver(driver_path: str)->None: + print(f"== Patching to {driver_path}") + print(f"== Copy patch zip from: ../playwright/utils/robocorp_patch.zip") + shutil.copyfile("../playwright/utils/robocorp_patch.zip", "./build/robocorp_patch.zip") + print(f"== Unpacking to: ./build/robocorp_patch") + shutil.unpack_archive("./build/robocorp_patch.zip", "./build/robocorp_patch", "zip") + print(f"== Patching files...") + shutil.copytree( "./build/robocorp_patch/lib", os.path.join(driver_path, "package/lib"), dirs_exist_ok=True) + shutil.copyfile( "./build/robocorp_patch/browsers.json", os.path.join(driver_path, "package/browsers.json")) + print(f"== Done patching!") + + class PlaywrightBDistWheelCommand(BDistWheelCommand): user_options = BDistWheelCommand.user_options + [ ("all", "a", "create wheels for all platforms") @@ -121,6 +133,7 @@ def run(self) -> None: }, ] self._download_and_extract_local_driver(base_wheel_bundles) + patch_driver("playwright/driver") wheels = base_wheel_bundles if not self.all: @@ -147,6 +160,7 @@ def _build_wheels( ) with zipfile.ZipFile(zip_file, "r") as zip: extractall(zip, f"driver/{wheel_bundle['zip_name']}") + patch_driver(f"driver/{wheel_bundle['zip_name']}") wheel_location = without_platform + wheel_bundle["wheel"] shutil.copy(base_wheel_location, wheel_location) with zipfile.ZipFile(wheel_location, "a") as zip: @@ -198,16 +212,16 @@ def _download_and_extract_local_driver( setup( - name="playwright", - author="Microsoft Corporation", + name="robocorp-playwright", + author="Robocorp/Microsoft", author_email="", description="A high-level API to automate web browsers", long_description=Path("README.md").read_text(encoding="utf-8"), long_description_content_type="text/markdown", license="Apache-2.0", - url="https://github.com/Microsoft/playwright-python", + url="https://github.com/robocorp/playwright-python", project_urls={ - "Release notes": "https://github.com/microsoft/playwright-python/releases", + "Release notes": "https://github.com/robocorp/playwright-python/releases", }, packages=["playwright"], include_package_data=True,