ikawaha / kagome

Self-contained Japanese Morphological Analyzer written in pure Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Releasing the binaries in the assets (preparation for Homebrew)

KEINOS opened this issue · comments

Feature request

TL; DR

It would be nice if one can download the compiled binary from the releases.

TS; DR

This is a feature request as a preparation to let Kagome command (binary) be downloaded via Homebrew, the package manager for macOS, Linux, and Windows Subsystem for Linux (WSL2).

Not to compete or go against MeCab but I would love to see Kagome in Homebrew as well.

brew install kagome

To do so, we need a repo with the name homebrew-kagome and place the formula.

I can help to make the formula, BUT before all, we need the official binaries to be released in the assets in order to get the proper hash value which is required to include in the formula.

So, since we have a GitHub action that tests on all Linux, Windows, and macOS in the dispatch workflow, I think it's not that difficult to add go build directions for each OS and release them.

I would like to hear your opinions. What do you think about it?

Refs

Thank you for your suggestion. I'd like to try it.

Publishing to homebrew repo (ikawaha/homebrew-kagome) is failed. 😇

       • homebrew tap formula
         • writing                   formula=dist/kagome.rb
         • pipe skipped              error=publishing is disabled

No problem. At least we stepped forward!

I will look at them as soon as I confirm the ARM and Windows binary work. Darwin (macOS) worked like a charm!

@ikawaha

When you are available, will you push something to the ikawaha/homebrew-kagome repo, so that I can fork it?

An empty README.md and LICENSE should be enough.

Publishing to homebrew repo (ikawaha/homebrew-kagome) is failed. 😇

       • homebrew tap formula
         • writing                   formula=dist/kagome.rb
         • pipe skipped              error=publishing is disabled

The reason for the above case is that the snapshot release does not trigger the deployment. I tagged the release and it was deployed to the homebrew-kagome repository.
https://github.com/ikawaha/homebrew-kagome

the snapshot release does not trigger the deployment

Indeed. I notice that from ⚠️ No tag found for commit '3875979'. Snapshot forced error. I will drop down the PR then!

21:12 $ brew tap ikawaha/homebrew-kagome
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 3 taps (homebrew/cask-versions, homebrew/core and homebrew/cask).
==> New Formulae
ncspot                                                    node@14
==> Updated Formulae
Updated 60 formulae.
==> Deleted Formulae
boost@1.55                   boost@1.59                   mysql-connector-c++@1.1      scw@1
==> New Casks
padloc
==> Updated Casks
altserver                    imazing                      multitouch                   springtoolsuite
anonym                       insomnia                     musictube                    staruml
bbedit                       insomnia-designer            naver-whale                  stoplight-studio
brave-browser                isteg                        niftyman                     switchhosts
brave-browser-beta           itubedownloader              opera-developer              syntax-highlight
brave-browser-dev            kite                         paperspace                   teamviewer
butt                         ledger-live                  pflists                      thebrain
cacher                       listen1                      pulse-sms                    tongbu
cleanshot                    logos                        qgis                         trilium-notes
clipgrab                     lrtimelapse                  qownnotes                    visual-studio-code-insiders
customshortcuts              mactracker                   quail                        wasabi-wallet
djay-pro                     marsedit                     remotix-agent                wechatwebdevtools
electerm                     marvin                       rotki                        whale
element                      mattermost                   rstudio                      wormhole
eul                          messenger                    scrutiny                     yate
firefox                      metabase                     seafile-client               youdaodict
freedom                      mic-drop                     sharepod                     zoc
garagebuy                    microsoft-edge               sipgate-softphone
http-toolkit                 microsoft-edge-beta          sizzy
icefloor                     minitube                     skybox
==> Deleted Casks
levelator

==> Tapping ikawaha/kagome
Cloning into '/usr/local/Homebrew/Library/Taps/ikawaha/homebrew-kagome'...
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 7 (delta 0), reused 3 (delta 0), pack-reused 0
Receiving objects: 100% (7/7), done.
Tapped 1 formula (27 files, 28KB).
✔ ~/go/src/github.com/ikawaha/kagome [v2 L|…9⚑ 1]
22:33 $ brew install kagome
Updating Homebrew...
==> Installing kagome from ikawaha/kagome
==> Downloading https://homebrew.bintray.com/bottles/go-1.15.3.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/6bd0119a31c1ae26831105490a67b97bed5d0fd2c6ad140cdf4c84aa
######################################################################## 100.0%
==> Downloading https://github.com/ikawaha/kagome/releases/download/v2.3.1/kagome_2.3.1_darwin_amd64.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/21228174/5e07f000-1962-11eb-93
######################################################################## 100.0%
==> Installing dependencies for ikawaha/kagome/kagome: go
==> Installing ikawaha/kagome/kagome dependency: go
==> Pouring go-1.15.3.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/go/1.15.3: 9,780 files, 494.3MB
==> Installing ikawaha/kagome/kagome
🍺  /usr/local/Cellar/kagome/2.3.1: 5 files, 62MB, built in 5 seconds
✔ ~/go/src/github.com/ikawaha/kagome [v2 L|…9⚑ 1]
22:34 $ kagome version
2.3.1

I confirm that brew works on macOS by brew install ikawaha/kagome/kagome.

But it installs golang as a dependency as well, which is not needed and spends around 500 MB more of storage.

$ brew install ikawaha/kagome/kagome
Updating Homebrew...
==> Tapping ikawaha/kagome
Cloning into '/usr/local/Homebrew/Library/Taps/ikawaha/homebrew-kagome'...
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 7 (delta 0), reused 3 (delta 0), pack-reused 0
Unpacking objects: 100% (7/7), 1.12 KiB | 164.00 KiB/s, done.
Tapped 1 formula (32 files, 27.6KB).
==> Installing kagome from ikawaha/kagome
==> Downloading https://homebrew.bintray.com/bottles/go-1.15.3.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/6bd0119a31c1ae26831105490a67b97bed5d0fd2c6ad140cdf4c84aa7a315af2?response-content-disposition=attachment%3Bfilename%3D%22go-1.15.3.catalina.bottle.tar.gz%22&Policy=eyJTdGF0ZW1lbnQiOiBbeyJSZXNvdXJjZSI6Imh0dHAqOi8vZDI5dnprNG93
######################################################################## 100.0%
==> Downloading https://github.com/ikawaha/kagome/releases/download/v2.3.1/kagome_2.3.1_darwin_amd64.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/21228174/5e07f000-1962-11eb-93f0-86a23b66a92f?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20201028%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201028T132621Z&X-Amz-Expi
######################################################################## 100.0%
==> Installing dependencies for ikawaha/kagome/kagome: go <----------- here
==> Installing ikawaha/kagome/kagome dependency: go <----------------- here
==> Pouring go-1.15.3.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/go/1.15.3: 9,780 files, 494.3MB
==> Installing ikawaha/kagome/kagome
🍺  /usr/local/Cellar/kagome/2.3.1: 5 files, 62MB, built in 5 seconds

$ kagome version
2.3.1
$ # 🎉

Remove dependencies 46378f5

$ brew install kagome
Updating Homebrew...
==> Installing kagome from ikawaha/kagome
==> Downloading https://github.com/ikawaha/kagome/releases/download/v2.3.2/kagome_2.3.2_darwin_amd64.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/21228174/c361de00-196e-11eb-81
######################################################################## 100.0%
🍺  /usr/local/Cellar/kagome/2.3.2: 5 files, 62MB, built in 3 seconds
Removing: /Users/ikawaha/Library/Caches/Homebrew/kagome--2.3.1.tar.gz... (57.0MB)
$ kagome version
2.3.2

Chill! You nailed it! 👍

$ brew uninstall kagome
Uninstalling /usr/local/Cellar/kagome/2.3.1... (5 files, 62MB)
$ brew untap ikawaha/kagome
Untapping ikawaha/kagome...
Untapped 1 formula (32 files, 27.6KB).
$ go version
-bash: /usr/local/bin/go: No such file or directory
$ kagome version
-bash: kagome: command not found
$ brew install ikawaha/kagome/kagome
Updating Homebrew...
==> Installing kagome from ikawaha/kagome
==> Downloading https://github.com/ikawaha/kagome/releases/download/v2.3.2/kagome_2.3.2_darwin_amd64.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/21228174/c361de00-196e-11eb-81a2-9c034d677cd3?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20201028%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201028T134722Z&X-Amz-Expi
######################################################################## 100.0%
🍺  /usr/local/Cellar/kagome/2.3.2: 5 files, 62MB, built in 5 seconds
Removing: /Users/admin/Library/Caches/Homebrew/kagome--2.3.1.tar.gz... (57.0MB)

$ kagome version
2.3.2

$ echo 'すもももももももものうち' | kagome
すもも	名詞,一般,*,*,*,*,すもも,スモモ,スモモ
も	助詞,係助詞,*,*,*,*,も,モ,モ
もも	名詞,一般,*,*,*,*,もも,モモ,モモ
も	助詞,係助詞,*,*,*,*,も,モ,モ
もも	名詞,一般,*,*,*,*,もも,モモ,モモ
の	助詞,連体化,*,*,*,*,の,ノ,ノ
うち	名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ
EOS
$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.15.7
BuildVersion:	19H2
$ brew --version
Homebrew 2.5.7
Homebrew/homebrew-core (git revision 8a3edd; last commit 2020-10-28)
Homebrew/homebrew-cask (git revision 5cb58; last commit 2020-10-28)

Confirmed on Ubuntu via Docker @ AMD.

$ docker run --rm homebrew/brew brew install ikawaha/kagome/kagome && kagome version && echo 'すもももももももものうち' | kagome
Updating Homebrew...
==> Homebrew has enabled anonymous aggregate formula and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics have been recorded yet (or will be during this `brew` run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
bit-git
fnm
libslirp
pdm
==> Updated Formulae
Updated 89 formulae.

==> Tapping ikawaha/kagome
Cloning into '/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/ikawaha/homebrew-kagome'...
Tapped 1 formula (27 files, 102.1KB).
==> Installing kagome from ikawaha/kagome
==> Downloading https://github.com/ikawaha/kagome/releases/download/v2.3.2/kagome_2.3.2_linux_amd64.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/21228174/c4930b00-196e-11eb-941c-3e2493352f3c?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20201028%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201028T140426Z&X-Amz-Expires=300&X-Amz-Signature=6b81eb411590f2efa98059eb87b2f375e4c199116dc1e65c7d48b890858b47d7&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=21228174&response-content-disposition=attachment%3B%20filename%3Dkagome_2.3.2_linux_amd64.tar.gz&response-content-type=application%2Foctet-stream
🍺  /home/linuxbrew/.linuxbrew/Cellar/kagome/2.3.2: 5 files, 61.5MB, built in 4 seconds
2.3.2
すもも	名詞,一般,*,*,*,*,すもも,スモモ,スモモ
も	助詞,係助詞,*,*,*,*,も,モ,モ
もも	名詞,一般,*,*,*,*,もも,モモ,モモ
も	助詞,係助詞,*,*,*,*,も,モ,モ
もも	名詞,一般,*,*,*,*,もも,モモ,モモ
の	助詞,連体化,*,*,*,*,の,ノ,ノ
うち	名詞,非自立,副詞可能,*,*,*,うち,ウチ,ウチ
EOS

$
$ # 🎉
$ docker run --rm homebrew/brew cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.1 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

$ docker run --rm homebrew/brew brew --version
Homebrew 2.5.7
Homebrew/linuxbrew-core (git revision 0a462; last commit 2020-10-26)