From 11cfea4e91cef4c979b8acb421e87ca2de90d0ea Mon Sep 17 00:00:00 2001 From: Fons van der Plas Date: Tue, 16 Jul 2024 19:59:47 +0200 Subject: [PATCH 1/4] Run basic test on firefox --- .github/workflows/FrontendTest.yml | 2 +- .github/workflows/TestFirefox.yml | 97 ++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/TestFirefox.yml diff --git a/.github/workflows/FrontendTest.yml b/.github/workflows/FrontendTest.yml index 1c6ec28220..68f5b53ad1 100644 --- a/.github/workflows/FrontendTest.yml +++ b/.github/workflows/FrontendTest.yml @@ -1,4 +1,4 @@ -name: Pluto frontend tests +name: Chrome frontend tests # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the main branch diff --git a/.github/workflows/TestFirefox.yml b/.github/workflows/TestFirefox.yml new file mode 100644 index 0000000000..b646c02335 --- /dev/null +++ b/.github/workflows/TestFirefox.yml @@ -0,0 +1,97 @@ +name: Firefox basic launch test + +# same as the frontend tests +on: + push: + paths-ignore: + - "**.md" + branches: + - main + - release + pull_request: + paths-ignore: + - "**.md" + branches-ignore: + - release + + +jobs: + firefox-test: + runs-on: ubuntu-latest + timeout-minutes: 15 + strategy: + matrix: + firefox: ['latest-esr', 'latest'] + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v4 + + # Makes thes `julia` command available + - uses: julia-actions/setup-julia@v1 + with: + version: "1.6" # our lowest supported version + + - name: Install Pluto.jl packages + run: | + julia --project=$GITHUB_WORKSPACE -e "using Pkg; Pkg.instantiate()" + + - name: Setup firefox + id: setup-firefox + uses: browser-actions/setup-firefox@v1 + with: + firefox-version: ${{ matrix.firefox }} + + - run: | + echo Installed firefox versions: ${{ steps.setup-firefox.outputs.firefox-version }} + ${{ steps.setup-firefox.outputs.firefox-path }} --version + + - run: | + julia --project=$GITHUB_WORKSPACE -e 'import Pluto + + nb = Pluto.Notebook([ + Pluto.Cell("Text(x)"), + Pluto.Cell(""" + @bind x html"\"" + + "\"" + """) + ]) + + sesh = Pluto.ServerSession() + + Pluto.SessionActions.add(sesh, nb) + + @info "Running notebook..." + Pluto.update_save_run!(sesh, nb, nb.cells; run_async=false) + @info "Running notebook done" + + + get_x() = nb.cells[1].output.body + + @info "Value before" get_x() + + sesh.options.server.port = 1235 + + url = "http://localhost:$(sesh.options.server.port)/edit?secret=$(sesh.secret)&id=$(nb.notebook_id)" + + process = Pluto.run!(sesh) + + @info "Server started..." + sleep(3) + + browser_process = @async run(`${{ steps.setup-firefox.outputs.firefox-path }} -private-window $(url)`) + + begin + while get_x() == "missing" + @info "Waiting..." + sleep(1) + end + + @info "yay it worked!" get_x() + end' + + + From 7ba8e7b22b0f522899887d04bfa23aeb3f4453bf Mon Sep 17 00:00:00 2001 From: Fons van der Plas Date: Tue, 16 Jul 2024 20:03:30 +0200 Subject: [PATCH 2/4] headless? --- .github/workflows/TestFirefox.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/TestFirefox.yml b/.github/workflows/TestFirefox.yml index b646c02335..b29c7f2255 100644 --- a/.github/workflows/TestFirefox.yml +++ b/.github/workflows/TestFirefox.yml @@ -79,10 +79,11 @@ jobs: process = Pluto.run!(sesh) - @info "Server started..." + @info "Server started" sleep(3) - browser_process = @async run(`${{ steps.setup-firefox.outputs.firefox-path }} -private-window $(url)`) + @info "Starting firefox..." + browser_process = @async run(`${{ steps.setup-firefox.outputs.firefox-path }} -headless -private-window $(url)`) begin while get_x() == "missing" From 1d8e1e7a23f2b971147e5fe3af44d61f93f8db25 Mon Sep 17 00:00:00 2001 From: Fons van der Plas Date: Tue, 16 Jul 2024 20:15:21 +0200 Subject: [PATCH 3/4] Add sharper timeout --- .github/workflows/TestFirefox.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/TestFirefox.yml b/.github/workflows/TestFirefox.yml index b29c7f2255..783e737d74 100644 --- a/.github/workflows/TestFirefox.yml +++ b/.github/workflows/TestFirefox.yml @@ -84,11 +84,16 @@ jobs: @info "Starting firefox..." browser_process = @async run(`${{ steps.setup-firefox.outputs.firefox-path }} -headless -private-window $(url)`) + + tstart = time() begin while get_x() == "missing" @info "Waiting..." sleep(1) + if time() - tstart > 30 + error("This took too long!") + end end @info "yay it worked!" get_x() From c8a2a915d397a0fd7d1795d91292710de4585509 Mon Sep 17 00:00:00 2001 From: Fons van der Plas Date: Tue, 16 Jul 2024 20:16:04 +0200 Subject: [PATCH 4/4] only test est --- .github/workflows/TestFirefox.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestFirefox.yml b/.github/workflows/TestFirefox.yml index 783e737d74..4e5113957f 100644 --- a/.github/workflows/TestFirefox.yml +++ b/.github/workflows/TestFirefox.yml @@ -21,7 +21,7 @@ jobs: timeout-minutes: 15 strategy: matrix: - firefox: ['latest-esr', 'latest'] + firefox: ['latest-esr'] #, 'latest'] steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v4