-
Notifications
You must be signed in to change notification settings - Fork 8
72 lines (65 loc) · 2.52 KB
/
release.yml
File metadata and controls
72 lines (65 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: 'release packages'
on:
release:
types: [published]
jobs:
release-pypi:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Download release assets
uses: robinraju/release-downloader@v1
with:
tag: ${{ github.ref_name }}
fileName: jjava-!(kernelspec)*@(.tar.gz|.whl)
out-file-path: dist/
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: ${{ runner.debug }}
release-homebrew:
runs-on: ubuntu-latest
steps:
- name: Publish package to Homebrew
uses: m-dzianishchyts/brewtap@v1
with:
homebrew_owner: dflib
homebrew_tap: homebrew-tap
depends_on: |
"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
(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}
expect -timeout 10 "In "
send "\u0004"
expect -timeout 10 "exit"
send "y\r"
EOS
output = shell_output("expect -f console.exp")
assert_match "JJava kernel #{version}", output
assert_match "Hello world!", output
update_readme_table: true
github_token: ${{ secrets.HOMEBREW_RELEASE_ACCESS_TOKEN }}
debug: ${{ runner.debug }}