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

Automate bumping formula and testing build #2

Open
mahiki opened this issue Jul 23, 2024 · 3 comments
Open

Automate bumping formula and testing build #2

mahiki opened this issue Jul 23, 2024 · 3 comments

Comments

@mahiki
Copy link
Owner

mahiki commented Jul 23, 2024

Goals:

  1. GHA trigger this repository to update the version number
  2. checkout repo, change the formula with new release version number (for url)
  3. run test of built package
  4. merge changes to main. (tag not needed probably?)

RSRC

GHA from source repo, bump formula

triggering GHA action from another repo with API

reusable workflow with on: workflow_call


To make this run smoothly you need to learn a bit about developing homebrew formula and there are a few gotchas in the build/compile/binaries/configurations world of it.

Maybe just build your packages in Julia and deploy those as scripts? Its another path toward solving the same problem.
This package's purpose is cleanly deploying packaged python applications to my home macos environment.

  • Am I going to stay on macOS for the rest of my time? perhaps the nixOS on linux hardware will be the future
  • learning python and getting out of bash scripting was the original idea, homebrew deployment is bogging down in concepts I'm not really interested in.

update 2024-07-24: I figured out how to deploy installment using poetry. No more need for resource blocks and jinja templates. See below.

update 2024-09-27: this post about GHA trigger from other repo prob has the answer

@mahiki
Copy link
Owner Author

mahiki commented Jul 23, 2024

Here's something helpful:

https://pypi.org/project/poetry-homebrew-formula/ a package to install with poetry to create the homebrew formula.

https://github.com/tdsmith/homebrew-pypi-poet

@mahiki
Copy link
Owner Author

mahiki commented Jul 24, 2024

Those docs are great but THIS WORKS - poetry install inside of brew def install:

class Desertislandutils < Formula
  include Language::Python::Virtualenv

  desc "Be here, thy collection of personal convenience utilities"
  homepage "https://github.com/mahiki/homebrew-tap"
  url "https://github.com/mahiki/desertislandutils/releases/download/v0.3.10/desertislandutils-0.3.10.tar.gz"
  sha256 "9c8304fdb02a1fd9d3ffd460cdaf25f1b22a70f2d18ebde700080d328c306216"
  license "MIT"

  depends_on "[email protected]"
  depends_on "poetry"

  def install
    venv = virtualenv_create(libexec, "python3")
    ENV["VIRTUAL_ENV"] = libexec
    ENV.prepend_path "PATH", "#{libexec}/bin"
    puts "install stage libexec path: #{libexec}"
    puts "env VIRTUAL_ENV: #{ENV["VIRTUAL_ENV"]}"
    puts "buildpath: #{buildpath}"
    cd buildpath do
        system "poetry", "install", "--no-root"
    end
    venv.pip_install_and_link buildpath
  end

  test do
    system "#{bin}/wn", "--help"
    system "#{bin}/too", "--help"
  end
end

@mahiki
Copy link
Owner Author

mahiki commented Jul 24, 2024

Maybe change back to pypi releases via poetry publish. Its easy, and includes the SHA256 unlike github.

@mahiki mahiki changed the title Brew package development / deployment process Automate bumping formula and testing build Jul 24, 2024
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