Skip to content

Commit

Permalink
Add tar.gz/standalone binary/zip packages - #53
Browse files Browse the repository at this point in the history
* more-packages:
  Fix link to the tar.gz package in README
  Deploy chdig standalone binary properly
  Obtain arch with $(uname -m) over using rustc --print target-spec-json
  Remove chdig standalone binary from the mapping
  Add arch for the tar.xz package
  ci: use explicit mapping for latest artifacts
  Switch archive format for windows to *.zip
  Add chdig as a single binary into releases
  Add tar.gz package
  • Loading branch information
azat committed Apr 5, 2024
2 parents 1a7dc6b + adaaa6a commit aed3564
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,14 @@ jobs:
run: |
set -x
make packages target=x86_64-unknown-linux-musl
for postfix in .x86_64.rpm -x86_64.pkg.tar.zst _amd64.deb; do
cp chdig*$postfix chdig-latest$postfix
declare -A mapping
mapping[chdig*.x86_64.rpm]=chdig-latest.x86_64.rpm
mapping[chdig*-x86_64.pkg.tar.zst]=chdig-latest-x86_64.pkg.tar.zst
mapping[chdig*-x86_64.tar.gz]=chdig-latest-x86_64.tar.gz
mapping[chdig*_amd64.deb]=chdig-latest_amd64.deb
mapping[target/chdig]=chdig
for pattern in "${!mapping[@]}"; do
cp $pattern ${mapping[$pattern]}
done
- name: Check package
Expand All @@ -86,6 +92,7 @@ jobs:
with:
name: linux-packages
path: |
chdig
*.deb
*.rpm
*.tar.*
Expand Down Expand Up @@ -193,11 +200,11 @@ jobs:
run: |
make deploy-binary
cp target/chdig.exe chdig-windows.exe
gzip --keep chdig-windows.exe
Compress-Archive -Path chdig-windows.exe -DestinationPath chdig-windows.exe.zip
- name: Archive Windows packages
uses: actions/upload-artifact@v3
with:
name: windows-packages
path: |
chdig-windows.exe.gz
chdig-windows.exe.zip
3 changes: 2 additions & 1 deletion .github/workflows/pre_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ jobs:
title: "Development Build"
files: |
macos-packages/chdig-macos-x86_64.gz
windows-packages/chdig-windows.exe.gz
windows-packages/chdig-windows.exe.zip
linux-packages/chdig
linux-packages/*.deb
linux-packages/*.rpm
linux-packages/*.tar.*
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ jobs:
prerelease: false
files: |
macos-packages/chdig-macos-x86_64.gz
windows-packages/chdig-windows.exe.gz
windows-packages/chdig-windows.exe.zip
linux-packages/chdig
linux-packages/*.deb
linux-packages/*.rpm
linux-packages/*.tar.*
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

debug ?=
target ?= $(shell rustc -vV | sed -n 's|host: ||p')
arch = $(shell uname -m)

# Version normalization for deb/rpm:
# - trim "v" prefix
Expand Down Expand Up @@ -35,7 +36,7 @@ export PYO3_CONFIG_FILE = $(CURDIR)/contrib/flameshow/build/pyo3-build-config-fi
$(info PYO3_CONFIG_FILE = $(PYO3_CONFIG_FILE))

.PHONY: build build_completion deploy-binary chdig install run \
deb rpm archlinux packages
deb rpm archlinux tar packages

# This should be the first target (since ".DEFAULT_GOAL" is supported only since 3.80+)
default: build
Expand All @@ -62,14 +63,24 @@ install: chdig build_completion
deploy-binary: chdig
cp target/$(target)/$(target_type)/chdig target/chdig

packages: build build_completion deb rpm archlinux
packages: build build_completion deb rpm archlinux tar

deb: build
CHDIG_VERSION=${CHDIG_VERSION} nfpm package --config chdig-nfpm.yaml --packager deb
rpm: build
CHDIG_VERSION=${CHDIG_VERSION} nfpm package --config chdig-nfpm.yaml --packager rpm
archlinux: build
CHDIG_VERSION=${CHDIG_VERSION_ARCH} nfpm package --config chdig-nfpm.yaml --packager archlinux
.ONESHELL:
tar: archlinux
CHDIG_VERSION=${CHDIG_VERSION_ARCH} nfpm package --config chdig-nfpm.yaml --packager archlinux
tmp_dir=$(shell mktemp -d /tmp/chdig-${CHDIG_VERSION}.XXXXXX)
echo "Temporary directory for tar package: $$tmp_dir"
tar -C $$tmp_dir -vxf chdig-${CHDIG_VERSION_ARCH}-1-x86_64.pkg.tar.zst usr
# Strip /tmp/chdig-${CHDIG_VERSION}.XXXXXX and replace it with chdig-${CHDIG_VERSION}
# (and we need to remove leading slash)
tar --show-transformed-names --transform "s#^$${tmp_dir#/}#chdig-${CHDIG_VERSION}-${arch}#" -vczf chdig-${CHDIG_VERSION}-${arch}.tar.gz $$tmp_dir
echo rm -fr $$tmp_dir

help:
@echo "Usage: make [debug=1] [target=<TRIPLE>]"
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ Dig into [ClickHouse](https://github.com/ClickHouse/ClickHouse/) with TUI interf

There are pre-built packages for the latest available version:

- [chdig standalone binary](https://github.com/azat/chdig/releases/download/latest/chdig)
- [debian](https://github.com/azat/chdig/releases/download/latest/chdig-latest_amd64.deb)
- [fedora](https://github.com/azat/chdig/releases/download/latest/chdig-latest.x86_64.rpm)
- [archlinux](https://github.com/azat/chdig/releases/download/latest/chdig-latest-x86_64.pkg.tar.zst)
- [tar.gz](https://github.com/azat/chdig/releases/download/latest/chdig-latest-x86_64.tar.gz)
- [macos x86_64](https://github.com/azat/chdig/releases/download/latest/chdig-macos-x86_64.gz)
- [windows](https://github.com/azat/chdig/releases/download/latest/chdig-windows.exe.gz)
- [windows](https://github.com/azat/chdig/releases/download/latest/chdig-windows.exe.zip)

<details>

Expand Down

0 comments on commit aed3564

Please sign in to comment.