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

Build either pkgx^1 or pkgx^2 #7

Merged
merged 1 commit into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: Homebrew/actions/setup-homebrew@master
- uses: pkgxdev/setup@v1

Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
on:
pull_request:
paths:
- pkgx.rb

jobs:
smoke:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Homebrew/actions/setup-homebrew@master
- run: brew install --build-from-source ./pkgx.rb
- run: brew test pkgx
- run: brew audit pkgx
28 changes: 12 additions & 16 deletions pkgx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,20 @@ class Pkgx < Formula

depends_on "deno" => :build
depends_on "unzip" => :build # deno >=1.39.1 uses unzip when remote-fetching their compilable runtime
depends_on "rust" => :build

def install
system "deno", "task", "compile"

bin.install "pkgx"
on_linux do
depends_on "sqlite"
end

def caveats
<<~EOS
try it out:

pkgx node@18 --eval 'console.log("pkgx: run anything")'

shell integration:

pkgx integrate --dry-run
# ^^ https://docs.pkgx.sh/shell-integration
EOS
def install
if File.file? "Cargo.toml"
system "cargo", "build", "--release"
bin.install "target/release/pkgx"
else
system "deno", "task", "compile"
bin.install "pkgx"
end
end

test do
Expand All @@ -50,7 +46,7 @@ def caveats
EOS

with_env("PKGX_DIR" => testpath/".pkgx") do
assert_equal "hello, world", shell_output("#{bin}/pkgx '#{testpath}/hello.js'").chomp
assert_equal "hello, world", shell_output("#{bin}/pkgx deno run '#{testpath}/hello.js'").chomp
end
end
end
Loading