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

chore(query): spilt binary symbol #16861

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
7 changes: 7 additions & 0 deletions .github/actions/build_linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ runs:
readelf -p .comment ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-query || true
ldd ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-query || true

- name: Spilt Binary Symbols
shell: bash
run: |
objcopy --only-keep-debug ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-query ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-query.debug
chmod 0644 ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-query.debug
strip --strip-debug --remove-section=.comment --remove-section=.note ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-query

# - name: Compress Binaries with UPX
# if: env.BUILD_PROFILE == 'debug'
# uses: crazy-max/ghaction-upx@v2
Expand Down
95 changes: 95 additions & 0 deletions .github/actions/pack_binaries/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: "Pack Binary"
description: "Pack releases binaries"
inputs:
target:
description: "Release target"
required: true
category:
description: "Release default/hdfs/udf/testsuite"
required: false
default: default
version:
description: "Release version"
required: true

runs:
using: "composite"
steps:
- name: Download artifact
uses: ./.github/actions/artifact_download
with:
sha: ${{ github.sha }}
target: ${{ inputs.target }}
category: ${{ inputs.category }}
path: distro/bin
artifacts: metactl,meta,query
- name: Pack Binaries
id: pack_binaries
shell: bash
run: |
target=${{ inputs.target }}
version=${{ inputs.version }}
case ${{ inputs.category }} in
default)
pkg_name="databend-${version}-${target}"
;;
*)
pkg_name="databend-${{ inputs.category }}-${version}-${target}"
;;
esac
mkdir -p distro/{bin,configs,systemd,scripts}
cp ./scripts/distribution/systemd/databend-* distro/systemd/
cp ./scripts/distribution/configs/databend-* distro/configs/
cp ./scripts/distribution/release-readme.txt distro/readme.txt
cp -r ./scripts/distribution/local-scripts/* distro/scripts/
cp -r ./scripts/distribution/package-scripts/* distro/scripts/
tar -C ./distro --exclude='*.debug' -czvf ${pkg_name}.tar.gz bin configs systemd scripts readme.txt
sha256sum ${pkg_name}.tar.gz >> sha256-${pkg_name}.txt
echo "pkg_name=$pkg_name" >> $GITHUB_OUTPUT
- name: post sha256
uses: actions/upload-artifact@v4
with:
name: sha256sums-${{ inputs.category }}-${{ inputs.target }}
path: sha256-${{ steps.pack_binaries.outputs.pkg_name }}.txt
retention-days: 1
- name: post binaries
uses: actions/upload-artifact@v4
with:
name: ${{ steps.pack_binaries.outputs.pkg_name }}.tar.gz
path: ${{ steps.pack_binaries.outputs.pkg_name }}.tar.gz
retention-days: 1
- name: Pack DBG Binaries
id: pack_dbg_binaries
shell: bash
run: |
target=${{ inputs.target }}
version=${{ inputs.version }}
case ${{ inputs.category }} in
default)
pkg_name="databend-${version}-${target}-dbg"
;;
*)
pkg_name="databend-${{ inputs.category }}-${version}-${target}-dbg"
;;
esac
mkdir -p distro/{bin,configs,systemd,scripts}
cp ./scripts/distribution/systemd/databend-* distro/systemd/
cp ./scripts/distribution/configs/databend-* distro/configs/
cp ./scripts/distribution/release-readme.txt distro/readme.txt
cp -r ./scripts/distribution/local-scripts/* distro/scripts/
cp -r ./scripts/distribution/package-scripts/* distro/scripts/
tar -C ./distro -czvf ${pkg_name}.tar.gz bin configs systemd scripts readme.txt
sha256sum ${pkg_name}.tar.gz >> sha256-${pkg_name}.txt
echo "pkg_name=$pkg_name" >> $GITHUB_OUTPUT
- name: post dbg sha256
uses: actions/upload-artifact@v4
with:
name: sha256sums-${{ inputs.category }}-${{ inputs.target }}-gdb
path: sha256-${{ steps.pack_dbg_binaries.outputs.pkg_name }}.txt
retention-days: 1
- name: post binaries
uses: actions/upload-artifact@v4
with:
name: ${{ steps.pack_dbg_binaries.outputs.pkg_name }}.tar.gz
path: ${{ steps.pack_dbg_binaries.outputs.pkg_name }}.tar.gz
retention-days: 1
1 change: 0 additions & 1 deletion .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:

linux:
needs: changes
if: needs.changes.outputs.any_src_changed == 'true'
uses: ./.github/workflows/reuse.linux.yml
secrets: inherit
with:
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/reuse.linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -336,3 +336,14 @@ jobs:
build_profile: ${{ inputs.build_profile }}
runner_provider: ${{ inputs.runner_provider }}
license_type: ${{ inputs.license_type }}

test_publish:
needs: [build]
runs-on: [self-hosted, X64, Linux, 4c8g, "${{ inputs.runner_provider }}"]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/pack_binaries
with:
version: 1.2
target: x86_64-unknown-linux-gnu
category: default
29 changes: 29 additions & 0 deletions scripts/setup/dev_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,34 @@ function install_libtiff {
esac
}

function install_binutils {
PACKAGE_MANAGER=$1

echo "==> installing libtiff..."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo


case "$PACKAGE_MANAGER" in
apt-get)
install_pkg binutils "$PACKAGE_MANAGER"
;;
pacman)
# skip
;;
apk)
# skip
;;
yum | dnf)
install_pkg binutils "$PACKAGE_MANAGER"
;;
brew)
# skip
;;
*)
echo "Unable to install libtiff with package manager: $PACKAGE_MANAGER"
exit 1
;;
esac
}

function install_rustup {
RUST_TOOLCHAIN=$1

Expand Down Expand Up @@ -624,6 +652,7 @@ if [[ "$INSTALL_BUILD_TOOLS" == "true" ]]; then
install_python3 "$PACKAGE_MANAGER"
install_sqlite3 "$PACKAGE_MANAGER"
install_libtiff "$PACKAGE_MANAGER"
install_binutils "$PACKAGE_MANAGER"

# Any call to cargo will make rustup install the correct toolchain
cargo version
Expand Down
1 change: 1 addition & 0 deletions src/binaries/query/oss_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ fn main() {
async fn main_entrypoint() -> Result<(), MainError> {
let make_error = || "an fatal error occurred in query";

// test1
let conf: InnerConfig = InnerConfig::load().await.with_context(make_error)?;
if run_cmd(&conf).await.with_context(make_error)? {
return Ok(());
Expand Down
Loading