Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better progress during github action run #7

Open
fonsp opened this issue Jul 1, 2024 · 0 comments
Open

Better progress during github action run #7

fonsp opened this issue Jul 1, 2024 · 0 comments

Comments

@fonsp
Copy link
Member

fonsp commented Jul 1, 2024

One thing I experimented with is using bore.pub during the action run to tunnel the Pluto server to a URL that you can visit while the notebook is running...

# ╔═╡ 155551e8-ddd7-4362-9b12-e8013477671b
Sys.ARCH

# ╔═╡ 7f367650-37b2-11ef-0669-f73f1b9bc6c9
url = "https://github.com/ekzhang/bore/releases/download/v0.5.1/bore-v0.5.1-aarch64-apple-darwin.tar.gz"
# url = "https://github.com/ekzhang/bore/releases/download/v0.5.1/bore-v0.5.1-x86_64-unknown-linux-musl.tar.gz"

# ╔═╡ 2e98af69-d4e2-4070-84bc-d41295da297c
tarpath = download(url)

# ╔═╡ 90d3b0a5-64cb-4d59-9fa3-926241540d91
begin
	outpath = mktempdir()
	run(`tar -xzf $tarpath -C $outpath`)
	outpath
end

# ╔═╡ 875bb0f2-2ec5-47a3-8b12-b40525af31f2
exec_path = joinpath(outpath, "bore")

# ╔═╡ 2e7bfdd1-8f92-4fb9-b98f-c0e5e68c5590
function bore(; port)

	cmd = `$exec_path local $port --to bore.pub`
	process = open(Cmd(
		cmd; 
		detach=true,
		windows_hide=true,
	), "w+")

	remote_port = nothing
	while remote_port === nothing
		m = match(r"listening at bore.pub:(\d+)", readline(process))
		if m !== nothing
			remote_port = parse(Int64, m[1])
		end
	end

	remote_url = "http://bore.pub:$remote_port"

	(; process, remote_port, remote_url)
end

# ╔═╡ a6c398fd-6664-4051-96e2-d9b16e5a9fa8
b = bore(port=1234)

# ╔═╡ a93d8254-1e05-4c32-939f-7a0aa1b6f615
Base.kill(b.process)

# ╔═╡ 9c41d0ca-dd2f-4c47-aa1d-69cf52f2684f
b.remote_port
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant