From b2285efe9eaabe79bf184832d06caeceb610a2b6 Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Mon, 25 Nov 2024 12:02:21 -0500 Subject: [PATCH 01/16] Add new download to gha --- .github/workflows/test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a5d0420f..212b1feb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,10 +7,12 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v1 # Would be nice to bump this? Regressions. - - name: Install Dependencies - run: sudo apt-get update && sudo apt-get install chromium-browser xvfb + - name: Install Dependencies- Other + run: sudo apt-get update && sudo apt-get install xvfb curl wget jq unzip timeout-minutes: 4 # because sometimes it dies #- uses: ./.github/actions/ # it would be nice but it doesn't support timeout-minutes + - name: Install Dependencies- Chrome + run: wget $(curl -s https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json | jq -r '.versions.[-1].downloads.chrome.[] | select(.platform == "linux64").url') && unzip chrome* && export BROWSER_PATH="$(realpath chrome-linux64)/chrome" - name: Install choreographer run: pip install .[dev] - name: DTDoctor From 99218b6e3d69ec884f6129a3a8fb55154ed76354 Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Mon, 25 Nov 2024 12:09:50 -0500 Subject: [PATCH 02/16] Create helper script for download chrome --- .github/workflows/download_chrome.sh | 5 +++++ .github/workflows/test.yml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/download_chrome.sh diff --git a/.github/workflows/download_chrome.sh b/.github/workflows/download_chrome.sh new file mode 100644 index 00000000..6215dfea --- /dev/null +++ b/.github/workflows/download_chrome.sh @@ -0,0 +1,5 @@ +set -e +wget $(curl -s https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json | +jq -r '.versions.[-1].downloads.chrome.[] | select(.platform == "'"${1}"'").url') +unzip chrome* +export BROWSER_PATH="$(realpath chrome-linux64)/chrome" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 212b1feb..ec310cbc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: timeout-minutes: 4 # because sometimes it dies #- uses: ./.github/actions/ # it would be nice but it doesn't support timeout-minutes - name: Install Dependencies- Chrome - run: wget $(curl -s https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json | jq -r '.versions.[-1].downloads.chrome.[] | select(.platform == "linux64").url') && unzip chrome* && export BROWSER_PATH="$(realpath chrome-linux64)/chrome" + run: chmod +x ./.github/workflows/download_chrome.sh && ./.github/workflows/download_chrome.sh "linux64" - name: Install choreographer run: pip install .[dev] - name: DTDoctor From 378ba149ce92422403629b2d30d7a2823256a255 Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Mon, 25 Nov 2024 12:10:40 -0500 Subject: [PATCH 03/16] Add shebang for bash to script --- .github/workflows/download_chrome.sh | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 .github/workflows/download_chrome.sh diff --git a/.github/workflows/download_chrome.sh b/.github/workflows/download_chrome.sh old mode 100644 new mode 100755 index 6215dfea..f290bbad --- a/.github/workflows/download_chrome.sh +++ b/.github/workflows/download_chrome.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash set -e wget $(curl -s https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json | jq -r '.versions.[-1].downloads.chrome.[] | select(.platform == "'"${1}"'").url') From 15753097c79f0a160092474e8cac3eed7022e890 Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Mon, 25 Nov 2024 12:18:07 -0500 Subject: [PATCH 04/16] Try different JQ quoting syntax --- .github/workflows/download_chrome.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/download_chrome.sh b/.github/workflows/download_chrome.sh index f290bbad..c8280d67 100755 --- a/.github/workflows/download_chrome.sh +++ b/.github/workflows/download_chrome.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -e wget $(curl -s https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json | -jq -r '.versions.[-1].downloads.chrome.[] | select(.platform == "'"${1}"'").url') +jq -r ".versions.[-1].downloads.chrome.[] | select(.platform == \"${1}\").url") unzip chrome* export BROWSER_PATH="$(realpath chrome-linux64)/chrome" From 121ddacc0fbe63d6dbff687128dcb46e43c70f6e Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Mon, 25 Nov 2024 12:21:39 -0500 Subject: [PATCH 05/16] Try formal jq syntax --- .github/workflows/download_chrome.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/download_chrome.sh b/.github/workflows/download_chrome.sh index c8280d67..b142f719 100755 --- a/.github/workflows/download_chrome.sh +++ b/.github/workflows/download_chrome.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -e wget $(curl -s https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json | -jq -r ".versions.[-1].downloads.chrome.[] | select(.platform == \"${1}\").url") +jq -r ".versions | .[-1] | .downloads.chrome | .[] | select(.platform == \"${1}\").url") unzip chrome* export BROWSER_PATH="$(realpath chrome-linux64)/chrome" From 2e801a139cc351f96c1d1d7b8082cedd5e3c9554 Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Mon, 25 Nov 2024 21:26:10 -0500 Subject: [PATCH 06/16] Try bash script on windows GHA --- .github/workflows/download_chrome.sh | 2 +- .github/workflows/test.yml | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/download_chrome.sh b/.github/workflows/download_chrome.sh index b142f719..7dfc8f8a 100755 --- a/.github/workflows/download_chrome.sh +++ b/.github/workflows/download_chrome.sh @@ -3,4 +3,4 @@ set -e wget $(curl -s https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json | jq -r ".versions | .[-1] | .downloads.chrome | .[] | select(.platform == \"${1}\").url") unzip chrome* -export BROWSER_PATH="$(realpath chrome-linux64)/chrome" +export BROWSER_PATH="$(realpath "chrome-${1}")/chrome" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ec310cbc..914290c5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,10 +39,11 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 - - name: Install Dependencies - run: choco install googlechrome -y --ignore-checksums - timeout-minutes: 4 # because sometimes it dies - #- uses: ./.github/actions/ + - name: Install Dependencies- Other + run: choco install curl wget jq unzip + #- uses: ./.github/actions/ # it would be nice but it doesn't support timeout-minutes + - name: Install Dependencies- Chrome + run: ./.github/workflows/download_chrome.sh "win64" - name: Install choreographer run: pip install .[dev] - name: DTDoctor From 3a1d3e54c93b520c252172172beac19bae2c466d Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Mon, 25 Nov 2024 21:30:53 -0500 Subject: [PATCH 07/16] Switcht to powershell for windows --- .github/workflows/download_chrome.ps | Bin 0 -> 966 bytes .github/workflows/test.yml | 4 +--- 2 files changed, 1 insertion(+), 3 deletions(-) create mode 100644 .github/workflows/download_chrome.ps diff --git a/.github/workflows/download_chrome.ps b/.github/workflows/download_chrome.ps new file mode 100644 index 0000000000000000000000000000000000000000..b960ab91cebd32130bf1a8a10fdb07fb63b9c3df GIT binary patch literal 966 zcmZvb(Qn!?5XRs0SDeyF&}|OeYb74Km9CYx6~Pb>T~#^ZO57SdJv%_R^?%>lAq=!V zS&8pH|L*hW6Buok2WtR{EG5|}Ea#^|SyD)1Tpn*7Se zQ{>rwS1m@{TAIa}Ig$JeG^B(77oE8Q@TaQbL1|2O#?G;r;B&+Nw8kEBi<`!?4G3wA zmveXYW@ds;(Ca2(3!-d`AkL|*)EYsIC13AhJBW*T88YTB?&eW*x(i!DcH`Lin)i}y z_Z4M^(C0*oPnFV(YmY0IQpEFHdik$$-{gu3Vq|v&;!O&#r}<^0b=-Ul>5q1_h`{ic z+Q=VLfOH`F*_gE=YgTAHtR*L*U}ySWKFWsp0eNufLa_NcaQ)fG$<2H^n%s}izh8wI a9E_7Bb5b6~m1XbKqe2&~u<(xpL;eAQze@}N literal 0 HcmV?d00001 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 914290c5..6ed7fd1a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,11 +39,9 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 - - name: Install Dependencies- Other - run: choco install curl wget jq unzip #- uses: ./.github/actions/ # it would be nice but it doesn't support timeout-minutes - name: Install Dependencies- Chrome - run: ./.github/workflows/download_chrome.sh "win64" + run: ./.github/workflows/download_chrome.ps "win64" - name: Install choreographer run: pip install .[dev] - name: DTDoctor From 77cc256405dff56d792fdda850eae62fcc3b2de7 Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Mon, 25 Nov 2024 21:34:23 -0500 Subject: [PATCH 08/16] Improve powershell script w/ output --- .../{download_chrome.ps => download_chrome.ps1} | Bin 966 -> 980 bytes .github/workflows/test.yml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{download_chrome.ps => download_chrome.ps1} (98%) diff --git a/.github/workflows/download_chrome.ps b/.github/workflows/download_chrome.ps1 similarity index 98% rename from .github/workflows/download_chrome.ps rename to .github/workflows/download_chrome.ps1 index b960ab91cebd32130bf1a8a10fdb07fb63b9c3df..fce97474b41785e9c669f704480a54c5a819dd5c 100644 GIT binary patch delta 38 tcmX@ceuZ6DS;4g;vqT|3Pa(CaD8Gn{D>XSIUqLA(wYWryYa{=5W&rUk3?%>n delta 24 fcmcb@evF-8S;4g;vqT|3Pa(CaD8Fc<>~>}VWikk4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6ed7fd1a..da651178 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,7 +41,7 @@ jobs: - uses: actions/setup-python@v5 #- uses: ./.github/actions/ # it would be nice but it doesn't support timeout-minutes - name: Install Dependencies- Chrome - run: ./.github/workflows/download_chrome.ps "win64" + run: .\.github\workflows\download_chrome.ps1 "win64" - name: Install choreographer run: pip install .[dev] - name: DTDoctor From f38d079bebff945fddd2775fc8867bf9b175da31 Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Mon, 25 Nov 2024 21:40:01 -0500 Subject: [PATCH 09/16] Update dtdoctor to print used browser --- choreographer/browser.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/choreographer/browser.py b/choreographer/browser.py index 2bb27be5..183273db 100644 --- a/choreographer/browser.py +++ b/choreographer/browser.py @@ -818,6 +818,7 @@ def diagnose(): try: print("Sync test headless".center(50, "*")) browser = Browser(debug=True, debug_browser=True, headless=True) + print(browser.path) time.sleep(3) browser.close() except BaseException as e: @@ -826,6 +827,7 @@ def diagnose(): print("Done with sync test headless".center(50, "*")) async def test_headless(): browser = await Browser(debug=True, debug_browser=True, headless=True) + print(browser.path) await asyncio.sleep(3) await browser.close() try: From 24c99ba81ccbc9f966cac58db4f19b614a2d0cb8 Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Mon, 25 Nov 2024 21:45:19 -0500 Subject: [PATCH 10/16] Improve output of debug tools --- .github/workflows/download_chrome.ps1 | 2 -- choreographer/browser.py | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/download_chrome.ps1 b/.github/workflows/download_chrome.ps1 index fce97474..93b09bf0 100644 --- a/.github/workflows/download_chrome.ps1 +++ b/.github/workflows/download_chrome.ps1 @@ -1,7 +1,5 @@ # Exit on error -echo "Test" - $ErrorActionPreference = "Stop" # Get the platform (like 'win', 'mac', 'linux') diff --git a/choreographer/browser.py b/choreographer/browser.py index 183273db..d9896c3d 100644 --- a/choreographer/browser.py +++ b/choreographer/browser.py @@ -802,7 +802,8 @@ def diagnose(): print(platform.version()) print(platform.uname()) print("Looking for browser:".center(50, "*")) - print(which_browser(debug=True)) + print(f"which: {which_browser(debug=True)}") + print(f"os.environ: {os.environ.get('BROWSER_PATH')}") try: print("Looking for version info:".center(50, "*")) print(subprocess.check_output([sys.executable, '-m', 'pip', 'freeze'])) From fc453824daaafe7984f81f9dc1d4295580346bec Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Mon, 25 Nov 2024 21:51:51 -0500 Subject: [PATCH 11/16] Try different env var config --- .github/workflows/download_chrome.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/download_chrome.ps1 b/.github/workflows/download_chrome.ps1 index 93b09bf0..246b588a 100644 --- a/.github/workflows/download_chrome.ps1 +++ b/.github/workflows/download_chrome.ps1 @@ -22,6 +22,6 @@ $browserPath = (Get-ChildItem -Directory | Where-Object { $_.Name -like "chrome- # Export the browser path as an environment variable (for the current session) $env:BROWSER_PATH = $browserPath +[Environment]::SetEnvironmentVariable("BROWSER_PATH", $browserPath, "Machine") Write-Host "BROWSER_PATH set to $env:BROWSER_PATH" - From 154394473188833f3ace293a2309689971f8a223 Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Mon, 25 Nov 2024 21:58:04 -0500 Subject: [PATCH 12/16] Try setting env var with $GITHUB_ENV --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index da651178..b9dc7927 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,6 +42,8 @@ jobs: #- uses: ./.github/actions/ # it would be nice but it doesn't support timeout-minutes - name: Install Dependencies- Chrome run: .\.github\workflows\download_chrome.ps1 "win64" + - name: Set Env + run: echo "BROWSER_PATH=$(realpath ./chrome-win64/chrome.exe)" >> $GITHUB_ENV - name: Install choreographer run: pip install .[dev] - name: DTDoctor From 7dad48f47a4d8eea730a2f0a3ee22374f3a1ed0c Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Mon, 25 Nov 2024 22:00:38 -0500 Subject: [PATCH 13/16] Add more tests to windows GHA --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b9dc7927..a46ffb26 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,8 +46,10 @@ jobs: run: echo "BROWSER_PATH=$(realpath ./chrome-win64/chrome.exe)" >> $GITHUB_ENV - name: Install choreographer run: pip install .[dev] + - name: Check + run: ls ./chrome-win64 - name: DTDoctor - run: dtdoctor --no-run + run: BROWSER_PATH="$(realpath ./chrome-win64/chrome.exe)" dtdoctor --no-run timeout-minutes: 1 - name: Test Process Control DEBUG if: runner.debug From 095963c09cc4a1003929cfdc4f1dc0750590227e Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Mon, 25 Nov 2024 22:05:43 -0500 Subject: [PATCH 14/16] Try powershell syntax in GHA specification --- .github/workflows/test.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a46ffb26..3633662f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,13 +43,11 @@ jobs: - name: Install Dependencies- Chrome run: .\.github\workflows\download_chrome.ps1 "win64" - name: Set Env - run: echo "BROWSER_PATH=$(realpath ./chrome-win64/chrome.exe)" >> $GITHUB_ENV + run: echo "BROWSER_PATH=$(Resolve-Path .\chrome-win64\chrome.exe)" >> $env:GITHUB_ENV - name: Install choreographer run: pip install .[dev] - - name: Check - run: ls ./chrome-win64 - name: DTDoctor - run: BROWSER_PATH="$(realpath ./chrome-win64/chrome.exe)" dtdoctor --no-run + run: dtdoctor --no-run timeout-minutes: 1 - name: Test Process Control DEBUG if: runner.debug From 42d41860ec7f328c4855dbd6380f83bb709bc9e7 Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Mon, 25 Nov 2024 22:22:02 -0500 Subject: [PATCH 15/16] Remove headless=old --- choreographer/chrome_wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/choreographer/chrome_wrapper.py b/choreographer/chrome_wrapper.py index 12095951..106d879b 100644 --- a/choreographer/chrome_wrapper.py +++ b/choreographer/chrome_wrapper.py @@ -49,7 +49,7 @@ def open_browser(to_chromium, from_chromium, stderr=sys.stderr, env=None, loop=N cli.append("--no-sandbox") if "HEADLESS" in env: - cli.append("--headless=old") # temporary fix + cli.append("--headless") system_dependent = {} if system == "Windows": From 30c247794f410736bd6ed44f4a396ae5e9dcd836 Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Mon, 25 Nov 2024 22:39:58 -0500 Subject: [PATCH 16/16] Change headless explicitly to new --- choreographer/chrome_wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/choreographer/chrome_wrapper.py b/choreographer/chrome_wrapper.py index 106d879b..43e9ed48 100644 --- a/choreographer/chrome_wrapper.py +++ b/choreographer/chrome_wrapper.py @@ -49,7 +49,7 @@ def open_browser(to_chromium, from_chromium, stderr=sys.stderr, env=None, loop=N cli.append("--no-sandbox") if "HEADLESS" in env: - cli.append("--headless") + cli.append("--headless=new") system_dependent = {} if system == "Windows":