Skip to content

Fix installation via Homebrew #62

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

Merged
merged 1 commit into from
Apr 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,35 +32,41 @@ jobs:
with:
homebrew_owner: dflib
homebrew_tap: homebrew-tap
version: ${{ github.ref_name }}
depends_on: |
"jupyterlab"
"jupyterlab" => :test
"expect" => :test
target: jjava-${{ github.ref_name }}-kernelspec.zip
install: |
libexec.install Dir["*.jar"]
config = buildpath/"kernel.json"
inreplace config, "{resource_dir}", libexec
system "jupyter kernelspec install #{buildpath} --config=#{config} --sys-prefix --name=java"
(share/"jupyter/kernels/java").install config
caveats: |
kernel_path = share/"jupyter"
<<~EOS
The installation of the Homebrew package takes place in an isolated environment, so ensure JJava visibility by running:
echo 'export JUPYTER_PATH="#{kernel_path}:$JUPYTER_PATH"' >> ~/.zshrc; source ~/.zshrc (macOS)
echo 'export JUPYTER_PATH="#{kernel_path}:$JUPYTER_PATH"' >> ~/.bashrc; source ~/.bashrc (Linux)
Although JJava doesn't depend on java, it requires jre>=11 to run.
Make sure you have one in your PATH.
EOS
test: |
jupyter = Formula["jupyterlab"].opt_bin/"jupyter"
ENV["JUPYTER_PATH"] = share/"jupyter"
assert_match " java ", shell_output("#{jupyter} kernelspec list")

(testpath/"console.exp").write <<~EOS
spawn #{jupyter} console --kernel=java
expect -timeout 30 "In "
send "System.out.println(\\\"Hello world!\\\");\r"
send {System.out.println("Hello world!");\r}
expect -timeout 10 "In "
send "\u0004"
expect -timeout 10 "exit"
send "y\r"
EOS
EOS
output = shell_output("expect -f console.exp")
assert_match "JJava kernel #{version}", output
assert_match "Hello world!", output
caveats: |
Although JJava doesn't depend on java, it requires jre>=11 to run.
Make sure you have one in your PATH.
update_readme_table: true
github_token: ${{ secrets.HOMEBREW_RELEASE_ACCESS_TOKEN }}
debug: ${{ runner.debug }}